Skip to content

Commit

Permalink
Fix some cases where plugins weren't loading/updating
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnuh committed Oct 3, 2023
1 parent 0243ee0 commit 7d5fe26
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/main/java/ca/arnah/runelite/plugin/ArnahPluginManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -230,19 +231,21 @@ private void refreshPlugins(){
}

List<Plugin> 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){
Expand All @@ -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{
Expand Down

0 comments on commit 7d5fe26

Please sign in to comment.