make shutdowns safer
This commit is contained in:
parent
2a1f44b1bb
commit
683e48a974
1 changed files with 6 additions and 1 deletions
|
@ -202,7 +202,12 @@ public class ZNpcsPlus {
|
||||||
|
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
NpcApiProvider.unregister();
|
NpcApiProvider.unregister();
|
||||||
for (Runnable runnable : shutdownTasks) runnable.run();
|
for (Runnable runnable : shutdownTasks) try {
|
||||||
|
runnable.run();
|
||||||
|
} catch (Throwable throwable) {
|
||||||
|
bootstrap.getLogger().severe("One of the registered shutdown tasks threw an exception:");
|
||||||
|
throwable.printStackTrace();
|
||||||
|
}
|
||||||
shutdownTasks.clear();
|
shutdownTasks.clear();
|
||||||
PacketEvents.getAPI().terminate();
|
PacketEvents.getAPI().terminate();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue