mirror of
https://github.com/SimplexDevelopment/SimplexCore.git
synced 2025-07-01 22:56:43 +00:00
some stuff
This commit is contained in:
@ -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()) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
package io.github.paldiu.simplexcore.plugin;
|
||||
|
||||
public class DependencyManagement {
|
||||
public DependencyManagement() {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
package io.github.paldiu.simplexcore.utils;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface Complete<Void> {
|
||||
void toComplete(Void complete);
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,6 @@
|
||||
package io.github.paldiu.simplexcore.utils;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface Validate {
|
||||
boolean isValid();
|
||||
}
|
Reference in New Issue
Block a user