externals: update plugin list after install

This commit is contained in:
zeruth
2021-02-04 02:13:44 -05:00
parent fd6b8fccea
commit 8c72f10b65
3 changed files with 23 additions and 7 deletions

View File

@@ -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");

View File

@@ -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();