Checkstyle fixes

This commit is contained in:
Jason
2020-01-30 20:56:31 -05:00
parent 52c44c4ace
commit 8d9e9e6f16
3 changed files with 63 additions and 63 deletions

View File

@@ -255,7 +255,7 @@ public class RuneLite
}
Integer world = null;
if(options.has("world"))
if (options.has("world"))
{
world = options.valueOf(worldInfo);
}

View File

@@ -61,6 +61,65 @@ public class ClientLoader implements Supplier<Applet>
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
public synchronized Applet get()
{
@@ -128,10 +187,10 @@ public class ClientLoader implements Supplier<Applet>
throw new IOException("Invalid or missing jav_config");
}
if(worldNumber != null)
if (worldNumber != null)
{
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);
return;
@@ -177,63 +236,4 @@ public class ClientLoader implements Supplier<Applet>
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;
}
}

View File

@@ -100,7 +100,7 @@ class WorldSupplier implements Supplier<World>
Collections.shuffle(filteredWorlds, random);
if(filteredWorlds.size() > 0)
if (filteredWorlds.size() > 0)
{
return filteredWorlds.get(0);
}