1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-27 08:24:44 +02:00

update tptoggle to allow toggling other players :: new permission: essentials.tptoggle.others

This commit is contained in:
Iaccidentally
2012-11-11 14:40:41 -05:00
parent 1685ef4f55
commit 0ca7537440
2 changed files with 20 additions and 0 deletions

View File

@@ -2,15 +2,34 @@ package net.ess3.commands;
import static net.ess3.I18n._;
import net.ess3.api.IUser;
import net.ess3.permissions.Permissions;
public class Commandtptoggle extends EssentialsCommand
{
@Override
public void run(final IUser user, final String commandLabel, final String[] args) throws Exception
{
IUser otherUser = null;
if (args.length > 0 && Permissions.TPTOGGLE_OTHERS.isAuthorized(user))
{
otherUser = ess.getUserMap().getUser(server.getPlayer(args[0]));
if (otherUser == null)
{
throw new Exception(_("playerNotFound"));
}
else
{
ess.getUserMap().getUser(server.getPlayer(args[0])).sendMessage(user.toggleTeleportEnabled()
? _("teleportationEnabled")
: _("teleportationDisabled"));
}
}
else
{
user.sendMessage(user.toggleTeleportEnabled()
? _("teleportationEnabled")
: _("teleportationDisabled"));
}
}
}

View File

@@ -105,6 +105,7 @@ public enum Permissions implements IPermission
TPAALL,
TPAHERE,
TPOHERE,
TPTOGGLE_OTHERS,
UNLIMITED_OTHERS,
WARP_LIST(PermissionDefault.TRUE),
WARP_HIDDEN,