SteamWar/BauSystem2.0
Archiviert
12
0

Simplify LinkageType

Dieser Commit ist enthalten in:
yoyosource 2021-04-17 22:12:14 +02:00
Ursprung 3c4bc57e36
Commit 65891d52b4

Datei anzeigen

@ -33,6 +33,7 @@ import java.util.function.Predicate;
@RequiredArgsConstructor @RequiredArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Getter
public enum LinkageType { public enum LinkageType {
LISTENER(2, false, Listener.class::isAssignableFrom, o -> Bukkit.getPluginManager().registerEvents((Listener) o, BauSystem.getInstance())), LISTENER(2, false, Listener.class::isAssignableFrom, o -> Bukkit.getPluginManager().registerEvents((Listener) o, BauSystem.getInstance())),
UNLINK_LISTENER(2, true, Listener.class::isAssignableFrom, o -> HandlerList.unregisterAll((Listener) o)), UNLINK_LISTENER(2, true, Listener.class::isAssignableFrom, o -> HandlerList.unregisterAll((Listener) o)),
@ -41,16 +42,12 @@ public enum LinkageType {
UNLINK(0, true, Disable.class::isAssignableFrom, o -> ((Disable) o).disable()), UNLINK(0, true, Disable.class::isAssignableFrom, o -> ((Disable) o).disable()),
LINK(0, false, Enable.class::isAssignableFrom, o -> ((Enable) o).enable()); LINK(0, false, Enable.class::isAssignableFrom, o -> ((Enable) o).enable());
@Getter
private final int order; private final int order;
@Getter
private final boolean unlink; private final boolean unlink;
@Getter
private final Predicate<Class<?>> linkagePredicate; private final Predicate<Class<?>> linkagePredicate;
@SuppressWarnings("FieldMayBeFinal") @SuppressWarnings("FieldMayBeFinal")
@Getter
private Consumer<Object> linkageConsumer = o -> {}; private Consumer<Object> linkageConsumer = o -> {};
} }