Merge branch 'runelite' into question_mark_full_stop
# Conflicts: # runelite-client/src/main/java/net/runelite/client/plugins/OPRSExternalPluginManager.java
This commit is contained in:
@@ -8,7 +8,7 @@ import java.util.UUID;
|
||||
public class OpenOSRS
|
||||
{
|
||||
public static final File OPENOSRS_DIR = new File(System.getProperty("user.home"), ".openosrs");
|
||||
public static final File EXTERNALPLUGIN_DIR = new File(OPENOSRS_DIR, "plugins");
|
||||
public static final File EXTERNALPLUGIN_DIR = new File(OPENOSRS_DIR, "plugins-oprs");
|
||||
public static final String SYSTEM_VERSION;
|
||||
|
||||
public static String uuid = UUID.randomUUID().toString();
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package com.openosrs.client.events;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ExternalPluginsLoaded
|
||||
{}
|
||||
@@ -28,7 +28,7 @@ import lombok.Data;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
|
||||
@Data
|
||||
public class ExternalPluginChanged
|
||||
public class OPRSPluginChanged
|
||||
{
|
||||
private final String pluginId;
|
||||
private final Plugin plugin;
|
||||
@@ -27,7 +27,7 @@ package com.openosrs.client.events;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ExternalRepositoryChanged
|
||||
public class OPRSRepositoryChanged
|
||||
{
|
||||
private final String owner;
|
||||
private final boolean added;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, ThatGamerBlue <thatgamerblue@gmail.com>
|
||||
* Copyright (c) 2020, Owain van Brakel <https://github.com/Owain94>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -36,8 +36,8 @@ import com.google.inject.Module;
|
||||
import static com.openosrs.client.OpenOSRS.EXTERNALPLUGIN_DIR;
|
||||
import static com.openosrs.client.OpenOSRS.SYSTEM_VERSION;
|
||||
import com.openosrs.client.config.OpenOSRSConfig;
|
||||
import com.openosrs.client.events.ExternalPluginChanged;
|
||||
import com.openosrs.client.events.ExternalRepositoryChanged;
|
||||
import com.openosrs.client.events.OPRSPluginChanged;
|
||||
import com.openosrs.client.events.OPRSRepositoryChanged;
|
||||
import com.openosrs.client.ui.OpenOSRSSplashScreen;
|
||||
import com.openosrs.client.util.Groups;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@@ -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.ui.ClientUI;
|
||||
import net.runelite.client.util.SwingUtil;
|
||||
import org.jgroups.Message;
|
||||
@@ -325,14 +326,14 @@ public class OPRSExternalPluginManager
|
||||
{
|
||||
DefaultUpdateRepository respository = new DefaultUpdateRepository(key, url);
|
||||
updateManager.addRepository(respository);
|
||||
eventBus.post(new ExternalRepositoryChanged(key, true));
|
||||
eventBus.post(new OPRSRepositoryChanged(key, true));
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
public void removeRepository(String owner)
|
||||
{
|
||||
updateManager.removeRepository(owner);
|
||||
eventBus.post(new ExternalRepositoryChanged(owner, false));
|
||||
eventBus.post(new OPRSRepositoryChanged(owner, false));
|
||||
saveConfig();
|
||||
}
|
||||
|
||||
@@ -627,7 +628,7 @@ public class OPRSExternalPluginManager
|
||||
{
|
||||
runelitePluginManager.add(plugin);
|
||||
runelitePluginManager.startPlugin(plugin);
|
||||
eventBus.post(new ExternalPluginChanged(pluginsMap.get(plugin.getClass().getSimpleName()),
|
||||
eventBus.post(new OPRSPluginChanged(pluginsMap.get(plugin.getClass().getSimpleName()),
|
||||
plugin, true));
|
||||
}
|
||||
catch (PluginInstantiationException e)
|
||||
@@ -794,7 +795,7 @@ public class OPRSExternalPluginManager
|
||||
runelitePluginManager.remove(plugin);
|
||||
pluginClassLoaders.remove(plugin.getClass().getClassLoader());
|
||||
|
||||
eventBus.post(new ExternalPluginChanged(pluginId, plugin, false));
|
||||
eventBus.post(new OPRSPluginChanged(pluginId, plugin, false));
|
||||
|
||||
return pluginWrapper.getPluginPath();
|
||||
}
|
||||
@@ -818,6 +819,8 @@ public class OPRSExternalPluginManager
|
||||
|
||||
groups.broadcastSring("STARTEXTERNAL;" + pluginId);
|
||||
scanAndInstantiate(loadPlugin(pluginId), true, false);
|
||||
ExternalPluginsChanged event = new ExternalPluginsChanged(null);
|
||||
eventBus.post(event);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -851,9 +854,9 @@ public class OPRSExternalPluginManager
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
@@ -163,8 +163,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();
|
||||
|
||||
@@ -2,8 +2,8 @@ package net.runelite.client.plugins.openosrs.externals;
|
||||
|
||||
import net.runelite.client.plugins.OPRSExternalPluginManager;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.openosrs.client.events.ExternalPluginChanged;
|
||||
import com.openosrs.client.events.ExternalRepositoryChanged;
|
||||
import com.openosrs.client.events.OPRSPluginChanged;
|
||||
import com.openosrs.client.events.OPRSRepositoryChanged;
|
||||
import net.runelite.client.util.DeferredDocumentChangedListener;
|
||||
import com.openosrs.client.util.SwingUtil;
|
||||
import java.awt.BorderLayout;
|
||||
@@ -123,7 +123,7 @@ public class PluginsPanel extends JPanel
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onExternalRepositoryChanged(ExternalRepositoryChanged event)
|
||||
public void onExternalRepositoryChanged(OPRSRepositoryChanged event)
|
||||
{
|
||||
buildFilter();
|
||||
reloadPlugins();
|
||||
@@ -283,7 +283,7 @@ public class PluginsPanel extends JPanel
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onExternalPluginChanged(ExternalPluginChanged externalPluginChanged)
|
||||
private void onExternalPluginChanged(OPRSPluginChanged externalPluginChanged)
|
||||
{
|
||||
String pluginId = externalPluginChanged.getPluginId();
|
||||
Optional<Component> externalBox;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.runelite.client.plugins.openosrs.externals;
|
||||
|
||||
import net.runelite.client.plugins.OPRSExternalPluginManager;
|
||||
import com.openosrs.client.events.ExternalRepositoryChanged;
|
||||
import com.openosrs.client.events.OPRSRepositoryChanged;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
@@ -36,7 +36,7 @@ public class RepositoryPanel extends JPanel
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onExternalRepositoryChanged(ExternalRepositoryChanged event)
|
||||
private void onExternalRepositoryChanged(OPRSRepositoryChanged event)
|
||||
{
|
||||
removeAll();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user