Merge pull request #10 from khobbits/master

Fixing help
This commit is contained in:
snowleo 2011-07-07 07:03:33 -07:00
commit 3a1d0032c6
2 changed files with 32 additions and 20 deletions

View File

@ -31,11 +31,12 @@ public class Commandhelp extends EssentialsCommand
protected void run(Server server, User user, String commandLabel, String[] args) throws Exception protected void run(Server server, User user, String commandLabel, String[] args) throws Exception
{ {
int page = 1; int page = 1;
String match = args[0].toLowerCase(); String match = "";
try try
{ {
if (args.length > 0) if (args.length > 0)
{ {
match = args[0].toLowerCase();
page = Integer.parseInt(args[args.length - 1]); page = Integer.parseInt(args[args.length - 1]);
if (args.length == 1) if (args.length == 1)
{ {
@ -46,6 +47,10 @@ public class Commandhelp extends EssentialsCommand
} }
catch (Exception ex) catch (Exception ex)
{ {
if (args.length == 1)
{
match = args[0].toLowerCase();
}
} }
List<String> lines = getHelpLines(user, match); List<String> lines = getHelpLines(user, match);
@ -107,8 +112,8 @@ public class Commandhelp extends EssentialsCommand
final HashMap<String, HashMap<String, String>> cmds = (HashMap<String, HashMap<String, String>>)desc.getCommands(); final HashMap<String, HashMap<String, String>> cmds = (HashMap<String, HashMap<String, String>>)desc.getCommands();
for (Entry<String, HashMap<String, String>> k : cmds.entrySet()) for (Entry<String, HashMap<String, String>> k : cmds.entrySet())
{ {
if ((!match.equalsIgnoreCase("")) && (!p.getDescription().getName().toLowerCase().contains(match)) if ((!match.equalsIgnoreCase("")) && (!k.getKey().toLowerCase().contains(match))
&& (!p.getDescription().getDescription().toLowerCase().contains(match))) && (!k.getValue().get("description").toLowerCase().contains(match)))
{ {
continue; continue;
} }

View File

@ -12,11 +12,11 @@ commands:
usage: /<command> usage: /<command>
aliases: [eafk] aliases: [eafk]
antioch: antioch:
description: 'A little surprise for operators. Warning: Point away from face.' description: 'A little surprise for operators.'
usage: /<command> usage: /<command>
aliases: [eantioch] aliases: [eantioch]
back: back:
description: Teleports you to your location prior to teleporting/spawning/warping. description: Teleports you to your location prior to tp/spawn/warp.
usage: /<command> usage: /<command>
aliases: [eback] aliases: [eback]
backup: backup:
@ -24,7 +24,7 @@ commands:
usage: /<command> usage: /<command>
aliases: [ebackup] aliases: [ebackup]
balance: balance:
description: States the current balance of a player. Defaults to self. description: States the current balance of a player.
usage: /<command> <player> usage: /<command> <player>
aliases: [bal,emoney,ebalance,ebal] aliases: [bal,emoney,ebalance,ebal]
ban: ban:
@ -57,6 +57,7 @@ commands:
deljail: deljail:
description: Removes a jail description: Removes a jail
usage: /<command> [jailname] usage: /<command> [jailname]
aliases: [edeljail]
delwarp: delwarp:
description: Deletes the specified warp. description: Deletes the specified warp.
usage: /<command> [warp] usage: /<command> [warp]
@ -85,7 +86,7 @@ commands:
usage: /<command> usage: /<command>
aliases: [coords,egetpos] aliases: [coords,egetpos]
gc: gc:
description: Reports garbage collection info; useful to plugin/CraftBukkit developers description: Reports garbage collection info; useful to developers.
usage: /<command> usage: /<command>
aliases: [mem,memory,egc] aliases: [mem,memory,egc]
give: give:
@ -102,7 +103,7 @@ commands:
aliases: [eheal] aliases: [eheal]
help: help:
description: Views a list of available commands. description: Views a list of available commands.
usage: /<command> usage: /<command> [search term] [page]
aliases: [ehelp] aliases: [ehelp]
helpop: helpop:
description: Request help from online operators. description: Request help from online operators.
@ -118,7 +119,7 @@ commands:
info: info:
description: Shows information set by the server owner description: Shows information set by the server owner
usage: /<command> [chapter] [page] usage: /<command> [chapter] [page]
aliases: [ifo,einfo,eabout] aliases: [ifo,einfo,eabout,news]
invsee: invsee:
description: See the inventory of other players. description: See the inventory of other players.
usage: /<command> <player> usage: /<command> <player>
@ -142,19 +143,21 @@ commands:
kickall: kickall:
description: Kicks all players off the server except the issuer. description: Kicks all players off the server except the issuer.
usage: /<command> <reason> usage: /<command> <reason>
aliases: [ekickall]
kit: kit:
description: Obtains the specified kit or views all available kits. description: Obtains the specified kit or views all available kits.
usage: /<command> <kit> usage: /<command> <kit>
kill: kill:
description: Kills specified player. description: Kills specified player.
usage: /<command> <player> usage: /<command> <player>
aliases: [ekill]
list: list:
description: List all online players. description: List all online players.
usage: /<command> usage: /<command>
aliases: [playerlist,who,online,elist] aliases: [playerlist,who,online,elist]
lightning: lightning:
description: Command the power of Thor. Look and strike or pass a player args. description: The power of Thor. Strike at cursor or player.
usage: /<command> <player> usage: /<command> [player]
mail: mail:
description: Manages inter-player, intra-server mail. description: Manages inter-player, intra-server mail.
usage: /<command> [read|clear|send [to] [message]] usage: /<command> [read|clear|send [to] [message]]
@ -200,7 +203,7 @@ commands:
usage: /<command> [message] usage: /<command> [message]
aliases: [er] aliases: [er]
realname: realname:
description: Displays the username of a user based on his/her nickname. description: Displays the username of a user based on nickname.
usage: /<command> [nickname] usage: /<command> [nickname]
aliases: [erealname] aliases: [erealname]
reloadall: reloadall:
@ -214,6 +217,7 @@ commands:
seen: seen:
description: Shows the last logout time of a player description: Shows the last logout time of a player
usage: /<command> [playername] usage: /<command> [playername]
aliases: [eseen]
sell: sell:
description: Sells the item currently in your hand. description: Sells the item currently in your hand.
usage: /<command> [itemname|id|hand|inventory|blocks] [-][amount] usage: /<command> [itemname|id|hand|inventory|blocks] [-][amount]
@ -231,15 +235,17 @@ commands:
usage: /<command> [warp] usage: /<command> [warp]
aliases: [createwarp,esetwarp] aliases: [createwarp,esetwarp]
setworth: 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: /<command> [itemname|id] [price] usage: /<command> [itemname|id] [price]
aliases: [esetworth] aliases: [esetworth]
socialspy: 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: /<command> usage: /<command>
aliases: [esocialspy]
spawner: spawner:
description: Change the mob type of a spawner description: Change the mob type of a spawner
usage: /<command> [mob] usage: /<command> [mob]
aliases: [espawner]
spawnmob: spawnmob:
description: Spawns a mob. description: Spawns a mob.
usage: /<command> [mob]<:data><,mount<:data>> <amount> usage: /<command> [mob]<:data><,mount<:data>> <amount>
@ -251,9 +257,11 @@ commands:
tempban: tempban:
description: Temporary ban a user. description: Temporary ban a user.
usage: /<command> [playername] [datediff] usage: /<command> [playername] [datediff]
aliases: [etempban]
thunder: thunder:
description: Enable/disable thunder. description: Enable/disable thunder.
usage: /<command> <true/false> [duration] usage: /<command> <true/false> [duration]
aliases: [ethunder]
time: time:
description: Change the server time to day or night. description: Change the server time to day or night.
usage: /<command> [day|night] usage: /<command> [day|night]
@ -263,7 +271,7 @@ commands:
usage: /<command> [player] [jailname] <datediff> usage: /<command> [player] [jailname] <datediff>
aliases: [tjail,etogglejail] aliases: [tjail,etogglejail]
top: top:
description: Teleport to the highest block at your current coordinates. description: Teleport to the highest block at your current position.
usage: /<command> usage: /<command>
aliases: [etop] aliases: [etop]
tp: tp:
@ -280,7 +288,7 @@ commands:
description: Request that the specified player teleport to you. description: Request that the specified player teleport to you.
usage: /<command> <player> usage: /<command> <player>
tpall: tpall:
desctiption: Teleport all online players to another player. description: Teleport all online players to another player.
usage: /<command> <player> usage: /<command> <player>
tpdeny: tpdeny:
description: Reject a teleport request. description: Reject a teleport request.
@ -288,7 +296,7 @@ commands:
tphere: tphere:
description: Teleport a player to you. description: Teleport a player to you.
usage: /<command> [player] usage: /<command> [player]
aliases: s aliases: [s]
tpo: tpo:
description: Teleport override for tptoggle. description: Teleport override for tptoggle.
usage: /<command> <player> usage: /<command> <player>
@ -308,8 +316,7 @@ commands:
unban: unban:
description: Unbans the specified player. description: Unbans the specified player.
usage: /<command> [player] usage: /<command> [player]
aliases: pardon aliases: [pardon,eunban]
aliases: [eunban]
unbanip: unbanip:
description: Unbans the specified IP address. description: Unbans the specified IP address.
usage: /<command> [address] usage: /<command> [address]
@ -325,7 +332,7 @@ commands:
weather: weather:
description: Setting the weather. description: Setting the weather.
usage: /<command> <storm/sun> [duration] usage: /<command> <storm/sun> [duration]
aliases: [sky] aliases: [sky,sun,storm,eweather]
whois: whois:
description: Determine the username behind a nickname. description: Determine the username behind a nickname.
usage: /<command> [nickname] usage: /<command> [nickname]