runelite-client: restore private server support, remove deprecated arguments

This commit is contained in:
Zeruth
2019-07-29 04:31:36 -04:00
parent 2e2c25843d
commit e2ce3eb10f
5 changed files with 22 additions and 17 deletions

View File

@@ -178,8 +178,6 @@ public class RuneLite
parser.accepts("developer-mode", "Enable developer tools"); parser.accepts("developer-mode", "Enable developer tools");
parser.accepts("debug", "Show extra debugging output"); parser.accepts("debug", "Show extra debugging output");
parser.accepts("no-splash", "Do not show the splash screen"); parser.accepts("no-splash", "Do not show the splash screen");
parser.accepts("local-injected", "Use local injected-client - DEPRECATED");
parser.accepts("private-server", "Use a custom codebase - DEPRECATED: Use --rs=RSPS");
final ArgumentAcceptingOptionSpec<String> proxyInfo = parser final ArgumentAcceptingOptionSpec<String> proxyInfo = parser
.accepts("proxy") .accepts("proxy")
@@ -258,16 +256,6 @@ public class RuneLite
logger.setLevel(Level.DEBUG); logger.setLevel(Level.DEBUG);
} }
if (options.has("local-injected"))
{
log.warn("--local-injected has been deprecated and may get removed soon");
}
if (options.has("private-server"))
{
allowPrivateServer = true;
}
Thread.setDefaultUncaughtExceptionHandler((thread, throwable) -> Thread.setDefaultUncaughtExceptionHandler((thread, throwable) ->
{ {
log.error("Uncaught exception:", throwable); log.error("Uncaught exception:", throwable);

View File

@@ -17,7 +17,7 @@ public interface PrivateServerConfig extends Config
) )
default String codebase() default String codebase()
{ {
return "http://oldschool17.runescape.com/"; return "http://127.0.0.1";
} }
@ConfigItem( @ConfigItem(

View File

@@ -35,6 +35,7 @@ import javax.swing.JOptionPane;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.ConfigChanged;
import net.runelite.client.RuneLite;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.EventBus;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
@@ -69,14 +70,20 @@ public class PrivateServerPlugin extends Plugin
@Override @Override
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
updateConfig(); if (RuneLite.allowPrivateServer)
addSubscriptions(); {
updateConfig();
addSubscriptions();
}
} }
@Override @Override
protected void shutDown() throws Exception protected void shutDown() throws Exception
{ {
eventBus.unregister(this); if (RuneLite.allowPrivateServer)
{
eventBus.unregister(this);
}
} }
private void addSubscriptions() private void addSubscriptions()

View File

@@ -34,6 +34,7 @@ import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import javax.inject.Singleton; import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.client.RuneLite;
@Slf4j @Slf4j
@Singleton @Singleton
@@ -66,6 +67,9 @@ public class ClientLoader
return loadVanilla(config); return loadVanilla(config);
case NONE: case NONE:
return null; return null;
case RSPS:
RuneLite.allowPrivateServer = true;
return loadRLPlus(config);
} }
} }
catch (IOException | InstantiationException | IllegalAccessException e) catch (IOException | InstantiationException | IllegalAccessException e)

View File

@@ -27,6 +27,7 @@ package net.runelite.client.rs;
import java.applet.AppletContext; import java.applet.AppletContext;
import java.applet.AppletStub; import java.applet.AppletStub;
import java.io.File;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@@ -57,7 +58,12 @@ class RSAppletStub implements AppletStub
{ {
if (RuneLite.allowPrivateServer) if (RuneLite.allowPrivateServer)
{ {
return new URL(StringFileUtils.readStringFromFile("./codebase")); File f = new File(RuneLite.RUNELITE_DIR + "/codebase");
if (!f.exists())
{
StringFileUtils.writeStringToFile(f.getAbsolutePath(), "http://127.0.0.1");
}
return new URL(StringFileUtils.readStringFromFile(f.getAbsolutePath()));
} }
return new URL(config.getCodeBase()); return new URL(config.getCodeBase());