diff --git a/pom.xml b/pom.xml index b365780..185d7f0 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ ir.wy WyCore jar - 2.0.24 + 2.0.25 diff --git a/src/main/java/ir/wy/wycore/behind/WyPlugin.java b/src/main/java/ir/wy/wycore/behind/WyPlugin.java deleted file mode 100644 index 84b19e4..0000000 --- a/src/main/java/ir/wy/wycore/behind/WyPlugin.java +++ /dev/null @@ -1,18 +0,0 @@ -package ir.wy.wycore.behind; - -import ir.wy.wycore.behind.event.EventManager; -import ir.wy.wycore.behind.registrable.Registrable; -import org.bukkit.plugin.java.JavaPlugin; - -public abstract class WyPlugin extends JavaPlugin implements Registrable { - - private final EventManager eventManager; - - protected WyPlugin(EventManager eventManager) { - this.eventManager = eventManager; - } - - public EventManager getEventManager() { - return this.eventManager; - } -} diff --git a/src/main/java/ir/wy/wycore/behind/support/builtentity/BuiltEntityManager.java b/src/main/java/ir/wy/wycore/behind/support/builtentity/BuiltEntityManager.java index 98a1d15..a3a184a 100644 --- a/src/main/java/ir/wy/wycore/behind/support/builtentity/BuiltEntityManager.java +++ b/src/main/java/ir/wy/wycore/behind/support/builtentity/BuiltEntityManager.java @@ -1,21 +1,23 @@ package ir.wy.wycore.behind.support.builtentity; +import ir.wy.wycore.spigot.support.SupportRegistery; import org.jetbrains.annotations.NotNull; import java.util.HashSet; import java.util.Set; -public class BuiltEntityManager { +public final class BuiltEntityManager { + private static final SupportRegistery REGISTERY = new SupportRegistery<>(); + + + @Deprecated private static final Set REGISTERED = new HashSet<>(); public static void register(@NotNull final BuiltEntitySupport Support) { - REGISTERED.removeIf(it -> it.getPluginName().equalsIgnoreCase(Support.getPluginName())); - REGISTERED.add(Support); + REGISTERY.register(Support); } public static void registerAllEntities() { - for (BuiltEntitySupport integration : REGISTERED) { - integration.registerAllEntities(); - } + REGISTERY.forEachSafely(BuiltEntitySupport::registerAllEntities); } } diff --git a/src/main/java/ir/wy/wycore/behind/support/hologram/HologramManager.java b/src/main/java/ir/wy/wycore/behind/support/hologram/HologramManager.java index 648a7c8..4a9a010 100644 --- a/src/main/java/ir/wy/wycore/behind/support/hologram/HologramManager.java +++ b/src/main/java/ir/wy/wycore/behind/support/hologram/HologramManager.java @@ -1,5 +1,6 @@ package ir.wy.wycore.behind.support.hologram; +import ir.wy.wycore.spigot.support.SupportRegistery; import org.bukkit.Location; import org.jetbrains.annotations.NotNull; @@ -9,21 +10,15 @@ public final class HologramManager { + private static final SupportRegistery REGISTERY = new SupportRegistery<>(); + + @Deprecated private static final Set REGISTERED = new HashSet<>(); - private static void register(@NotNull final HologramSupport support) { - REGISTERED.removeIf(it -> it.getPluginName().equalsIgnoreCase(support.getPluginName())); - REGISTERED.add(support); + private static void register(@NotNull final HologramSupport Support) { + REGISTERY.register(Support); } - // - // private static Hologram createHologram(@NotNull final Location location, @NotNull final List contents) { - // for (HologramSupport support : REGISTERED) { - // return support.createHologram(location, contents); - // } - // return new EmptyHologram(); - // } - private HologramManager() { throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); }