From dd6b9b6ee64f9cfb1ebdf1d4f05e91af5741455a Mon Sep 17 00:00:00 2001 From: Govindass Date: Thu, 29 Oct 2020 09:47:18 +0200 Subject: [PATCH] use HIGHEST priority on disable, so "on script unload" can still work --- pom.xml | 30 ++----------------- .../java/net/limework/core/RediSkript.java | 4 +++ 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/pom.xml b/pom.xml index 9207a27..54b9dbb 100644 --- a/pom.xml +++ b/pom.xml @@ -27,37 +27,13 @@ UTF-8 - - org.apache.maven.plugins - maven-shade-plugin - 3.2.3 - - false - - - - package - - shade - - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.2.0 - - ${project.basedir}/compile - - spigot-repo - https://hub.spigotmc.org/nexus/content/repositories/snapshots/ + https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/ jitpack.io @@ -72,9 +48,9 @@ - com.github.skriptlang + com.github.SkriptLang Skript - 2.4.1 + 2.5.1 provided diff --git a/src/main/java/net/limework/core/RediSkript.java b/src/main/java/net/limework/core/RediSkript.java index 7c04f51..e9dd044 100644 --- a/src/main/java/net/limework/core/RediSkript.java +++ b/src/main/java/net/limework/core/RediSkript.java @@ -3,6 +3,8 @@ import net.limework.core.commands.ReloadRedis; import net.limework.core.hooks.SkriptHook; import net.limework.core.managers.RedisManager; import org.bukkit.command.PluginCommand; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.plugin.java.JavaPlugin; public class RediSkript extends JavaPlugin { @@ -32,6 +34,8 @@ public class RediSkript extends JavaPlugin { } @Override + //using HIGHEST event priority so it shuts down last and code can still execute well in "on script unload" and "on skript unload" events + @EventHandler(priority = EventPriority.HIGHEST) public void onDisable() { if (rm != null) { rm.shutdown();