From df94f698c370a9ddaf1e75ff0376474b4feb9274 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Wed, 2 Aug 2017 19:14:50 -0700 Subject: [PATCH] Clear caches on unload and call onUnload before plugins are removed. --- src/main/java/org/nwapw/abacus/plugin/PluginManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/nwapw/abacus/plugin/PluginManager.java b/src/main/java/org/nwapw/abacus/plugin/PluginManager.java index 8450bf7..ab116dc 100644 --- a/src/main/java/org/nwapw/abacus/plugin/PluginManager.java +++ b/src/main/java/org/nwapw/abacus/plugin/PluginManager.java @@ -185,15 +185,18 @@ public class PluginManager { * Unloads all the plugins in the PluginManager. */ public void unload() { + listeners.forEach(e -> e.onUnload(this)); Set disabledPlugins = abacus.getConfiguration().getDisabledPlugins(); for (Plugin plugin : plugins) { if(disabledPlugins.contains(plugin.getClass().getName())) continue; plugin.disable(); } + cachedFunctions.clear(); + cachedOperators.clear(); + cachedNumbers.clear(); allFunctions.clear(); allOperators.clear(); allNumbers.clear(); - listeners.forEach(e -> e.onUnload(this)); } /**