From 6117c212313ee83015803ded05baf1decc9d480e Mon Sep 17 00:00:00 2001 From: Paldiu Date: Sat, 6 Feb 2021 08:37:31 -0600 Subject: [PATCH] some stuff --- pom.xml | 20 +++++++++++ .../listener/ServerPluginListener.java | 34 +++++++++++++++++-- .../plugin/DependencyManagement.java | 7 ++++ .../paldiu/simplexcore/utils/Complete.java | 6 ++++ .../paldiu/simplexcore/utils/Utilities.java | 4 +++ .../paldiu/simplexcore/utils/Validate.java | 6 ++++ 6 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 src/main/java/io/github/paldiu/simplexcore/plugin/DependencyManagement.java create mode 100644 src/main/java/io/github/paldiu/simplexcore/utils/Complete.java create mode 100644 src/main/java/io/github/paldiu/simplexcore/utils/Validate.java diff --git a/pom.xml b/pom.xml index 5ee7f7f..0fecaf0 100644 --- a/pom.xml +++ b/pom.xml @@ -54,6 +54,10 @@ + + jitpack + https://jitpack.io + papermc-repo https://papermc.io/repo/repository/maven-public/ @@ -62,6 +66,10 @@ sonatype https://oss.sonatype.org/content/groups/public/ + + placeholderapi + https://repo.extendedclip.com/content/repositories/placeholderapi/ + @@ -83,5 +91,17 @@ 0.9.12 compile + + com.github.dmulloy2 + ProtocolLib + 4.5.1 + provided + + + me.clip + placeholderapi + 2.10.9 + provided + diff --git a/src/main/java/io/github/paldiu/simplexcore/listener/ServerPluginListener.java b/src/main/java/io/github/paldiu/simplexcore/listener/ServerPluginListener.java index b1291e2..5e1de13 100644 --- a/src/main/java/io/github/paldiu/simplexcore/listener/ServerPluginListener.java +++ b/src/main/java/io/github/paldiu/simplexcore/listener/ServerPluginListener.java @@ -2,16 +2,44 @@ package io.github.paldiu.simplexcore.listener; import io.github.paldiu.simplexcore.plugin.SimplexAddon; import io.github.paldiu.simplexcore.utils.Constants; +import io.github.paldiu.simplexcore.utils.Utilities; +import io.github.paldiu.simplexcore.utils.Validate; import org.bukkit.event.EventHandler; import org.bukkit.event.server.PluginEnableEvent; +import java.util.ArrayList; +import java.util.List; + public final class ServerPluginListener extends SimplexListener { + public List PAPI_NAMES = new ArrayList<>(){{ + add("PlaceholderAPI"); + add("PlaceHolderAPI"); + add("placeholderapi"); + add("PLACEHOLDERAPI"); + add("PAPI"); + add("papi"); + }}; + + public List PLIB_NAMES = new ArrayList<>(){{ + add("ProtocolLib"); + add("PLib"); + add("Protocollib"); + add("plib"); + }}; + @EventHandler public void pluginRegister(PluginEnableEvent event) { - if (SimplexAddon.class.isAssignableFrom(event.getPlugin().getClass())) { - if (!Constants.getRegistry().getComponents().contains(event.getPlugin())) { - Constants.getRegistry().getComponents().add((SimplexAddon) event.getPlugin()); + Validate temp = () -> { + if (PLIB_NAMES.contains(event.getPlugin().getName())) { + return true; } + + return PAPI_NAMES.contains(event.getPlugin().getName()); + }; + + if (temp.isValid()) { + } + } } diff --git a/src/main/java/io/github/paldiu/simplexcore/plugin/DependencyManagement.java b/src/main/java/io/github/paldiu/simplexcore/plugin/DependencyManagement.java new file mode 100644 index 0000000..f19785c --- /dev/null +++ b/src/main/java/io/github/paldiu/simplexcore/plugin/DependencyManagement.java @@ -0,0 +1,7 @@ +package io.github.paldiu.simplexcore.plugin; + +public class DependencyManagement { + public DependencyManagement() { + + } +} diff --git a/src/main/java/io/github/paldiu/simplexcore/utils/Complete.java b/src/main/java/io/github/paldiu/simplexcore/utils/Complete.java new file mode 100644 index 0000000..bada3ad --- /dev/null +++ b/src/main/java/io/github/paldiu/simplexcore/utils/Complete.java @@ -0,0 +1,6 @@ +package io.github.paldiu.simplexcore.utils; + +@FunctionalInterface +public interface Complete { + void toComplete(Void complete); +} diff --git a/src/main/java/io/github/paldiu/simplexcore/utils/Utilities.java b/src/main/java/io/github/paldiu/simplexcore/utils/Utilities.java index fc2841b..c1cea58 100644 --- a/src/main/java/io/github/paldiu/simplexcore/utils/Utilities.java +++ b/src/main/java/io/github/paldiu/simplexcore/utils/Utilities.java @@ -32,4 +32,8 @@ public final class Utilities { public static void mapFE(Map map, BiConsumer actions) { map.forEach(actions); } + + public static boolean isValid(Validate validate) { + return validate.isValid(); + } } diff --git a/src/main/java/io/github/paldiu/simplexcore/utils/Validate.java b/src/main/java/io/github/paldiu/simplexcore/utils/Validate.java new file mode 100644 index 0000000..1396148 --- /dev/null +++ b/src/main/java/io/github/paldiu/simplexcore/utils/Validate.java @@ -0,0 +1,6 @@ +package io.github.paldiu.simplexcore.utils; + +@FunctionalInterface +public interface Validate { + boolean isValid(); +}