some stuff

This commit is contained in:
Paldiu 2021-02-06 08:37:31 -06:00
parent 6bd2e82041
commit 6117c21231
6 changed files with 74 additions and 3 deletions

20
pom.xml
View File

@ -54,6 +54,10 @@
</build>
<repositories>
<repository>
<id>jitpack</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>papermc-repo</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
@ -62,6 +66,10 @@
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>placeholderapi</id>
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
</repositories>
<dependencies>
@ -83,5 +91,17 @@
<version>0.9.12</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.dmulloy2</groupId>
<artifactId>ProtocolLib</artifactId>
<version>4.5.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.10.9</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -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<String> PAPI_NAMES = new ArrayList<>(){{
add("PlaceholderAPI");
add("PlaceHolderAPI");
add("placeholderapi");
add("PLACEHOLDERAPI");
add("PAPI");
add("papi");
}};
public List<String> 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()) {
}
}
}

View File

@ -0,0 +1,7 @@
package io.github.paldiu.simplexcore.plugin;
public class DependencyManagement {
public DependencyManagement() {
}
}

View File

@ -0,0 +1,6 @@
package io.github.paldiu.simplexcore.utils;
@FunctionalInterface
public interface Complete<Void> {
void toComplete(Void complete);
}

View File

@ -32,4 +32,8 @@ public final class Utilities {
public static <K, V> void mapFE(Map<K, V> map, BiConsumer<K, V> actions) {
map.forEach(actions);
}
public static boolean isValid(Validate validate) {
return validate.isValid();
}
}

View File

@ -0,0 +1,6 @@
package io.github.paldiu.simplexcore.utils;
@FunctionalInterface
public interface Validate {
boolean isValid();
}