2011-03-19 22:39:51 +00:00
|
|
|
package com.earth2me.essentials.commands;
|
|
|
|
|
2011-11-21 01:55:26 +00:00
|
|
|
import static com.earth2me.essentials.I18n._;
|
2011-03-19 22:39:51 +00:00
|
|
|
import com.earth2me.essentials.User;
|
2011-11-18 17:42:26 +00:00
|
|
|
import org.bukkit.Server;
|
2011-03-19 22:39:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
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
|
2011-03-19 22:39:51 +00:00
|
|
|
{
|
2012-11-11 19:34:56 +00:00
|
|
|
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
|
|
|
|
{
|
2011-05-15 01:30:54 +00:00
|
|
|
user.sendMessage(user.toggleTeleportEnabled()
|
2011-11-21 01:55:26 +00:00
|
|
|
? _("teleportationEnabled")
|
|
|
|
: _("teleportationDisabled"));
|
2012-11-11 19:34:56 +00:00
|
|
|
}
|
2011-03-19 22:39:51 +00:00
|
|
|
}
|
|
|
|
}
|