From 7d5fe2609300f190e62114d016bb4cfb9de37634 Mon Sep 17 00:00:00 2001 From: Arnah Date: Tue, 3 Oct 2023 04:37:17 -0600 Subject: [PATCH] Fix some cases where plugins weren't loading/updating --- .../runelite/plugin/ArnahPluginManager.java | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/main/java/ca/arnah/runelite/plugin/ArnahPluginManager.java b/src/main/java/ca/arnah/runelite/plugin/ArnahPluginManager.java index 836a702..7207299 100644 --- a/src/main/java/ca/arnah/runelite/plugin/ArnahPluginManager.java +++ b/src/main/java/ca/arnah/runelite/plugin/ArnahPluginManager.java @@ -50,6 +50,7 @@ import lombok.extern.slf4j.Slf4j; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.EventBus; +import net.runelite.client.events.ExternalPluginsChanged; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginInstantiationException; import net.runelite.client.plugins.PluginManager; @@ -230,19 +231,21 @@ private void refreshPlugins(){ } List newPlugins2 = newPlugins = pluginManager.loadPlugins(clazzes, null); - if(!startup){ - pluginManager.loadDefaultPluginConfiguration(newPlugins); - - SwingUtilities.invokeAndWait(()->{ - try{ - for(Plugin p : newPlugins2){ - pluginManager.startPlugin(p); + // Below would only run if !startup, removed just incase it was blocking plugins from loading in cases + pluginManager.loadDefaultPluginConfiguration(newPlugins); + SwingUtilities.invokeAndWait(()->{ + try{ + for(Plugin p : newPlugins2){ + if(pluginManager.startPlugin(p)){ + log.info("Started plugin {}", p.getName()); + }else{ + log.warn("Failed to start plugin {}", p.getName()); } - }catch(PluginInstantiationException ex){ - throw new RuntimeException(ex); } - }); - } + }catch(PluginInstantiationException ex){ + log.error("Failed to start plugins", ex); + } + }); }catch(ThreadDeath e){ throw e; }catch(Throwable e){ @@ -267,10 +270,12 @@ private void refreshPlugins(){ } if(!startup){ eventBus.post(new ArnahPluginsChanged(manifestList)); + eventBus.post(new ExternalPluginsChanged()); } // Allows plugins to adjust the plugin hub urls if they want // We then need to check plugins again with the new urls if(!pluginHubUrls.equals(RuneLiteHijackProperties.getPluginHubProperty())){ + log.info("Detected pluginhub urls have been changed, pulling again."); update(); } }finally{