From f8d1c61886da36126857e143053d8c1ffc54472d Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sat, 17 Mar 2012 06:08:06 +0000 Subject: New permission: essentials.tp.others - Allows players to /tp replaces old reused permission. New permission usage: if world-teleport-permissions is true in the config, TP commands will now check for essentials.world. when a tp would switch worlds. --- Essentials/src/com/earth2me/essentials/commands/Commandtp.java | 9 +++++++-- Essentials/src/com/earth2me/essentials/commands/Commandtpa.java | 5 +++++ Essentials/src/com/earth2me/essentials/commands/Commandtpo.java | 5 +++++ .../src/com/earth2me/essentials/commands/Commandworld.java | 8 ++------ Essentials/src/config.yml | 2 +- Essentials/src/messages.properties | 1 - Essentials/src/messages_da.properties | 1 - Essentials/src/messages_de.properties | 1 - Essentials/src/messages_en.properties | 1 - Essentials/src/messages_es.properties | 1 - Essentials/src/messages_fr.properties | 1 - Essentials/src/messages_nl.properties | 1 - 12 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java index f65dc75f8..72739966b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtp.java @@ -30,6 +30,11 @@ public class Commandtp 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())); + } user.sendMessage(_("teleporting")); final Trade charge = new Trade(this.getName(), ess); charge.isAffordableFor(user); @@ -37,9 +42,9 @@ public class Commandtp extends EssentialsCommand throw new NoChargeException(); default: - if (!user.isAuthorized("essentials.tpohere")) + if (!user.isAuthorized("essentials.tp.others")) { - throw new Exception(_("needTpohere")); + throw new Exception(_("noPerm", "essentials.tp.others")); } user.sendMessage(_("teleporting")); final User target = getPlayer(server, args, 0); diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java index 34195d51a..97fa15d5c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpa.java @@ -36,6 +36,11 @@ 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())); } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java index b10f0a301..5edbe274d 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtpo.java @@ -32,6 +32,11 @@ public class Commandtpo extends EssentialsCommand // Verify permission if (!player.isHidden() || user.isAuthorized("essentials.teleport.hidden")) { + 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.getTeleport().now(player, false, TeleportCause.COMMAND); user.sendMessage(_("teleporting")); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandworld.java b/Essentials/src/com/earth2me/essentials/commands/Commandworld.java index 41554c8ce..c160e0a7a 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandworld.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandworld.java @@ -54,13 +54,9 @@ public class Commandworld extends EssentialsCommand } } - if (ess.getSettings().getIsWorldTeleportPermissions()) + if (ess.getSettings().getIsWorldTeleportPermissions() && !user.isAuthorized("essentials.world." + world.getName())) { - if (!user.isAuthorized("essentials.world." + world.getName())) - { - user.sendMessage(_("invalidWorld")); //TODO: Make a "world teleport denied" translation - throw new NoChargeException(); - } + throw new Exception(_("noPerm", "essentials.world." + world.getName())); } double factor; diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index 6a0f6e996..2bbb87afc 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -250,7 +250,7 @@ death-messages: true no-god-in-worlds: # - world_nether -# Set to true to enable per-world permissions for teleporting with /world +# Set to true to enable per-world permissions for teleporting with /world, /tp ,/tpa and /tpo. # Give someone permission to teleport to a world with essentials.world. world-teleport-permissions: false diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 71922e49c..02598c9cb 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -205,7 +205,6 @@ mutedPlayer=Player {0} muted. mutedPlayerFor=Player {0} muted for {1}. mutedUserSpeaks={0} tried to speak, but is muted. nearbyPlayers=Players nearby: {0} -needTpohere=You need access to /tpohere to teleport other players. negativeBalanceError=User is not allowed to have a negative balance. nickChanged=Nickname changed. nickDisplayName=\u00a77You have to enable change-displayname in Essentials config. diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index f5ce209cb..37bae113c 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -205,7 +205,6 @@ mutedPlayer=Spiller {0} muted. mutedPlayerFor=Spiller {0} muted i {1}. mutedUserSpeaks={0} pr\u00f8vede at snakke, men er muted. nearbyPlayers=Spillere i n\u00c3\u00a6rheden: {0} -needTpohere=Du skal have adgang til /tpohere for at teleportere andre spillere. negativeBalanceError=Brugeren har ikke tilladelse til at have en negativ saldo. nickChanged=Nickname \u00e6ndret. nickDisplayName=\u00a77Du bliver n\u00c3\u00b8dt til at aktivere change-displayname i Essentials config. diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index fbc93504e..99501d2e5 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -205,7 +205,6 @@ mutedPlayer=Player {0} ist nun stumm. mutedPlayerFor=Player {0} ist nun stumm f\u00fcr {1}. mutedUserSpeaks={0} versuchte zu sprechen, aber ist stumm geschaltet. nearbyPlayers=Players nearby: {0} -needTpohere=Du brauchst Zugriff auf /tpohere um andere Spieler teleportieren zu k\u00f6nnen. negativeBalanceError=Spieler darf keine Schulden machen. nickChanged=Nickname ge\u00e4ndert. nickDisplayName=\u00a77Du musst \u00a7fchange-displayname\u00a7c in der Essentials-Config aktivieren. diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 09ee97a55..6f4d29020 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -205,7 +205,6 @@ mutedPlayer=Player {0} muted. mutedPlayerFor=Player {0} muted for {1}. mutedUserSpeaks={0} tried to speak, but is muted. nearbyPlayers=Players nearby: {0} -needTpohere=You need access to /tpohere to teleport other players. negativeBalanceError=User is not allowed to have a negative balance. nickChanged=Nickname changed. nickDisplayName=\u00a77You have to enable change-displayname in Essentials config. diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index d9add11c0..f1609f7f9 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -205,7 +205,6 @@ mutedPlayer=Player {0} silenciado. mutedPlayerFor=Player {0} silenciado durante {1}. mutedUserSpeaks={0} intento hablar, pero esta silenciado. nearbyPlayers=Players nearby: {0} -needTpohere=Necesitas acceso a /tpohere para teletransportar a otros jugadores. negativeBalanceError=El usuario no tiene permitido tener un saldo negativo. nickChanged=Nombre de jugador cambiado. nickDisplayName=\u00a77Tienes que habilitar cambio de nombre de usuario en la configuracion de Essentials. diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index 78b1b894e..4e33fa061 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -205,7 +205,6 @@ mutedPlayer=Le joueur {0} est d\u00e9sormais muet. mutedPlayerFor={0} a \u00e9t\u00e9 muet pour {1}. mutedUserSpeaks={0} a essay\u00e9 de parler mais est muet. nearbyPlayers=Joueurs dans les environs : {0} -needTpohere=Vous avez besoin de l'acc\u00c3\u00a8s \u00e0 /tpohere pour t\u00e9l\u00e9porter d'autres joueurs. negativeBalanceError=L'utilisateur n'est pas autoris\u00e9 \u00e0 avoir un solde n\u00e9gatif. nickChanged=surnom modifi\u00e9. nickDisplayName=\u00a77Vous devez activer change-displayname dans la configuration Essentials. diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index 9b855643a..c08111085 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -205,7 +205,6 @@ mutedPlayer=Speler {0} gemute. mutedPlayerFor=Speler {0} is gemute voor {1}. mutedUserSpeaks={0} probeerde te praten, maar is gemute. nearbyPlayers=Players nearby: {0} -needTpohere=Je moet toegang krijgen tot /tpohere om naar andere spelers te teleporteren. negativeBalanceError=Speler is niet toegestaan om een negatief saldo te hebben. nickChanged=Nickname veranderd. nickDisplayName=\u00a77You have to enable change-displayname in Essentials config. -- cgit v1.2.3