From 5cdd6498c3545a28e421d3f309ee5072812434c7 Mon Sep 17 00:00:00 2001 From: Iaccidentally Date: Sun, 11 Nov 2012 14:34:56 -0500 Subject: [PATCH] update tptoggle to allow toggling other players :: new permission: essentials.tptoggle.others --- .../essentials/commands/Commandtptoggle.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java b/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java index 1fc4c2aa4..6a17de81a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java @@ -15,8 +15,26 @@ public class Commandtptoggle extends EssentialsCommand @Override 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")); + } } }