From 22ef3cd13d4d9b029f2770fce82034d507ae7158 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 14 Jun 2022 18:16:44 +0200 Subject: [PATCH 1/2] Fix some stuff for later use --- src/de/steamwar/command/SWCommand.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/de/steamwar/command/SWCommand.java b/src/de/steamwar/command/SWCommand.java index 026c74c..8e8e9ab 100644 --- a/src/de/steamwar/command/SWCommand.java +++ b/src/de/steamwar/command/SWCommand.java @@ -39,21 +39,24 @@ public class SWCommand extends AbstractSWCommand { TypeUtils.init(); } + private String permission; private Command command; private List defaultHelpMessages = new ArrayList<>(); - protected SWCommand(String command) { + protected SWCommand(String command, String permission) { super(CommandSender.class, command); + this.permission = permission; } - protected SWCommand(String command, String... aliases) { + protected SWCommand(String command, String permission, String... aliases) { super(CommandSender.class, command, aliases); + this.permission = permission; } @Override protected void createAndSafeCommand(String command, String[] aliases) { - this.command = new TabCompletableCommand(command, aliases) { + this.command = new TabCompletableCommand(command, permission, aliases) { @Override public void execute(CommandSender commandSender, String[] strings) { SWCommand.this.execute(commandSender, null, strings); @@ -67,8 +70,8 @@ public class SWCommand extends AbstractSWCommand { } private abstract static class TabCompletableCommand extends Command implements TabExecutor { - public TabCompletableCommand(String name, String... aliases) { - super(name, null, aliases); + public TabCompletableCommand(String name, String permission, String... aliases) { + super(name, permission, aliases); } } From 8a417e32c113a753a36e93a1a66d51749207701b Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 14 Jun 2022 18:19:25 +0200 Subject: [PATCH 2/2] Fix some stuff for later use --- src/de/steamwar/command/SWCommand.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/de/steamwar/command/SWCommand.java b/src/de/steamwar/command/SWCommand.java index 8e8e9ab..242ef4d 100644 --- a/src/de/steamwar/command/SWCommand.java +++ b/src/de/steamwar/command/SWCommand.java @@ -44,6 +44,10 @@ public class SWCommand extends AbstractSWCommand { private List defaultHelpMessages = new ArrayList<>(); + protected SWCommand(String command) { + this(command, null); + } + protected SWCommand(String command, String permission) { super(CommandSender.class, command); this.permission = permission;