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

34 lines
884 B
Java
Raw Normal View History

package com.earth2me.essentials.commands;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
2011-11-18 17:42:26 +00:00
import org.bukkit.Server;
public class Commandtpahere extends EssentialsCommand
{
public Commandtpahere()
{
super("tpahere");
}
@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
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
2011-11-18 19:30:05 +00:00
final User player = getPlayer(server, args, 0);
if (!player.isTeleportEnabled())
{
2011-11-18 19:30:05 +00:00
throw new Exception(Util.format("teleportDisabled", player.getDisplayName()));
}
2011-11-18 19:30:05 +00:00
player.requestTeleport(user, true);
player.sendMessage(Util.format("teleportHereRequest", user.getDisplayName()));
player.sendMessage(Util.i18n("typeTpaccept"));
user.sendMessage(Util.format("requestSent", player.getDisplayName()));
}
}