summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-05-20 23:58:03 +0100
committerKHobbits <rob@khobbits.co.uk>2012-05-20 23:58:03 +0100
commite4e1c950b5c04ebb48742379f2fa06272ca1b28c (patch)
tree672e8d6558d8aefef72bdfd663337dec8dd2bd04
parent861def1a1cd51dca38a9f3b2710a4a5858e04b12 (diff)
downloadEssentials-e4e1c950b5c04ebb48742379f2fa06272ca1b28c.tar
Essentials-e4e1c950b5c04ebb48742379f2fa06272ca1b28c.tar.gz
Essentials-e4e1c950b5c04ebb48742379f2fa06272ca1b28c.tar.lz
Essentials-e4e1c950b5c04ebb48742379f2fa06272ca1b28c.tar.xz
Essentials-e4e1c950b5c04ebb48742379f2fa06272ca1b28c.zip
Make /home and /back obey the world perm system.
This will prevent players from moving between words using virtually all essentials commands. ATM /warp is excepted, because we already have per warp permissions. Ess3 may see warp permissions altered to: essentials.warp.<world>.<warpname>
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandback.java5
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandhome.java14
-rw-r--r--Essentials/src/config.yml3
3 files changed, 19 insertions, 3 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandback.java b/Essentials/src/com/earth2me/essentials/commands/Commandback.java
index 2ad39ceea..d2ed98e69 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandback.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandback.java
@@ -16,6 +16,11 @@ public class Commandback extends EssentialsCommand
@Override
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
+ if (user.getWorld() != user.getLastLocation().getWorld() && ess.getSettings().isWorldTeleportPermissions()
+ && !user.isAuthorized("essentials.world." + user.getLastLocation().getWorld().getName()))
+ {
+ throw new Exception(_("noPerm", "essentials.world." + user.getLastLocation().getWorld().getName()));
+ }
final Trade charge = new Trade(this.getName(), ess);
charge.isAffordableFor(user);
user.sendMessage(_("backUsageMsg"));
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
index f14422efd..bc59f4c2b 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandhome.java
@@ -54,7 +54,7 @@ public class Commandhome extends EssentialsCommand
throw new NoChargeException();
}
}
- user.getTeleport().home(player, homeName.toLowerCase(Locale.ENGLISH), charge);
+ goHome(user, player, homeName.toLowerCase(Locale.ENGLISH), charge);
}
catch (NotEnoughArgumentsException e)
{
@@ -80,7 +80,7 @@ public class Commandhome extends EssentialsCommand
}
else if (homes.size() == 1 && player.equals(user))
{
- user.getTeleport().home(player, homes.get(0), charge);
+ goHome(user, player, homes.get(0), charge);
}
else
{
@@ -93,4 +93,14 @@ public class Commandhome extends EssentialsCommand
}
throw new NoChargeException();
}
+
+ private void goHome(final User user, final User player, final String home, final Trade charge) throws Exception
+ {
+ if (user.getWorld() != player.getHome(home).getWorld() && ess.getSettings().isWorldTeleportPermissions()
+ && !user.isAuthorized("essentials.world." + player.getHome(home).getWorld().getName()))
+ {
+ throw new Exception(_("noPerm", "essentials.world." + player.getHome(home).getWorld().getName()));
+ }
+ user.getTeleport().home(player, home, charge);
+ }
}
diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml
index c7c9decb0..06ca57ad5 100644
--- a/Essentials/src/config.yml
+++ b/Essentials/src/config.yml
@@ -284,7 +284,8 @@ death-messages: true
no-god-in-worlds:
# - world_nether
-# Set to true to enable per-world permissions for teleporting with /world, /tp ,/tpa and /tpo.
+# Set to true to enable per-world permissions for teleporting between worlds with essentials commands
+# This applies to /world, /home, /back, /tp[a|o][here|all], but not warps.
# Give someone permission to teleport to a world with essentials.world.<worldname>
world-teleport-permissions: false