client: fix load when outdated
This commit is contained in:
@@ -351,6 +351,7 @@ public class RuneLite
|
||||
oprsExternalPluginManager.setupInstance();
|
||||
oprsExternalPluginManager.startExternalUpdateManager();
|
||||
oprsExternalPluginManager.startExternalPluginManager();
|
||||
oprsExternalPluginManager.setOutdated(isOutdated);
|
||||
|
||||
// Update external plugins
|
||||
oprsExternalPluginManager.update(); //TODO: Re-enable after fixing actions for new repo
|
||||
@@ -400,6 +401,10 @@ public class RuneLite
|
||||
|
||||
// legacy method, i cant figure out how to make it work without garbage
|
||||
eventBus.register(xpDropManager.get());
|
||||
|
||||
//Set the world if specified via CLI args - will not work until clientUI.init is called
|
||||
Optional<Integer> worldArg = Optional.ofNullable(System.getProperty("cli.world")).map(Integer::parseInt);
|
||||
worldArg.ifPresent(this::setWorld);
|
||||
}
|
||||
|
||||
// Start plugins
|
||||
@@ -408,10 +413,6 @@ public class RuneLite
|
||||
SplashScreen.stop();
|
||||
|
||||
clientUI.show();
|
||||
|
||||
//Set the world if specified via CLI args - will not work until clientUI.init is called
|
||||
Optional<Integer> worldArg = Optional.ofNullable(System.getProperty("cli.world")).map(Integer::parseInt);
|
||||
worldArg.ifPresent(this::setWorld);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -60,7 +60,7 @@ public class WorldService
|
||||
private WorldResult worlds;
|
||||
|
||||
@Inject
|
||||
private WorldService(Client client, ScheduledExecutorService scheduledExecutorService, OkHttpClient okHttpClient,
|
||||
private WorldService(@Nullable Client client, ScheduledExecutorService scheduledExecutorService, OkHttpClient okHttpClient,
|
||||
EventBus eventBus)
|
||||
{
|
||||
this.client = client;
|
||||
|
||||
@@ -71,6 +71,7 @@ import javax.inject.Singleton;
|
||||
import javax.swing.JOptionPane;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.config.Config;
|
||||
@@ -127,6 +128,8 @@ public class OPRSExternalPluginManager
|
||||
@Inject
|
||||
@Named("safeMode")
|
||||
private boolean safeMode;
|
||||
@Setter
|
||||
boolean isOutdated;
|
||||
|
||||
public void setupInstance()
|
||||
{
|
||||
@@ -456,6 +459,11 @@ public class OPRSExternalPluginManager
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!pluginDescriptor.loadWhenOutdated() && isOutdated)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (safeMode && !pluginDescriptor.loadInSafeMode())
|
||||
{
|
||||
log.debug("Disabling {} due to safe mode", clazz);
|
||||
|
||||
@@ -28,8 +28,8 @@ package net.runelite.client.plugins.openosrs;
|
||||
|
||||
import ch.qos.logback.classic.Logger;
|
||||
import com.openosrs.client.config.OpenOSRSConfig;
|
||||
import net.runelite.client.plugins.openosrs.externals.ExternalPluginManagerPanel;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -40,6 +40,7 @@ import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.input.KeyManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.openosrs.externals.ExternalPluginManagerPanel;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.util.HotkeyListener;
|
||||
@@ -61,6 +62,7 @@ public class OpenOSRSPlugin extends Plugin
|
||||
@Inject
|
||||
private KeyManager keyManager;
|
||||
|
||||
@Nullable
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@@ -89,6 +91,11 @@ public class OpenOSRSPlugin extends Plugin
|
||||
@Override
|
||||
protected void startUp()
|
||||
{
|
||||
if (client == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ExternalPluginManagerPanel panel = injector.getInstance(ExternalPluginManagerPanel.class);
|
||||
|
||||
final BufferedImage icon = ImageUtil.loadImageResource(getClass(), "externalmanager_icon.png");
|
||||
@@ -108,7 +115,10 @@ public class OpenOSRSPlugin extends Plugin
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
clientToolbar.removeNavigation(navButton);
|
||||
if (navButton != null)
|
||||
{
|
||||
clientToolbar.removeNavigation(navButton);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
||||
Reference in New Issue
Block a user