TF-EssentialsX/Essentials/src/com/earth2me/essentials/commands/Commandtop.java

32 lines
1.1 KiB
Java
Raw Normal View History

package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n.tl;
2011-06-13 13:05:11 +00:00
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
2013-08-12 23:55:31 +00:00
import com.earth2me.essentials.utils.LocationUtil;
2011-11-18 17:42:26 +00:00
import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class Commandtop extends EssentialsCommand
{
public Commandtop()
{
super("top");
}
@Override
2011-11-18 19:30:05 +00:00
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
2011-11-18 19:30:05 +00:00
final int topX = user.getLocation().getBlockX();
final int topZ = user.getLocation().getBlockZ();
final float pitch = user.getLocation().getPitch();
final float yaw = user.getLocation().getYaw();
final Location loc = LocationUtil.getSafeDestination(new Location(user.getWorld(), topX, user.getWorld().getMaxHeight(), topZ, yaw, pitch));
user.getTeleport().teleport(loc, new Trade(this.getName(), ess), TeleportCause.COMMAND);
user.sendMessage(tl("teleportTop", loc.getWorld().getName(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()));
}
}