SteamWar/SpigotCore
Archiviert
13
0

Add SWCommand.inject

Dieser Commit ist enthalten in:
yoyosource 2021-05-05 19:03:21 +02:00
Ursprung 2fb3f9a01b
Commit c07d4fbe55

Datei anzeigen

@ -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)