Checkstyle fixes
This commit is contained in:
@@ -255,7 +255,7 @@ public class RuneLite
|
|||||||
}
|
}
|
||||||
|
|
||||||
Integer world = null;
|
Integer world = null;
|
||||||
if(options.has("world"))
|
if (options.has("world"))
|
||||||
{
|
{
|
||||||
world = options.valueOf(worldInfo);
|
world = options.valueOf(worldInfo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,65 @@ public class ClientLoader implements Supplier<Applet>
|
|||||||
this.worldNumber = worldNumber;
|
this.worldNumber = worldNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Applet loadRLPlus(final RSConfig config)
|
||||||
|
throws ClassNotFoundException, InstantiationException, IllegalAccessException
|
||||||
|
{
|
||||||
|
RuneLiteSplashScreen.stage(.465, "Starting Open Old School RuneScape");
|
||||||
|
|
||||||
|
ClassLoader rsClassLoader = new ClassLoader(ClientLoader.class.getClassLoader())
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected Class<?> findClass(String name) throws ClassNotFoundException
|
||||||
|
{
|
||||||
|
String path = name.replace('.', '/').concat(".class");
|
||||||
|
InputStream inputStream = ClientLoader.class.getResourceAsStream(path);
|
||||||
|
if (inputStream == null)
|
||||||
|
{
|
||||||
|
throw new ClassNotFoundException(name + " " + path);
|
||||||
|
}
|
||||||
|
byte[] data;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
data = ByteStreams.toByteArray(inputStream);
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
RuneLiteSplashScreen.setError("Failed to load!", "Failed to load class: " + name + " " + path);
|
||||||
|
throw new RuntimeException("Failed to load class: " + name + " " + path);
|
||||||
|
}
|
||||||
|
return defineClass(name, data, 0, data.length);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Class<?> clientClass = rsClassLoader.loadClass("client");
|
||||||
|
return loadFromClass(config, clientClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Applet loadVanilla(final RSConfig config)
|
||||||
|
throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException
|
||||||
|
{
|
||||||
|
RuneLiteSplashScreen.stage(.465, "Starting Vanilla Old School RuneScape");
|
||||||
|
|
||||||
|
final String codebase = config.getCodeBase();
|
||||||
|
final String initialJar = config.getInitialJar();
|
||||||
|
final String initialClass = config.getInitialClass();
|
||||||
|
final URL url = new URL(codebase + initialJar);
|
||||||
|
|
||||||
|
// Must set parent classloader to null, or it will pull from
|
||||||
|
// this class's classloader first
|
||||||
|
final URLClassLoader classloader = new URLClassLoader(new URL[]{url}, null);
|
||||||
|
final Class<?> clientClass = classloader.loadClass(initialClass);
|
||||||
|
return loadFromClass(config, clientClass);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Applet loadFromClass(final RSConfig config, final Class<?> clientClass)
|
||||||
|
throws IllegalAccessException, InstantiationException
|
||||||
|
{
|
||||||
|
final Applet rs = (Applet) clientClass.newInstance();
|
||||||
|
rs.setStub(new RSAppletStub(config));
|
||||||
|
return rs;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized Applet get()
|
public synchronized Applet get()
|
||||||
{
|
{
|
||||||
@@ -128,10 +187,10 @@ public class ClientLoader implements Supplier<Applet>
|
|||||||
throw new IOException("Invalid or missing jav_config");
|
throw new IOException("Invalid or missing jav_config");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(worldNumber != null)
|
if (worldNumber != null)
|
||||||
{
|
{
|
||||||
final World world = worldSupplier.get(w -> w.getId() == worldNumber);
|
final World world = worldSupplier.get(w -> w.getId() == worldNumber);
|
||||||
if(world == null)
|
if (world == null)
|
||||||
{
|
{
|
||||||
log.warn("The provided world: {} could not be found. Reverting to random P2P world.", worldNumber);
|
log.warn("The provided world: {} could not be found. Reverting to random P2P world.", worldNumber);
|
||||||
return;
|
return;
|
||||||
@@ -177,63 +236,4 @@ public class ClientLoader implements Supplier<Applet>
|
|||||||
throw err; // use error from Jagex's servers
|
throw err; // use error from Jagex's servers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Applet loadRLPlus(final RSConfig config)
|
|
||||||
throws ClassNotFoundException, InstantiationException, IllegalAccessException
|
|
||||||
{
|
|
||||||
RuneLiteSplashScreen.stage(.465, "Starting Open Old School RuneScape");
|
|
||||||
|
|
||||||
ClassLoader rsClassLoader = new ClassLoader(ClientLoader.class.getClassLoader())
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
protected Class<?> findClass(String name) throws ClassNotFoundException
|
|
||||||
{
|
|
||||||
String path = name.replace('.', '/').concat(".class");
|
|
||||||
InputStream inputStream = ClientLoader.class.getResourceAsStream(path);
|
|
||||||
if (inputStream == null)
|
|
||||||
{
|
|
||||||
throw new ClassNotFoundException(name + " " + path);
|
|
||||||
}
|
|
||||||
byte[] data;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
data = ByteStreams.toByteArray(inputStream);
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
RuneLiteSplashScreen.setError("Failed to load!", "Failed to load class: " + name + " " + path);
|
|
||||||
throw new RuntimeException("Failed to load class: " + name + " " + path);
|
|
||||||
}
|
|
||||||
return defineClass(name, data, 0, data.length);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Class<?> clientClass = rsClassLoader.loadClass("client");
|
|
||||||
return loadFromClass(config, clientClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Applet loadVanilla(final RSConfig config)
|
|
||||||
throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException
|
|
||||||
{
|
|
||||||
RuneLiteSplashScreen.stage(.465, "Starting Vanilla Old School RuneScape");
|
|
||||||
|
|
||||||
final String codebase = config.getCodeBase();
|
|
||||||
final String initialJar = config.getInitialJar();
|
|
||||||
final String initialClass = config.getInitialClass();
|
|
||||||
final URL url = new URL(codebase + initialJar);
|
|
||||||
|
|
||||||
// Must set parent classloader to null, or it will pull from
|
|
||||||
// this class's classloader first
|
|
||||||
final URLClassLoader classloader = new URLClassLoader(new URL[]{url}, null);
|
|
||||||
final Class<?> clientClass = classloader.loadClass(initialClass);
|
|
||||||
return loadFromClass(config, clientClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Applet loadFromClass(final RSConfig config, final Class<?> clientClass)
|
|
||||||
throws IllegalAccessException, InstantiationException
|
|
||||||
{
|
|
||||||
final Applet rs = (Applet) clientClass.newInstance();
|
|
||||||
rs.setStub(new RSAppletStub(config));
|
|
||||||
return rs;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ class WorldSupplier implements Supplier<World>
|
|||||||
|
|
||||||
Collections.shuffle(filteredWorlds, random);
|
Collections.shuffle(filteredWorlds, random);
|
||||||
|
|
||||||
if(filteredWorlds.size() > 0)
|
if (filteredWorlds.size() > 0)
|
||||||
{
|
{
|
||||||
return filteredWorlds.get(0);
|
return filteredWorlds.get(0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user