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

36 lines
1.1 KiB
Java
Raw Normal View History

package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
2011-06-13 13:05:11 +00:00
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
2011-11-18 17:42:26 +00:00
import org.bukkit.Server;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class Commandtphere extends EssentialsCommand
{
public Commandtphere()
{
super("tphere");
}
@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 User player = getPlayer(server, args, 0);
if (!player.isTeleportEnabled())
{
throw new Exception(_("teleportDisabled", player.getDisplayName()));
}
if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions()
&& !user.isAuthorized("essentials.worlds." + user.getWorld().getName()))
{
throw new Exception(_("noPerm", "essentials.worlds." + user.getWorld().getName()));
}
player.getTeleport().teleport(user, new Trade(this.getName(), ess), TeleportCause.COMMAND);
user.sendMessage(_("teleporting"));
player.sendMessage(_("teleporting"));
2011-08-30 02:42:31 +00:00
throw new NoChargeException();
}
}