From d50d8bfee048c1b483d6f2a7da7e8e4c662c6085 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Fri, 24 Jun 2011 05:13:37 -0700 Subject: [PATCH 1/3] Fixing Typo --- Essentials/src/messages_en.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index dabc86b26..d583f59af 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -170,7 +170,7 @@ negativeBalanceError = User is not allowed to have a negative balance. nickChanged = Nickname changed. nickInUse = \u00a7cThat name is already in use. nickNamesAlpha = \u00a7cNicknames must be alphanumeric. -nickNoMore = \u00a7You no longer have a nickname. +nickNoMore = \u00a77You no longer have a nickname. nickOthersPermission = \u00a7cYou do not have permission to change the nickname of others nickSet = \u00a77Your nickname is now \u00a7c{0} noAccessCommand = \u00a7cYou do not have access to that command. From 209a9a2f958a583b3d50dd7a60c62a3df17a8b70 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Fri, 24 Jun 2011 15:12:04 +0100 Subject: [PATCH 2/3] Searchable help. Toggle commands with no permissions. --- .../src/com/earth2me/essentials/Settings.java | 7 ++++- .../essentials/commands/Commandhelp.java | 29 +++++++++++++++---- Essentials/src/config.yml | 4 ++- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index b67788825..e1e60cb35 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -190,11 +190,16 @@ public class Settings implements IConf { return config.getInt("spawnmob-limit", 10); } - + public boolean showNonEssCommandsInHelp() { return config.getBoolean("non-ess-in-help", true); } + + public boolean hidePermissionlessHelp() + { + return config.getBoolean("hide-permissionless-help", true); + } public int getProtectCreeperMaxHeight() { diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java index 52277b1fa..4361fe1cf 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java @@ -30,17 +30,25 @@ public class Commandhelp extends EssentialsCommand @Override protected void run(Server server, User user, String commandLabel, String[] args) throws Exception { - int page; + int page = 1; + String match = args[0].toLowerCase(); try { - page = args.length > 0 ? Integer.parseInt(args[0]) : 1; + if (args.length > 0) + { + page = Integer.parseInt(args[args.length - 1]); + if (args.length == 1) + { + match = ""; + } + } + } catch (Exception ex) { - page = 1; } - List lines = getHelpLines(user); + List lines = getHelpLines(user, match); int start = (page - 1) * 9; int pages = lines.size() / 9 + (lines.size() % 9 > 0 ? 1 : 0); @@ -58,7 +66,7 @@ public class Commandhelp extends EssentialsCommand } @SuppressWarnings("CallToThreadDumpStack") - private List getHelpLines(User user) throws Exception + private List getHelpLines(User user, String match) throws Exception { List retval = new ArrayList(); File helpFile = new File(ess.getDataFolder(), "help_"+Util.sanitizeFileName(user.getName()) +".txt"); @@ -98,6 +106,12 @@ public class Commandhelp extends EssentialsCommand final HashMap> cmds = (HashMap>)desc.getCommands(); for (Entry> k : cmds.entrySet()) { + if ((!match.equalsIgnoreCase("")) && (!p.getDescription().getName().toLowerCase().contains(match)) + && (!p.getDescription().getDescription().toLowerCase().contains(match))) + { + continue; + } + if (p.getDescription().getName().toLowerCase().contains("essentials")) { final String node = "essentials." + k.getKey(); @@ -121,7 +135,10 @@ public class Commandhelp extends EssentialsCommand } else { - retval.add("§c" + k.getKey() + "§7: " + value.get("description")); + if (!ess.getSettings().hidePermissionlessHelp()) + { + retval.add("§c" + k.getKey() + "§7: " + value.get("description")); + } } } diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index a2369c2e9..7f0b20e8f 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -88,7 +88,6 @@ motd: - '&cWelcome, {PLAYER}&c!' - '&fType &c/help&f for a list of commands.' - 'Currently online: {PLAYERLIST}' - - 'You have {MAILS} mail messages' # The server rules, available by typing /rules rules: @@ -239,6 +238,9 @@ currency-symbol: '$' #Show other plugins commands in help non-ess-in-help: true +#Hide plugins which dont give a permission +hide-permissionless-help: true + ############################################################ # +------------------------------------------------------+ # # | EssentialsChat | # From ef3730670119848191296529b5ba58683d83001b Mon Sep 17 00:00:00 2001 From: KHobbits Date: Thu, 7 Jul 2011 05:19:11 +0100 Subject: [PATCH 3/3] Fixing help --- .../essentials/commands/Commandhelp.java | 11 +++-- Essentials/src/plugin.yml | 41 +++++++++++-------- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java index 3a93e82b1..9d8344ec1 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandhelp.java @@ -31,11 +31,12 @@ public class Commandhelp extends EssentialsCommand protected void run(Server server, User user, String commandLabel, String[] args) throws Exception { int page = 1; - String match = args[0].toLowerCase(); + String match = ""; try { if (args.length > 0) { + match = args[0].toLowerCase(); page = Integer.parseInt(args[args.length - 1]); if (args.length == 1) { @@ -46,6 +47,10 @@ public class Commandhelp extends EssentialsCommand } catch (Exception ex) { + if (args.length == 1) + { + match = args[0].toLowerCase(); + } } List lines = getHelpLines(user, match); @@ -107,8 +112,8 @@ public class Commandhelp extends EssentialsCommand final HashMap> cmds = (HashMap>)desc.getCommands(); for (Entry> k : cmds.entrySet()) { - if ((!match.equalsIgnoreCase("")) && (!p.getDescription().getName().toLowerCase().contains(match)) - && (!p.getDescription().getDescription().toLowerCase().contains(match))) + if ((!match.equalsIgnoreCase("")) && (!k.getKey().toLowerCase().contains(match)) + && (!k.getValue().get("description").toLowerCase().contains(match))) { continue; } diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index 300912857..a2e4a6266 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -12,11 +12,11 @@ commands: usage: / aliases: [eafk] antioch: - description: 'A little surprise for operators. Warning: Point away from face.' + description: 'A little surprise for operators.' usage: / aliases: [eantioch] back: - description: Teleports you to your location prior to teleporting/spawning/warping. + description: Teleports you to your location prior to tp/spawn/warp. usage: / aliases: [eback] backup: @@ -24,7 +24,7 @@ commands: usage: / aliases: [ebackup] balance: - description: States the current balance of a player. Defaults to self. + description: States the current balance of a player. usage: / aliases: [bal,emoney,ebalance,ebal] ban: @@ -57,6 +57,7 @@ commands: deljail: description: Removes a jail usage: / [jailname] + aliases: [edeljail] delwarp: description: Deletes the specified warp. usage: / [warp] @@ -85,7 +86,7 @@ commands: usage: / aliases: [coords,egetpos] gc: - description: Reports garbage collection info; useful to plugin/CraftBukkit developers + description: Reports garbage collection info; useful to developers. usage: / aliases: [mem,memory,egc] give: @@ -102,7 +103,7 @@ commands: aliases: [eheal] help: description: Views a list of available commands. - usage: / + usage: / [search term] [page] aliases: [ehelp] helpop: description: Request help from online operators. @@ -118,7 +119,7 @@ commands: info: description: Shows information set by the server owner usage: / [chapter] [page] - aliases: [ifo,einfo,eabout] + aliases: [ifo,einfo,eabout,news] invsee: description: See the inventory of other players. usage: / @@ -142,19 +143,21 @@ commands: kickall: description: Kicks all players off the server except the issuer. usage: / + aliases: [ekickall] kit: description: Obtains the specified kit or views all available kits. usage: / kill: description: Kills specified player. usage: / + aliases: [ekill] list: description: List all online players. usage: / aliases: [playerlist,who,online,elist] lightning: - description: Command the power of Thor. Look and strike or pass a player args. - usage: / + description: The power of Thor. Strike at cursor or player. + usage: / [player] mail: description: Manages inter-player, intra-server mail. usage: / [read|clear|send [to] [message]] @@ -200,7 +203,7 @@ commands: usage: / [message] aliases: [er] realname: - description: Displays the username of a user based on his/her nickname. + description: Displays the username of a user based on nickname. usage: / [nickname] aliases: [erealname] reloadall: @@ -214,6 +217,7 @@ commands: seen: description: Shows the last logout time of a player usage: / [playername] + aliases: [eseen] sell: description: Sells the item currently in your hand. usage: / [itemname|id|hand|inventory|blocks] [-][amount] @@ -231,15 +235,17 @@ commands: usage: / [warp] aliases: [createwarp,esetwarp] setworth: - description: Set the value of an item for sale, will add item if doesn't exist + description: Set the sell value of an item. usage: / [itemname|id] [price] aliases: [esetworth] socialspy: - description: Toggles if you can see /msg and /mail commands in chat. + description: Toggles if you can see msg/mail commands in chat. usage: / + aliases: [esocialspy] spawner: description: Change the mob type of a spawner usage: / [mob] + aliases: [espawner] spawnmob: description: Spawns a mob. usage: / [mob]<:data><,mount<:data>> @@ -251,9 +257,11 @@ commands: tempban: description: Temporary ban a user. usage: / [playername] [datediff] + aliases: [etempban] thunder: description: Enable/disable thunder. usage: / [duration] + aliases: [ethunder] time: description: Change the server time to day or night. usage: / [day|night] @@ -263,7 +271,7 @@ commands: usage: / [player] [jailname] aliases: [tjail,etogglejail] top: - description: Teleport to the highest block at your current coordinates. + description: Teleport to the highest block at your current position. usage: / aliases: [etop] tp: @@ -280,7 +288,7 @@ commands: description: Request that the specified player teleport to you. usage: / tpall: - desctiption: Teleport all online players to another player. + description: Teleport all online players to another player. usage: / tpdeny: description: Reject a teleport request. @@ -288,7 +296,7 @@ commands: tphere: description: Teleport a player to you. usage: / [player] - aliases: s + aliases: [s] tpo: description: Teleport override for tptoggle. usage: / @@ -308,8 +316,7 @@ commands: unban: description: Unbans the specified player. usage: / [player] - aliases: pardon - aliases: [eunban] + aliases: [pardon,eunban] unbanip: description: Unbans the specified IP address. usage: / [address] @@ -325,7 +332,7 @@ commands: weather: description: Setting the weather. usage: / [duration] - aliases: [sky] + aliases: [sky,sun,storm,eweather] whois: description: Determine the username behind a nickname. usage: / [nickname]