Merge pull request #1179 from runelite-extended/private-server

runelite-client: restore private server support
This commit is contained in:
Tyler Bochard
2019-07-29 04:40:58 -04:00
committed by GitHub
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("debug", "Show extra debugging output");
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
.accepts("proxy")
@@ -258,16 +256,6 @@ public class RuneLite
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) ->
{
log.error("Uncaught exception:", throwable);

View File

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

View File

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

View File

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

View File

@@ -27,6 +27,7 @@ package net.runelite.client.rs;
import java.applet.AppletContext;
import java.applet.AppletStub;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import lombok.RequiredArgsConstructor;
@@ -57,7 +58,12 @@ class RSAppletStub implements AppletStub
{
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());