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

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();
}