mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-22 11:54:39 +01:00
Admin cmds, perms and descriptions for all cmds +
Additonal stuff: Fixed + refactored help command. Removed 'Usage: ' from all commands. Created 'player.hasPermission(permission)' function. Created default for Usage annotation. Created hashmap version of 'getHandlers' and renamed the original to getHandlersAsList()
This commit is contained in:
@@ -68,10 +68,12 @@ public final class CommandMap {
|
||||
* Returns a list of all registered commands.
|
||||
* @return All command handlers as a list.
|
||||
*/
|
||||
public List<CommandHandler> getHandlers() {
|
||||
public List<CommandHandler> getHandlersAsList() {
|
||||
return new LinkedList<>(this.commands.values());
|
||||
}
|
||||
|
||||
public HashMap<String, CommandHandler> getHandlers() { return new LinkedHashMap<>(this.commands); }
|
||||
|
||||
/**
|
||||
* Returns a handler by label/alias.
|
||||
* @param label The command label.
|
||||
@@ -111,8 +113,7 @@ public final class CommandMap {
|
||||
if(player != null) {
|
||||
String permissionNode = this.annotations.get(label).permission();
|
||||
Account account = player.getAccount();
|
||||
List<String> permissions = account.getPermissions();
|
||||
if(!permissions.contains("*") && !permissions.contains(permissionNode)) {
|
||||
if(permissionNode != "" && !account.hasPermission(permissionNode)) {
|
||||
CommandHandler.sendMessage(player, "You do not have permission to run this command."); return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user