mirror of
https://github.com/aikar/commands.git
synced 2026-06-12 19:10:37 +00:00
move hasPermission to manager
This commit is contained in:
@@ -499,7 +499,7 @@ public abstract class BaseCommand {
|
||||
}
|
||||
|
||||
public boolean hasPermission(CommandIssuer sender) {
|
||||
return permission == null || permission.isEmpty() || sender.hasPermission(permission);
|
||||
return manager.hasPermission(sender, permission);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
||||
@@ -69,6 +69,11 @@ abstract class CommandManager {
|
||||
public abstract void registerCommand(BaseCommand command);
|
||||
public abstract boolean hasRegisteredCommands();
|
||||
public abstract boolean isCommandIssuer(Class<?> type);
|
||||
|
||||
public boolean hasPermission(CommandIssuer issuer, String permission) {
|
||||
return permission == null || permission.isEmpty() || issuer.hasPermission(permission);
|
||||
}
|
||||
|
||||
public abstract CommandIssuer getCommandIssuer(Object issuer);
|
||||
|
||||
public abstract RootCommand createRootCommand(String cmd);
|
||||
@@ -84,7 +89,7 @@ abstract class CommandManager {
|
||||
public RegisteredCommand createRegisteredCommand(BaseCommand command, String cmdName, Method method, String prefSubCommand) {
|
||||
return new RegisteredCommand(command, cmdName, method, prefSubCommand);
|
||||
}
|
||||
|
||||
public abstract void log(final LogLevel level, final String message);
|
||||
|
||||
public abstract void log(final LogLevel level, final String message, final Throwable throwable);
|
||||
}
|
||||
|
||||
@@ -218,8 +218,8 @@ public class RegisteredCommand <R extends CommandExecutionContext<? extends Comm
|
||||
return passedArgs;
|
||||
}
|
||||
|
||||
boolean hasPermission(CommandIssuer check) {
|
||||
return permission == null || !check.isPlayer() || check.hasPermission(permission);
|
||||
boolean hasPermission(CommandIssuer issuer) {
|
||||
return scope.manager.hasPermission(issuer, permission);
|
||||
}
|
||||
|
||||
public String getPermission() {
|
||||
|
||||
Reference in New Issue
Block a user