mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2026-11-29 09:14:04 +00:00
start up fix
This commit is contained in:
1 parent
36289b31af
commit
606510754e
8 files changed
+445
-40
No files matched your search
+11
-3
@@ -35,9 +35,17 @@ public class AddonsHandler {
|
||||
}
|
||||
|
||||
public void unload() {
|
||||
for (Addons addon : addons)
|
||||
addon.disable();
|
||||
addons.clear();
|
||||
try {
|
||||
for (Addons addon : addons)
|
||||
addon.disable();
|
||||
} finally {
|
||||
addons.clear();
|
||||
// Core retains these command objects after this plugin's classloader closes.
|
||||
BetterRTP core = BetterRTP.getInstance();
|
||||
if (core != null && core.getCmd() != null)
|
||||
core.getCmd().commands.removeIf(command ->
|
||||
command.getClass().getClassLoader() == getClass().getClassLoader());
|
||||
}
|
||||
}
|
||||
|
||||
public enum Addons {
|
||||
|
||||
@@ -41,8 +41,11 @@ public class Main extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
if (editorBridge != null) editorBridge.close();
|
||||
addonsHandler.unload();
|
||||
try {
|
||||
if (editorBridge != null) editorBridge.close();
|
||||
} finally {
|
||||
addonsHandler.unload();
|
||||
}
|
||||
}
|
||||
|
||||
public void load() {
|
||||
|
||||
Reference in new issue
Block a user