diff options
author | Iaccidentally <coryhuckaby@gmail.com> | 2012-11-11 14:40:41 -0500 |
---|---|---|
committer | Iaccidentally <coryhuckaby@gmail.com> | 2012-11-11 14:40:41 -0500 |
commit | 0ca75374403bc4b4b0fdbc271d65c89d60074aaa (patch) | |
tree | 08ecb22823e4436c135498ff01d4cfd08ef319d3 | |
parent | 1685ef4f554a701b1c5bec0adf3730e407a783ec (diff) | |
download | Essentials-0ca75374403bc4b4b0fdbc271d65c89d60074aaa.tar Essentials-0ca75374403bc4b4b0fdbc271d65c89d60074aaa.tar.gz Essentials-0ca75374403bc4b4b0fdbc271d65c89d60074aaa.tar.lz Essentials-0ca75374403bc4b4b0fdbc271d65c89d60074aaa.tar.xz Essentials-0ca75374403bc4b4b0fdbc271d65c89d60074aaa.zip |
update tptoggle to allow toggling other players :: new permission: essentials.tptoggle.others
-rw-r--r-- | Essentials/src/net/ess3/commands/Commandtptoggle.java | 19 | ||||
-rw-r--r-- | Essentials/src/net/ess3/permissions/Permissions.java | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/Essentials/src/net/ess3/commands/Commandtptoggle.java b/Essentials/src/net/ess3/commands/Commandtptoggle.java index 0b525baa3..d3f5cc82a 100644 --- a/Essentials/src/net/ess3/commands/Commandtptoggle.java +++ b/Essentials/src/net/ess3/commands/Commandtptoggle.java @@ -2,6 +2,7 @@ package net.ess3.commands; import static net.ess3.I18n._; import net.ess3.api.IUser; +import net.ess3.permissions.Permissions; public class Commandtptoggle extends EssentialsCommand @@ -9,8 +10,26 @@ 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")); + } } } diff --git a/Essentials/src/net/ess3/permissions/Permissions.java b/Essentials/src/net/ess3/permissions/Permissions.java index 84afcef23..177de4718 100644 --- a/Essentials/src/net/ess3/permissions/Permissions.java +++ b/Essentials/src/net/ess3/permissions/Permissions.java @@ -105,6 +105,7 @@ public enum Permissions implements IPermission TPAALL, TPAHERE, TPOHERE, + TPTOGGLE_OTHERS, UNLIMITED_OTHERS, WARP_LIST(PermissionDefault.TRUE), WARP_HIDDEN, |