summaryrefslogtreecommitdiffstats
path: root/Essentials/src/net/ess3/commands/Commandtop.java
blob: 13775f7cc6def87a18f8f456c71498dcd7afd369 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package net.ess3.commands;

import static net.ess3.I18n._;
import net.ess3.api.IUser;
import net.ess3.api.server.Location;
import net.ess3.economy.Trade;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;


public class Commandtop extends EssentialsCommand
{
	@Override
	public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
	{
		final int topX = user.getLocation().getBlockX();
		final int topZ = user.getLocation().getBlockZ();
		final int topY = user.getWorld().getHighestBlockYAt(topX, topZ);
		user.getTeleport().teleport(new Location(user.getWorld(), user.getLocation().getX(), topY + 1, user.getLocation().getZ(), user.getLocation().getYaw(), user.getLocation().getPitch()), new Trade(commandName, ess), TeleportCause.COMMAND);
		user.sendMessage(_("teleportTop"));
	}
}