summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-03-27 15:28:40 +0100
committerKHobbits <rob@khobbits.co.uk>2012-03-27 15:28:40 +0100
commit97eed50ccca4455b667cb42043860055f0dfc089 (patch)
tree74d77663693a6a30459f5eee6f87cbca553daa54
parent5d45495371bf976907e6f9bb1934eddf3f3f5d3c (diff)
downloadEssentials-97eed50ccca4455b667cb42043860055f0dfc089.tar
Essentials-97eed50ccca4455b667cb42043860055f0dfc089.tar.gz
Essentials-97eed50ccca4455b667cb42043860055f0dfc089.tar.lz
Essentials-97eed50ccca4455b667cb42043860055f0dfc089.tar.xz
Essentials-97eed50ccca4455b667cb42043860055f0dfc089.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.
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpaall.java5
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpaccept.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpahere.java5
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpall.java5
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtphere.java5
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtpohere.java6
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"))
{