use HIGHEST priority on disable, so "on script unload" can still work

This commit is contained in:
Govindas 2020-10-29 09:47:18 +02:00
parent 93e4754b9f
commit 114e4ed7cb
2 changed files with 7 additions and 27 deletions

30
pom.xml
View File

@ -27,37 +27,13 @@
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.3</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<outputDirectory>${project.basedir}/compile</outputDirectory>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
<repositories> <repositories>
<repository> <repository>
<id>spigot-repo</id> <id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/</url>
</repository> </repository>
<repository> <repository>
<id>jitpack.io</id> <id>jitpack.io</id>
@ -72,9 +48,9 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.github.skriptlang</groupId> <groupId>com.github.SkriptLang</groupId>
<artifactId>Skript</artifactId> <artifactId>Skript</artifactId>
<version>2.4.1</version> <version>2.5.1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -3,6 +3,8 @@ import net.limework.core.commands.ReloadRedis;
import net.limework.core.hooks.SkriptHook; import net.limework.core.hooks.SkriptHook;
import net.limework.core.managers.RedisManager; import net.limework.core.managers.RedisManager;
import org.bukkit.command.PluginCommand; import org.bukkit.command.PluginCommand;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
public class RediSkript extends JavaPlugin { public class RediSkript extends JavaPlugin {
@ -32,6 +34,8 @@ public class RediSkript extends JavaPlugin {
} }
@Override @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() { public void onDisable() {
if (rm != null) { if (rm != null) {
rm.shutdown(); rm.shutdown();