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

41 lines
965 B
Java
Raw Normal View History

package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
2011-11-18 17:42:26 +00:00
import org.bukkit.Server;
public class Commandtptoggle extends EssentialsCommand
{
public Commandtptoggle()
{
super("tptoggle");
}
@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
{
User otherUser = null;
if (args.length > 0 && user.isAuthorized("essentials.tptoggle.others"))
{
otherUser = ess.getUser(server.getPlayer(args[0]));
if (otherUser == null)
{
throw new Exception(_("playerNotFound"));
}
else
{
ess.getUser(server.getPlayer(args[0])).sendMessage(user.toggleTeleportEnabled()
? _("teleportationEnabled")
: _("teleportationDisabled"));
}
}
else
{
user.sendMessage(user.toggleTeleportEnabled()
? _("teleportationEnabled")
: _("teleportationDisabled"));
}
}
}