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
{
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<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();
for (Entry<String, HashMap<String, String>> 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;
}

View file

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