mirror of
https://github.com/SimplexDevelopment/SimplexCore.git
synced 2024-12-22 16:47:37 +00:00
some stuff
This commit is contained in:
parent
6bd2e82041
commit
6117c21231
20
pom.xml
20
pom.xml
@ -54,6 +54,10 @@
|
|||||||
</build>
|
</build>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>jitpack</id>
|
||||||
|
<url>https://jitpack.io</url>
|
||||||
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>papermc-repo</id>
|
<id>papermc-repo</id>
|
||||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||||
@ -62,6 +66,10 @@
|
|||||||
<id>sonatype</id>
|
<id>sonatype</id>
|
||||||
<url>https://oss.sonatype.org/content/groups/public/</url>
|
<url>https://oss.sonatype.org/content/groups/public/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>placeholderapi</id>
|
||||||
|
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -83,5 +91,17 @@
|
|||||||
<version>0.9.12</version>
|
<version>0.9.12</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</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>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@ -2,16 +2,44 @@ package io.github.paldiu.simplexcore.listener;
|
|||||||
|
|
||||||
import io.github.paldiu.simplexcore.plugin.SimplexAddon;
|
import io.github.paldiu.simplexcore.plugin.SimplexAddon;
|
||||||
import io.github.paldiu.simplexcore.utils.Constants;
|
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.EventHandler;
|
||||||
import org.bukkit.event.server.PluginEnableEvent;
|
import org.bukkit.event.server.PluginEnableEvent;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public final class ServerPluginListener extends SimplexListener {
|
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
|
@EventHandler
|
||||||
public void pluginRegister(PluginEnableEvent event) {
|
public void pluginRegister(PluginEnableEvent event) {
|
||||||
if (SimplexAddon.class.isAssignableFrom(event.getPlugin().getClass())) {
|
Validate temp = () -> {
|
||||||
if (!Constants.getRegistry().getComponents().contains(event.getPlugin())) {
|
if (PLIB_NAMES.contains(event.getPlugin().getName())) {
|
||||||
Constants.getRegistry().getComponents().add((SimplexAddon<?>) event.getPlugin());
|
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) {
|
public static <K, V> void mapFE(Map<K, V> map, BiConsumer<K, V> actions) {
|
||||||
map.forEach(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();
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user