SteamWar/BungeeCore
Archiviert
13
2

Hotfix SWCommand
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2022-06-16 22:18:44 +02:00
Ursprung c97233b68b
Commit 059a945867

Datei anzeigen

@ -54,15 +54,22 @@ public class SWCommand extends AbstractSWCommand<CommandSender> {
protected SWCommand(String command, String permission) { protected SWCommand(String command, String permission) {
super(CommandSender.class, command); super(CommandSender.class, command);
this.permission = permission; this.permission = permission;
createAndSafeCommand(command, new String[0]);
unregister();
register();
} }
protected SWCommand(String command, String permission, String... aliases) { protected SWCommand(String command, String permission, String... aliases) {
super(CommandSender.class, command, aliases); super(CommandSender.class, command, aliases);
this.permission = permission; this.permission = permission;
createAndSafeCommand(command, aliases);
unregister();
register();
} }
@Override @Override
protected void createAndSafeCommand(String command, String[] aliases) { protected void createAndSafeCommand(String command, String[] aliases) {
if (permission == null) return;
this.command = new TabCompletableCommand(command, permission, aliases) { this.command = new TabCompletableCommand(command, permission, aliases) {
@Override @Override
public void execute(CommandSender commandSender, String[] strings) { public void execute(CommandSender commandSender, String[] strings) {
@ -84,11 +91,13 @@ public class SWCommand extends AbstractSWCommand<CommandSender> {
@Override @Override
public void unregister() { public void unregister() {
if (command == null) return;
CommandRegistering.unregister(this.command); CommandRegistering.unregister(this.command);
} }
@Override @Override
public void register() { public void register() {
if (command == null) return;
CommandRegistering.register(this.command); CommandRegistering.register(this.command);
} }