diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-03-27 15:28:40 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-03-27 15:28:40 +0100 |
commit | c1744fe216cddc61f45c6b253ae865ead7c38123 (patch) | |
tree | 6e9297288076c91178005d9ad3c13708f37a0c80 | |
parent | 66777adfb9f13c12754474ce1bcd288457ec52b3 (diff) | |
download | Essentials-c1744fe216cddc61f45c6b253ae865ead7c38123.tar Essentials-c1744fe216cddc61f45c6b253ae865ead7c38123.tar.gz Essentials-c1744fe216cddc61f45c6b253ae865ead7c38123.tar.lz Essentials-c1744fe216cddc61f45c6b253ae865ead7c38123.tar.xz Essentials-c1744fe216cddc61f45c6b253ae865ead7c38123.zip |
Adding world permission checks to:
tpaall tpall tpahere tphere tpohere
User is required to have the permission for the world he is in, before he can teleport users outside this world, to it.
6 files changed, 30 insertions, 2 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java index c0abdc1ad..7af445c51 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java @@ -45,6 +45,11 @@ public class Commandtpaall extends EssentialsCommand { continue; } + if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + user.getWorld().getName())) + { + continue; + } try { player.requestTeleport(user, true); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java index 7f06602ae..9203f9015 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java @@ -25,12 +25,14 @@ public class Commandtpaccept extends EssentialsCommand throw new Exception(_("noPendingRequest")); } - if (user.isTpRequestHere() && !target.isAuthorized("essentials.tpahere")) + if (user.isTpRequestHere() && ((!target.isAuthorized("essentials.tpahere") && !target.isAuthorized("essentials.tpaall")) + || (user.getWorld() != target.getWorld() && ess.getSettings().isWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + user.getWorld().getName())))) { throw new Exception(_("noPendingRequest")); } - if (!user.isTpRequestHere() && ((!target.isAuthorized("essentials.tpa") && !target.isAuthorized("essentials.tpaall")) + if (!user.isTpRequestHere() && (!target.isAuthorized("essentials.tpa") || (user.getWorld() != target.getWorld() && ess.getSettings().isWorldTeleportPermissions() && !user.isAuthorized("essentials.world." + target.getWorld().getName())))) { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java index 376c2be44..9d389ecac 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java @@ -25,6 +25,11 @@ public class Commandtpahere extends EssentialsCommand { throw new Exception(_("teleportDisabled", player.getDisplayName())); } + if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + user.getWorld().getName())) + { + throw new Exception(_("noPerm", "essentials.world." + user.getWorld().getName())); + } player.requestTeleport(user, true); player.sendMessage(_("teleportHereRequest", user.getDisplayName())); player.sendMessage(_("typeTpaccept")); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java index f21f1a6bc..6335a4a54 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpall.java @@ -42,6 +42,11 @@ public class Commandtpall extends EssentialsCommand { continue; } + if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + user.getWorld().getName())) + { + continue; + } try { player.getTeleport().now(user, false, TeleportCause.COMMAND); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java index 733091d1a..92eb87226 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtphere.java @@ -22,6 +22,11 @@ public class Commandtphere extends EssentialsCommand { throw new Exception(_("teleportDisabled", player.getDisplayName())); } + if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + user.getWorld().getName())) + { + throw new Exception(_("noPerm", "essentials.world." + user.getWorld().getName())); + } player.getTeleport().teleport(user, new Trade(this.getName(), ess), TeleportCause.COMMAND); user.sendMessage(_("teleporting")); player.sendMessage(_("teleporting")); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java index 6183bcf74..880c4e362 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java @@ -30,6 +30,12 @@ public class Commandtpohere extends EssentialsCommand throw new NoSuchFieldException(_("playerNotFound")); } + if (user.getWorld() != player.getWorld() && ess.getSettings().isWorldTeleportPermissions() + && !user.isAuthorized("essentials.world." + user.getWorld().getName())) + { + throw new Exception(_("noPerm", "essentials.world." + user.getWorld().getName())); + } + // Verify permission if (!player.isHidden() || user.isAuthorized("essentials.teleport.hidden")) { |