externals: update plugin list after install
This commit is contained in:
@@ -75,6 +75,7 @@ import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.config.RuneLiteConfig;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.events.ExternalPluginsChanged;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginInstantiationException;
|
||||
import net.runelite.client.plugins.PluginManager;
|
||||
@@ -421,9 +422,9 @@ public class ExternalPluginManager
|
||||
.directed()
|
||||
.build();
|
||||
|
||||
for (Plugin plugin : plugins)
|
||||
for (net.runelite.client.plugins.Plugin plugin : plugins)
|
||||
{
|
||||
Class<? extends Plugin> clazz = plugin.getClass();
|
||||
Class<? extends net.runelite.client.plugins.Plugin> clazz = plugin.getClass();
|
||||
PluginDescriptor pluginDescriptor = clazz.getAnnotation(PluginDescriptor.class);
|
||||
|
||||
try
|
||||
@@ -820,6 +821,8 @@ public class ExternalPluginManager
|
||||
|
||||
groups.broadcastSring("STARTEXTERNAL;" + pluginId);
|
||||
scanAndInstantiate(loadPlugin(pluginId), true, false);
|
||||
ExternalPluginsChanged event = new ExternalPluginsChanged(null);
|
||||
eventBus.post(event);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -853,9 +856,9 @@ public class ExternalPluginManager
|
||||
}
|
||||
|
||||
updateManager.installPlugin(pluginId, null);
|
||||
|
||||
scanAndInstantiate(loadPlugin(pluginId), true, true);
|
||||
|
||||
ExternalPluginsChanged event = new ExternalPluginsChanged(null);
|
||||
eventBus.post(event);
|
||||
groups.broadcastSring("STARTEXTERNAL;" + pluginId);
|
||||
}
|
||||
catch (DependencyResolver.DependenciesNotFoundException ex)
|
||||
|
||||
@@ -95,7 +95,7 @@ public class RuneLite
|
||||
{
|
||||
public static final File RUNELITE_DIR = new File(System.getProperty("user.home"), ".openosrs");
|
||||
public static final File CACHE_DIR = new File(RUNELITE_DIR, "cache");
|
||||
public static final File PLUGINS_DIR = new File(RUNELITE_DIR, "plugins");
|
||||
public static final File PLUGINS_DIR = new File(RUNELITE_DIR, "plugins-hub");
|
||||
public static final File PROFILES_DIR = new File(RUNELITE_DIR, "profiles");
|
||||
public static final File SCREENSHOT_DIR = new File(RUNELITE_DIR, "screenshots");
|
||||
public static final File LOGS_DIR = new File(RUNELITE_DIR, "logs");
|
||||
|
||||
@@ -164,8 +164,21 @@ public class PluginManager
|
||||
{
|
||||
try
|
||||
{
|
||||
final Injector injector = plugin.getInjector();
|
||||
|
||||
Injector injector = plugin.getInjector();
|
||||
if (injector == null)
|
||||
{
|
||||
// Create injector for the module
|
||||
Module pluginModule = (Binder binder) ->
|
||||
{
|
||||
// Since the plugin itself is a module, it won't bind itself, so we'll bind it here
|
||||
binder.bind((Class<Plugin>) plugin.getClass()).toInstance(plugin);
|
||||
binder.install(plugin);
|
||||
};
|
||||
Injector pluginInjector = RuneLite.getInjector().createChildInjector(pluginModule);
|
||||
pluginInjector.injectMembers(plugin);
|
||||
plugin.injector = pluginInjector;
|
||||
injector = pluginInjector;
|
||||
}
|
||||
for (Key<?> key : injector.getBindings().keySet())
|
||||
{
|
||||
Class<?> type = key.getTypeLiteral().getRawType();
|
||||
|
||||
Reference in New Issue
Block a user