diff --git a/bukkit/pom.xml b/bukkit/pom.xml
index e1d72ef..b27a3b5 100644
--- a/bukkit/pom.xml
+++ b/bukkit/pom.xml
@@ -30,14 +30,6 @@
${project.version}
compile
-
- org.xerial
- sqlite-jdbc
-
-
- com.mysql
- mysql-connector-j
-
com.googlecode.json-simple
json-simple
@@ -59,7 +51,7 @@
com.mojang
authlib
- 6.0.54
+ 6.0.58
provided
diff --git a/bukkit/src/main/java/org/zhdev/BukkitPreparedPlugin.java b/bukkit/src/main/java/org/zhdev/BukkitPreparedPlugin.java
index daf8da1..109fd6f 100644
--- a/bukkit/src/main/java/org/zhdev/BukkitPreparedPlugin.java
+++ b/bukkit/src/main/java/org/zhdev/BukkitPreparedPlugin.java
@@ -25,9 +25,6 @@ import java.io.File;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.logging.Level;
public abstract class BukkitPreparedPlugin extends BukkitPlugin implements Listener, PreparedPlugin {
protected final Path dataDirectory;
@@ -35,8 +32,6 @@ public abstract class BukkitPreparedPlugin extends BukkitPlugin implements Liste
protected final Language language = new Language();
protected final SqlAdapter sqlAdapter = createSqlAdapter();
- private ExecutorService singleThreadExecutor;
-
public BukkitPreparedPlugin() {
super();
dataDirectory = getDataFolder().toPath();
@@ -178,10 +173,6 @@ public abstract class BukkitPreparedPlugin extends BukkitPlugin implements Liste
closeSqlAdapter();
defaultConfig.clear();
- if (singleThreadExecutor != null) {
- singleThreadExecutor.shutdownNow();
- }
-
BukkitUtils.unregisterCommandIf(command -> command instanceof PluginIdentifiableCommand && ((PluginIdentifiableCommand) command).getPlugin() == this);
}
@@ -195,18 +186,4 @@ public abstract class BukkitPreparedPlugin extends BukkitPlugin implements Liste
disable();
}
}
-
- public void runTaskSeparately(Runnable runnable) {
- if (singleThreadExecutor == null) {
- singleThreadExecutor = Executors.newSingleThreadExecutor();
- }
-
- singleThreadExecutor.execute(() -> {
- try {
- runnable.run();
- } catch (Throwable throwable) {
- getLogger().log(Level.SEVERE, "Unhandled exception while running separated task", throwable);
- }
- });
- }
}
diff --git a/bukkit/src/main/java/org/zhdev/util/BukkitReflectionUtils.java b/bukkit/src/main/java/org/zhdev/util/BukkitReflectionUtils.java
index ccd093b..b50cb74 100644
--- a/bukkit/src/main/java/org/zhdev/util/BukkitReflectionUtils.java
+++ b/bukkit/src/main/java/org/zhdev/util/BukkitReflectionUtils.java
@@ -54,7 +54,12 @@ class BukkitReflectionUtils {
private static class ModernGameProfileConsumer implements GameProfileConsumer {
private final Class> __ResolvableProfile_CLASS = ReflectionUtils.getType("net.minecraft.world.item.component.ResolvableProfile");
private final Constructor> __ResolvableProfile_CONSTRUCTOR;
- protected final Method __setProfile__CraftMetaSkull__METHOD = ReflectionUtils.getMethod(__ResolvableProfile_CLASS, "setProfile", __ResolvableProfile_CLASS);
+ protected final Method __setProfile__CraftMetaSkull__METHOD = ReflectionUtils.methodSearcher()
+ .type(__CraftMetaSkull__CLASS)
+ .methodOf("setProfile")
+ .parameters(__ResolvableProfile_CLASS)
+ .returns(void.class)
+ .search();
ModernGameProfileConsumer() {
Constructor> resolvableConstructor;
diff --git a/common/src/main/java/org/zhdev/util/ReflectionUtils.java b/common/src/main/java/org/zhdev/util/ReflectionUtils.java
index dd71599..900761e 100644
--- a/common/src/main/java/org/zhdev/util/ReflectionUtils.java
+++ b/common/src/main/java/org/zhdev/util/ReflectionUtils.java
@@ -5,7 +5,9 @@ import org.zhdev.reflection.MethodSearcher;
import java.io.File;
import java.io.IOException;
+import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Enumeration;
import java.util.function.Consumer;
@@ -25,6 +27,12 @@ public class ReflectionUtils {
return field;
}
+ private static Constructor> getConstructor0(Class> type, Class>... parameterTypes) throws NoSuchMethodException {
+ Constructor> constructor = type.getDeclaredConstructor(parameterTypes);
+ constructor.setAccessible(true);
+ return constructor;
+ }
+
private static boolean compareParameters(Class>[] required, Class>... parameters) {
if (required.length != parameters.length) {
return false;
@@ -174,6 +182,22 @@ public class ReflectionUtils {
}
}
+ public static Constructor> getConstructor(Class> type, Class>... parameterTypes) throws NoSuchMethodError {
+ try {
+ return getConstructor0(type, parameterTypes);
+ } catch (NoSuchMethodException e) {
+ throw new NoSuchMethodError(e.getMessage());
+ }
+ }
+
+ public static Object newInstance(Constructor> constructor, Object... args) throws NoSuchMethodError {
+ try {
+ return constructor.newInstance(args);
+ } catch (ReflectiveOperationException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
public static void forEachClass(ClassLoader loader, JarFile jarFile, String packageName, Consumer> consumer) {
for (Enumeration entry = jarFile.entries(); entry.hasMoreElements(); ) {
JarEntry jarEntry = entry.nextElement();
diff --git a/db/pom.xml b/db/pom.xml
index 1b61707..d594c22 100644
--- a/db/pom.xml
+++ b/db/pom.xml
@@ -23,19 +23,19 @@
org.xerial
sqlite-jdbc
3.42.0.0
- compile
+ provided
com.h2database
h2
2.2.220
- compile
+ provided
com.mysql
mysql-connector-j
- 8.2.0
- compile
+ 9.2.0
+ provided
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 2c4bb9d..73089a6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -52,32 +52,6 @@
8
-
- org.apache.maven.plugins
- maven-shade-plugin
- 3.5.3
-
-
-
- *:*
-
- META-INF/**
-
-
-
- true
- false
- true
-
-
-
- package
-
- shade
-
-
-
-
org.apache.maven.plugins
maven-jar-plugin
diff --git a/velocity/pom.xml b/velocity/pom.xml
index 32aa20e..e246a2d 100644
--- a/velocity/pom.xml
+++ b/velocity/pom.xml
@@ -29,7 +29,7 @@
com.velocitypowered
velocity-api
- 3.1.2-SNAPSHOT
+ 3.4.0-SNAPSHOT
provided