mirror of
https://github.com/aikar/commands.git
synced 2026-06-25 16:10:38 +00:00
rename testPermission to hasPermission
This commit is contained in:
@@ -308,7 +308,7 @@ public abstract class BaseCommand {
|
||||
}
|
||||
|
||||
public void execute(CommandIssuer sender, String commandLabel, String[] args) {
|
||||
if (!this.testPermission(sender)) {
|
||||
if (!this.hasPermission(sender)) {
|
||||
sender.sendMessage(permissionMessage);
|
||||
return;
|
||||
}
|
||||
@@ -428,7 +428,7 @@ public abstract class BaseCommand {
|
||||
}
|
||||
|
||||
private List<String> completeCommand(CommandIssuer sender, RegisteredCommand cmd, String[] args, String commandLabel) {
|
||||
if (!this.testPermission(sender) || !cmd.hasPermission(sender) || args.length > cmd.requiredResolvers + cmd.optionalResolvers || args.length == 0
|
||||
if (!this.hasPermission(sender) || !cmd.hasPermission(sender) || args.length > cmd.requiredResolvers + cmd.optionalResolvers || args.length == 0
|
||||
|| cmd.complete == null) {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
@@ -494,11 +494,11 @@ public abstract class BaseCommand {
|
||||
sender.sendMessage("&cUsage: /" + cmd.command + " " + cmd.syntaxText);
|
||||
}
|
||||
|
||||
public boolean testPermission(Object sender) {
|
||||
return testPermission(manager.getCommandIssuer(sender));
|
||||
public boolean hasPermission(Object sender) {
|
||||
return hasPermission(manager.getCommandIssuer(sender));
|
||||
}
|
||||
|
||||
public boolean testPermission(CommandIssuer sender) {
|
||||
public boolean hasPermission(CommandIssuer sender) {
|
||||
return permission == null || permission.isEmpty() || sender.hasPermission(permission);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ public class ForwardingCommand extends BaseCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean testPermission(CommandIssuer sender) {
|
||||
return command.testPermission(sender);
|
||||
public boolean hasPermission(CommandIssuer sender) {
|
||||
return command.hasPermission(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,7 +26,6 @@ package co.aikar.commands;
|
||||
import co.aikar.commands.apachecommonslang.ApacheCommonsLangUtil;
|
||||
import org.spongepowered.api.command.CommandCallable;
|
||||
import org.spongepowered.api.command.CommandException;
|
||||
import org.spongepowered.api.command.CommandMapping;
|
||||
import org.spongepowered.api.command.CommandResult;
|
||||
import org.spongepowered.api.command.CommandSource;
|
||||
import org.spongepowered.api.text.Text;
|
||||
@@ -72,7 +71,7 @@ public class SpongeRootCommand implements CommandCallable, RootCommand {
|
||||
|
||||
@Override
|
||||
public boolean testPermission(CommandSource source) {
|
||||
return this.defCommand.testPermission(source);
|
||||
return this.defCommand.hasPermission(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user