From e752538568a7547f68800df003bd96b46ecedf27 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Tue, 20 Mar 2012 11:53:05 +0000 Subject: [PATCH] Fix per world teleport permission checking. --- .../com/earth2me/essentials/commands/Commandtp.java | 5 +++++ .../com/earth2me/essentials/commands/Commandtpa.java | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java index 72739966b..05451fdcf 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java @@ -49,6 +49,11 @@ public class Commandtp extends EssentialsCommand user.sendMessage(_("teleporting")); final User target = getPlayer(server, args, 0); final User toPlayer = getPlayer(server, args, 1); + if (target.getWorld() != toPlayer.getWorld() && ess.getSettings().getIsWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + toPlayer.getWorld().getName())) + { + throw new Exception(_("noPerm", "essentials.world." + toPlayer.getWorld().getName())); + } target.getTeleport().now(toPlayer, false, TeleportCause.COMMAND); target.sendMessage(_("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName())); break; diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java index 97fa15d5c..90e8e69d9 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java @@ -25,6 +25,11 @@ public class Commandtpa extends EssentialsCommand { throw new Exception(_("teleportDisabled", player.getDisplayName())); } + if (user.getWorld() != player.getWorld() && ess.getSettings().getIsWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + player.getWorld().getName())) + { + throw new Exception(_("noPerm", "essentials.world." + player.getWorld().getName())); + } if (!player.isIgnoredPlayer(user.getName())) { player.requestTeleport(user, false); @@ -36,11 +41,6 @@ public class Commandtpa extends EssentialsCommand player.sendMessage(_("teleportRequestTimeoutInfo", ess.getSettings().getTpaAcceptCancellation())); } } - if (user.getWorld() != player.getWorld() && ess.getSettings().getIsWorldTeleportPermissions() - && !user.isAuthorized("essentials.world." + player.getWorld().getName())) - { - throw new Exception(_("noPerm", "essentials.world." + player.getWorld().getName())); - } user.sendMessage(_("requestSent", player.getDisplayName())); } }