From 0ab8a2760db34de0b2d184bb7a7edb5f8cf9c23e Mon Sep 17 00:00:00 2001 From: KHobbits Date: Tue, 26 Jul 2011 14:23:14 +0100 Subject: [PATCH 1/4] Adding tempban/kick broadcast permissions and adding a banned by to the broadcast. Adding tempban/kick broadcast permissions and adding a banned by to the broadcast. Merge branch 'master' of github.com:khobbits/Essentials Conflicts: Essentials/src/messages.properties Essentials/src/messages_da.properties Essentials/src/messages_en.properties Essentials/src/messages_fr.properties Essentials/src/messages_nl.properties Merge branch 'master' of github.com:khobbits/Essentials --- .../essentials/commands/Commandban.java | 5 ++++- .../essentials/commands/Commandkick.java | 19 +++++++++++++++---- .../essentials/commands/Commandtempban.java | 12 +++++++++++- Essentials/src/messages.properties | 4 ++-- Essentials/src/messages_da.properties | 4 ++-- Essentials/src/messages_de.properties | 4 ++-- Essentials/src/messages_en.properties | 4 ++-- Essentials/src/messages_fr.properties | 4 ++-- Essentials/src/messages_nl.properties | 6 +++--- 9 files changed, 43 insertions(+), 19 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandban.java b/Essentials/src/com/earth2me/essentials/commands/Commandban.java index 45e6a2035..628058c6e 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandban.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.Console; import com.earth2me.essentials.OfflinePlayer; import org.bukkit.Server; import org.bukkit.command.CommandSender; @@ -53,12 +54,14 @@ public class Commandban extends EssentialsCommand } player.kickPlayer(banReason); ess.getBans().banByName(player.getName()); + String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; + for(Player p : server.getOnlinePlayers()) { User u = ess.getUser(p); if(u.isAuthorized("essentials.ban.notify")) { - p.sendMessage(Util.format("playerBanned", player.getName(), banReason)); + p.sendMessage(Util.format("playerBanned", senderName, player.getName(), banReason)); } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java index 6bae4e713..e9b3720fe 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkick.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkick.java @@ -1,9 +1,11 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.Console; import org.bukkit.Server; import org.bukkit.command.CommandSender; import com.earth2me.essentials.User; import com.earth2me.essentials.Util; +import org.bukkit.entity.Player; public class Commandkick extends EssentialsCommand @@ -21,15 +23,24 @@ public class Commandkick extends EssentialsCommand throw new NotEnoughArgumentsException(); } - User u = getPlayer(server, args, 0); - if (u.isAuthorized("essentials.kick.exempt")) + User player = getPlayer(server, args, 0); + if (player.isAuthorized("essentials.kick.exempt")) { sender.sendMessage(Util.i18n("kickExempt")); return; } charge(sender); final String kickReason = args.length > 1 ? getFinalArg(args, 1) : Util.i18n("kickDefault"); - u.kickPlayer(kickReason); - server.broadcastMessage(Util.format("playerKicked", u.getName(), kickReason)); + player.kickPlayer(kickReason); + String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; + + for(Player p : server.getOnlinePlayers()) + { + User u = ess.getUser(p); + if(u.isAuthorized("essentials.kick.notify")) + { + p.sendMessage(Util.format("playerKicked", senderName, player.getName(), kickReason)); + } + } } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java index c9495401e..a20ad067f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandtempban.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import com.earth2me.essentials.Console; import com.earth2me.essentials.OfflinePlayer; import org.bukkit.Server; import org.bukkit.command.CommandSender; @@ -48,6 +49,15 @@ public class Commandtempban extends EssentialsCommand player.setBanTimeout(banTimestamp); player.kickPlayer(banReason); ess.getBans().banByName(player.getName()); - server.broadcastMessage(Util.format("playerBanned", player.getName(), banReason)); + String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; + + for(Player p : server.getOnlinePlayers()) + { + User u = ess.getUser(p); + if(u.isAuthorized("essentials.ban.notify")) + { + p.sendMessage(Util.format("playerBanned", senderName, player.getName(), banReason)); + } + } } } diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 3691f2a83..e99f1eba2 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -211,11 +211,11 @@ onlySunStorm = /weather only supports sun/storm. parseError = Error parsing {0} on line {1} pendingTeleportCancelled = \u00a7cPending teleportation request cancelled. permissionsError = Missing Permissions/GroupManager; chat prefixes/suffixes will be disabled. -playerBanned = \u00a7cPlayer {0} banned: {1} +playerBanned = \u00a7cPlayer {0} banned {1} for {2} playerInJail = \u00a7cPlayer is already in jail {0}. playerJailed = \u00a77Player {0} jailed. playerJailedFor = \u00a77Player {0} jailed for {1}. -playerKicked = \u00a7cPlayer {0} kicked: {1} +playerKicked = \u00a7cPlayer {0} kicked {1} for: {2} playerMuted = \u00a77You have been muted playerMutedFor = \u00a77You have been muted for {0} playerNeverOnServer = \u00a7cPlayer {0} was never on this server. diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index 13f68b5db..d4ff0c3cf 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -213,11 +213,11 @@ onlySunStorm = /weather only supports sun/storm. parseError = Fejl ved parsing {0} p\u00e5 linje {1} pendingTeleportCancelled = \u00a7cVentende teleportations anmodning aflyst. permissionsError = Mangler Permissions/GroupManager; chat pr\u00e6fikser/suffikser vil v\u00e6re sl\u00e5et fra. -playerBanned = \u00a7cSpiller {0} bannet: {1} +playerBanned = \u00a7cSpiller {0} bannet {1} - {2} playerInJail = \u00a7cSpiller er allerede i f\u00e6ngsel {0}. playerJailed = \u00a77Spiller {0} f\u00e6ngslet. playerJailedFor = \u00a77Spiller {0} f\u00e6ngslet for {1}. -playerKicked = \u00a7cPlayer {0} kicked: {1} +playerKicked = \u00a7cPlayer {0} kicked {1} for: {2} playerMuted = \u00a77You have been muted playerMutedFor = \u00a77You have been muted for {0} playerNeverOnServer = \u00a7cSpiller {0} var aldrig p\u00e5 denne server. diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index be24d9ac0..61fa2f6a9 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -211,11 +211,11 @@ onlySunStorm = /weather unterst\u00fctzt nur sun/storm. parseError = Fehler beim Parsen von {0} in Zeile {1} pendingTeleportCancelled = \u00a7cLaufende Teleportierung abgebrochen. permissionsError = Permissions/GroupManager fehlt; Chat-Prefixe/-Suffixe sind ausgeschaltet. -playerBanned = \u00a7cSpieler {0} gesperrt: {1} +playerBanned = \u00a7cSpieler {0} gesperrt: {1} - {2} playerInJail = \u00a7cSpieler ist bereits in Gef\u00e4ngnis {0}. playerJailed = \u00a77Spieler {0} eingesperrt. playerJailedFor = \u00a77Spieler {0} eingesperrt f\u00fcr {1}. -playerKicked = \u00a7cSpieler {0} rausgeworfen: {1} +playerKicked = \u00a7cSpieler {0} rausgeworfen: {1} - {2} playerMuted = \u00a77Du bist jetzt stumm. playerMutedFor = \u00a77Du bist jetzt stumm f\u00fcr {0}. playerNeverOnServer = \u00a7cSpieler {0} war niemals auf diesem Server. diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 38b84bb93..e1416122d 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -211,11 +211,11 @@ onlySunStorm = /weather only supports sun/storm. parseError = Error parsing {0} on line {1} pendingTeleportCancelled = \u00a7cPending teleportation request cancelled. permissionsError = Missing Permissions/GroupManager; chat prefixes/suffixes will be disabled. -playerBanned = \u00a7cPlayer {0} banned: {1} +playerBanned = \u00a7cPlayer {0} banned {1} for: {2} playerInJail = \u00a7cPlayer is already in jail {0}. playerJailed = \u00a77Player {0} jailed. playerJailedFor = \u00a77Player {0} jailed for {1}. -playerKicked = \u00a7cPlayer {0} kicked: {1} +playerKicked = \u00a7cPlayer {0} kicked {1} for: {2} playerMuted = \u00a77You have been muted playerMutedFor = \u00a77You have been muted for {0} playerNeverOnServer = \u00a7cPlayer {0} was never on this server. diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index e240b43af..3a3a2e6cc 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -211,11 +211,11 @@ onlySunStorm = /weather only supports sun/storm. parseError = Erreur de conversion {0} \u00e0 la ligne {1} pendingTeleportCancelled = \u00a7cRequete de t\u00e9l\u00e9portation annul\u00e9e. permissionsError = Permissions/GroupManager manquant, les pr\u00e9fixes et suffixes ne seront pas affich\u00e9s. -playerBanned = \u00a7cLe joueur {0} a \u00e9t\u00e9 banni: {1} +playerBanned = \u00a7cLe joueur {0} a \u00e9t\u00e9 banni: {1} - {2} playerInJail = \u00a7cLe joueur est d\u00e9j\u00e0 dans la prison {0}. playerJailed = \u00a77Le joueur {0} a \u00e9t\u00e9 emprisonn\u00e9. playerJailedFor = \u00a77{0} a \u00e9t\u00e9 emprisonn\u00e9 pour {1}. -playerKicked = \u00a7cPlayer {0} kicked: {1} +playerKicked = \u00a7cPlayer {0} kicked {1} for {2} playerMuted = \u00a77You have been muted playerMutedFor = \u00a77You have been muted for {0} playerNeverOnServer = \u00a7cLe joueur {0} n''a jamais \u00e9t\u00e9 sur le serveur. diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index 1f3915f7f..001ee64ae 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -3,7 +3,7 @@ # Translations start here # by Geertje123 addedToAccount = \u00a7a{0} is gestort op je account. -addedToOthersAccount = \u00a7a{0} is overgemaakt naar {1}''s rekening +addedToOthersAccount = \u00a7a{0} is overgemaakt naar {1}'s rekening alertBroke = gebroken: alertFormat = \u00a73[{0}] \u00a7f {1} \u00a76 {2} bij: {3} alertPlaced = geplaatst: @@ -212,11 +212,11 @@ onlySunStorm = /weather only supports sun/storm. parseError = Fout bij ontleding {0} op regel {1} pendingTeleportCancelled = \u00a7cAangevraagde teleportatie afgelast. permissionsError = Permissions/GroupManager ontbreekt; chat prefixes/suffixes worden uitgeschakeld. -playerBanned = \u00a7cSpeler {0} is geband: {1} +playerBanned = \u00a7cSpeler {0} is geband: {1} - {2} playerInJail = \u00a7cSpeler zit al in de gevangenis {0}. playerJailed = \u00a77Speler {0} is in de gevangenis gezet. playerJailedFor = \u00a77Speler {0} is in de gevangenis gezet voor {1}. -playerKicked = \u00a7cPlayer {0} kicked: {1} +playerKicked = \u00a7cPlayer {0} kicked: {1} - {2} playerMuted = \u00a77Je kreeg het zwijgen opgelegd. playerMutedFor = \u00a77Je kreeg het zwijgen opgelegd voor {0} playerNeverOnServer = \u00a7cSpeler {0} is nooit op deze server geweest. From d6dc6d1d39cfa9137f067e0e46f130f2f09b4254 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Tue, 26 Jul 2011 14:28:23 +0100 Subject: [PATCH 2/4] fixing lost revision. --- Essentials/src/messages_nl.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index 001ee64ae..9387626dd 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -3,7 +3,7 @@ # Translations start here # by Geertje123 addedToAccount = \u00a7a{0} is gestort op je account. -addedToOthersAccount = \u00a7a{0} is overgemaakt naar {1}'s rekening +addedToOthersAccount = \u00a7a{0} is overgemaakt naar {1}''s rekening alertBroke = gebroken: alertFormat = \u00a73[{0}] \u00a7f {1} \u00a76 {2} bij: {3} alertPlaced = geplaatst: From 7b18343e7518277914fc1a889dc93ded49379615 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Wed, 27 Jul 2011 14:25:41 +0100 Subject: [PATCH 3/4] Adding a permission for unhiding help. --- .../src/com/earth2me/essentials/commands/Commandhelp.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java index 07945b75b..2b1ba9776 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java @@ -153,6 +153,10 @@ public class Commandhelp extends EssentialsCommand retval.add("§c" + k.getKey() + "§7: " + value.get("description")); } } + else if (user.isAuthorized("essentials.help." + pluginName)) + { + retval.add("§c" + k.getKey() + "§7: " + value.get("description")); + } else { if (!ess.getSettings().hidePermissionlessHelp()) From 33f48eae0dbf91afd6415606fd5f3a6bbcc38089 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Wed, 27 Jul 2011 14:26:04 +0100 Subject: [PATCH 4/4] Adjusting the config file to mention the help permission --- Essentials/src/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index 186d4a1f0..4cf45b916 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -284,6 +284,9 @@ economy-log-enabled: false non-ess-in-help: true #Hide plugins which dont give a permission +#You can override a true value here for a single plugin by adding a permission to a user/group. +#The indervidual permission is: essentials.help., anyone with essentials.* or '*' will see all help this setting reguardless. +#You can use negitive permissions to remove access to just a single plugins help if the following is enabled. hide-permissionless-help: true ############################################################