Add SWCommand.inject
Dieser Commit ist enthalten in:
Ursprung
2fb3f9a01b
Commit
c07d4fbe55
@ -22,6 +22,8 @@ package de.steamwar.command;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
@ -60,7 +62,6 @@ public abstract class SWCommand {
|
|||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.flatMap(Collection::stream)
|
.flatMap(Collection::stream)
|
||||||
.filter(s -> !s.isEmpty())
|
.filter(s -> !s.isEmpty())
|
||||||
.filter(s -> !s.isBlank())
|
|
||||||
.filter(s -> s.toLowerCase().startsWith(string))
|
.filter(s -> s.toLowerCase().startsWith(string))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
@ -167,6 +168,16 @@ public abstract class SWCommand {
|
|||||||
SWCommandUtils.commandMap.register("steamwar", this.command);
|
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)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Target({ElementType.METHOD})
|
@Target({ElementType.METHOD})
|
||||||
@Repeatable(Register.Registeres.class)
|
@Repeatable(Register.Registeres.class)
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren