diff --git a/SpigotCore_Main/src/de/steamwar/command/SWCommand.java b/SpigotCore_Main/src/de/steamwar/command/SWCommand.java index 3b6245d..6c94f7a 100644 --- a/SpigotCore_Main/src/de/steamwar/command/SWCommand.java +++ b/SpigotCore_Main/src/de/steamwar/command/SWCommand.java @@ -22,6 +22,8 @@ package de.steamwar.command; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; +import org.bukkit.plugin.Plugin; +import org.bukkit.scheduler.BukkitRunnable; import java.lang.annotation.*; import java.lang.reflect.Method; @@ -60,7 +62,6 @@ public abstract class SWCommand { .filter(Objects::nonNull) .flatMap(Collection::stream) .filter(s -> !s.isEmpty()) - .filter(s -> !s.isBlank()) .filter(s -> s.toLowerCase().startsWith(string)) .collect(Collectors.toList()); } @@ -167,6 +168,16 @@ public abstract class SWCommand { SWCommandUtils.commandMap.register("steamwar", this.command); } + public void inject(Plugin plugin) { + new BukkitRunnable() { + @Override + public void run() { + SWCommand.this.unregister(); + SWCommand.this.register(); + } + }.runTask(plugin); + } + @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD}) @Repeatable(Register.Registeres.class)