SteamWar/BungeeCore
Archiviert
13
2

Merge pull request 'Fix some stuff for later use' (#371) from CommandAPI into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Reviewed-on: #371
Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Lixfel 2022-06-14 19:32:34 +02:00
Commit 46ae99f10d

Datei anzeigen

@ -39,21 +39,28 @@ public class SWCommand extends AbstractSWCommand<CommandSender> {
TypeUtils.init(); TypeUtils.init();
} }
private String permission;
private Command command; private Command command;
private List<String> defaultHelpMessages = new ArrayList<>(); private List<String> defaultHelpMessages = new ArrayList<>();
protected SWCommand(String command) { protected SWCommand(String command) {
super(CommandSender.class, command); this(command, null);
} }
protected SWCommand(String command, String... aliases) { protected SWCommand(String command, String permission) {
super(CommandSender.class, command);
this.permission = permission;
}
protected SWCommand(String command, String permission, String... aliases) {
super(CommandSender.class, command, aliases); super(CommandSender.class, command, aliases);
this.permission = permission;
} }
@Override @Override
protected void createAndSafeCommand(String command, String[] aliases) { protected void createAndSafeCommand(String command, String[] aliases) {
this.command = new TabCompletableCommand(command, aliases) { this.command = new TabCompletableCommand(command, permission, aliases) {
@Override @Override
public void execute(CommandSender commandSender, String[] strings) { public void execute(CommandSender commandSender, String[] strings) {
SWCommand.this.execute(commandSender, null, strings); SWCommand.this.execute(commandSender, null, strings);
@ -67,8 +74,8 @@ public class SWCommand extends AbstractSWCommand<CommandSender> {
} }
private abstract static class TabCompletableCommand extends Command implements TabExecutor { private abstract static class TabCompletableCommand extends Command implements TabExecutor {
public TabCompletableCommand(String name, String... aliases) { public TabCompletableCommand(String name, String permission, String... aliases) {
super(name, null, aliases); super(name, permission, aliases);
} }
} }