[Bleeding] Added Help API. Addresses BUKKIT-863

By: rmichela <deltahat@gmail.com>
This commit is contained in:
Bukkit/Spigot
2012-03-01 00:07:05 -05:00
parent 2280c6be2b
commit 10cd1cbb5c
16 changed files with 596 additions and 35 deletions

View File

@ -83,7 +83,7 @@ public abstract class Command {
* @return true if they can use it, otherwise false
*/
public boolean testPermission(CommandSender target) {
if ((permission == null) || (permission.length() == 0) || (target.hasPermission(permission))) {
if (testPermissionSilent(target)) {
return true;
}
@ -98,6 +98,28 @@ public abstract class Command {
return false;
}
/**
* Tests the given {@link CommandSender} to see if they can perform this command.
* <p />
* No error is sent to the sender.
*
* @param target User to test
* @return true if they can use it, otherwise false
*/
public boolean testPermissionSilent(CommandSender target) {
if ((permission == null) || (permission.length() == 0)) {
return true;
}
for (String p : permission.split(";")) {
if (target.hasPermission(p)) {
return true;
}
}
return false;
}
/**
* Returns the current lable for this command
*