Change line endings to LF

This commit is contained in:
Adam
2016-05-21 19:50:36 -04:00
parent 35aa1cb629
commit ec9525f661
10 changed files with 446 additions and 446 deletions

View File

@@ -28,30 +28,30 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.runelite.api; package net.runelite.api;
public enum GameState public enum GameState
{ {
UNKNOWN(-1), UNKNOWN(-1),
STARTING(0), STARTING(0),
LOGIN_SCREEN(10), LOGIN_SCREEN(10),
LOGGING_IN(20), LOGGING_IN(20),
LOADING(25), LOADING(25),
LOGGED_IN(30), LOGGED_IN(30),
HOPPING(45); HOPPING(45);
private final int state; private final int state;
GameState(int state) GameState(int state)
{ {
this.state = state; this.state = state;
} }
public static GameState of(int state) public static GameState of(int state)
{ {
for (GameState gs : GameState.values()) for (GameState gs : GameState.values())
if (gs.state == state) if (gs.state == state)
return gs; return gs;
return UNKNOWN; return UNKNOWN;
} }
} }

View File

@@ -28,43 +28,43 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.runelite.api; package net.runelite.api;
public enum Skill public enum Skill
{ {
ATTACK("Attack"), ATTACK("Attack"),
DEFENCE("Defence"), DEFENCE("Defence"),
STRENGTH("Strength"), STRENGTH("Strength"),
HITPOINTS("Hitpoints"), HITPOINTS("Hitpoints"),
RANGED("Ranged"), RANGED("Ranged"),
PRAYER("Prayer"), PRAYER("Prayer"),
MAGIC("Magic"), MAGIC("Magic"),
COOKING("Cooking"), COOKING("Cooking"),
WOODCUTTING("Woodcutting"), WOODCUTTING("Woodcutting"),
FLETCHING("Fletching"), FLETCHING("Fletching"),
FISHING("Fishing"), FISHING("Fishing"),
FIREMAKING("Firemaking"), FIREMAKING("Firemaking"),
CRAFTING("Crafting"), CRAFTING("Crafting"),
SMITHING("Smithing"), SMITHING("Smithing"),
MINING("Mining"), MINING("Mining"),
HERBLORE("Herblore"), HERBLORE("Herblore"),
AGILITY("Agility"), AGILITY("Agility"),
THIEVING("Thieving"), THIEVING("Thieving"),
SLAYER("Slayer"), SLAYER("Slayer"),
FARMING("Farming"), FARMING("Farming"),
RUNECRAFT("Runecraft"), RUNECRAFT("Runecraft"),
HUNTER("Hunter"), HUNTER("Hunter"),
CONSTRUCTION("Construction"); CONSTRUCTION("Construction");
private final String name; private final String name;
Skill(String name) Skill(String name)
{ {
this.name = name; this.name = name;
} }
public String getName() public String getName()
{ {
return name; return name;
} }
} }

View File

@@ -28,16 +28,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.runelite.mapping; package net.runelite.mapping;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD) @Target(ElementType.METHOD)
public @interface ObfuscatedOverride public @interface ObfuscatedOverride
{ {
String value(); String value();
} }

View File

@@ -28,18 +28,18 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.runelite.mapping; package net.runelite.mapping;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR}) @Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
public @interface ObfuscatedSignature public @interface ObfuscatedSignature
{ {
String signature(); String signature();
String garbageValue() default ""; // valid garbage value for last parameter. can't be an Object because Java. String garbageValue() default ""; // valid garbage value for last parameter. can't be an Object because Java.
} }

View File

@@ -28,95 +28,95 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.runelite.client; package net.runelite.client;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
public class ConfigLoader public class ConfigLoader
{ {
private static URL configURL; private static URL configURL;
public static final String CODEBASE = "codebase"; public static final String CODEBASE = "codebase";
public static final String INITIAL_JAR = "initial_jar"; public static final String INITIAL_JAR = "initial_jar";
public static final String INITIAL_CLASS = "initial_class"; public static final String INITIAL_CLASS = "initial_class";
public static final String APP_MINWIDTH = "applet_minwidth"; public static final String APP_MINWIDTH = "applet_minwidth";
public static final String APP_MINHEIGHT = "applet_minheight"; public static final String APP_MINHEIGHT = "applet_minheight";
private final Map<String, String> properties = new HashMap<>(), private final Map<String, String> properties = new HashMap<>(),
appletProperties = new HashMap<>(); appletProperties = new HashMap<>();
static static
{ {
try try
{ {
configURL = new URL("http://oldschool.runescape.com/jav_config.ws"); // https redirects us to rs3 configURL = new URL("http://oldschool.runescape.com/jav_config.ws"); // https redirects us to rs3
} }
catch (MalformedURLException ex) catch (MalformedURLException ex)
{ {
ex.printStackTrace(); ex.printStackTrace();
} }
} }
public void fetch() throws IOException public void fetch() throws IOException
{ {
URLConnection conn = configURL.openConnection(); URLConnection conn = configURL.openConnection();
try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()))) try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())))
{ {
String str; String str;
while ((str = in.readLine()) != null) while ((str = in.readLine()) != null)
{ {
int idx = str.indexOf('='); int idx = str.indexOf('=');
if (idx == -1) if (idx == -1)
continue; continue;
String s = str.substring(0, idx); String s = str.substring(0, idx);
if (s.equals("param")) if (s.equals("param"))
{ {
str = str.substring(idx + 1); str = str.substring(idx + 1);
idx = str.indexOf('='); idx = str.indexOf('=');
s = str.substring(0, idx); s = str.substring(0, idx);
appletProperties.put(s, str.substring(idx + 1)); appletProperties.put(s, str.substring(idx + 1));
} }
else if (s.equals("msg")) else if (s.equals("msg"))
{ {
// ignore // ignore
} }
else else
{ {
properties.put(s, str.substring(idx + 1)); properties.put(s, str.substring(idx + 1));
} }
} }
} }
} }
public String getProperty(String name) public String getProperty(String name)
{ {
return properties.get(name); return properties.get(name);
} }
public Map<String, String> getProperties() public Map<String, String> getProperties()
{ {
return properties; return properties;
} }
public String getAppletProperty(String name) public String getAppletProperty(String name)
{ {
return appletProperties.get(name); return appletProperties.get(name);
} }
public Map<String, String> getAppletProperties() public Map<String, String> getAppletProperties()
{ {
return appletProperties; return appletProperties;
} }
} }

View File

@@ -28,70 +28,70 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.runelite.client; package net.runelite.client;
import java.applet.Applet; import java.applet.Applet;
import java.applet.AppletContext; import java.applet.AppletContext;
import java.applet.AppletStub; import java.applet.AppletStub;
import java.awt.Dimension; import java.awt.Dimension;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
public class RSStub implements AppletStub public class RSStub implements AppletStub
{ {
private final ConfigLoader config; private final ConfigLoader config;
private final Applet app; private final Applet app;
public RSStub(ConfigLoader config, Applet app) public RSStub(ConfigLoader config, Applet app)
{ {
this.config = config; this.config = config;
this.app = app; this.app = app;
} }
@Override @Override
public boolean isActive() public boolean isActive()
{ {
return true; return true;
} }
@Override @Override
public URL getDocumentBase() public URL getDocumentBase()
{ {
return getCodeBase(); return getCodeBase();
} }
@Override @Override
public URL getCodeBase() public URL getCodeBase()
{ {
try try
{ {
return new URL(config.getProperty(ConfigLoader.CODEBASE)); return new URL(config.getProperty(ConfigLoader.CODEBASE));
} }
catch (MalformedURLException ex) catch (MalformedURLException ex)
{ {
return null; return null;
} }
} }
@Override @Override
public String getParameter(String name) public String getParameter(String name)
{ {
return config.getAppletProperty(name); return config.getAppletProperty(name);
} }
@Override @Override
public AppletContext getAppletContext() public AppletContext getAppletContext()
{ {
return null; return null;
} }
@Override @Override
public void appletResize(int width, int height) public void appletResize(int width, int height)
{ {
Dimension d = new Dimension(width, height); Dimension d = new Dimension(width, height);
app.setSize(d); app.setSize(d);
app.setPreferredSize(d); app.setPreferredSize(d);
} }
} }

View File

@@ -28,78 +28,78 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.runelite.client; package net.runelite.client;
import java.io.File; import java.io.File;
import joptsimple.OptionParser; import joptsimple.OptionParser;
import joptsimple.OptionSet; import joptsimple.OptionSet;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.client.plugins.PluginManager; import net.runelite.client.plugins.PluginManager;
import net.runelite.client.ui.ClientUI; import net.runelite.client.ui.ClientUI;
import net.runelite.client.ui.overlay.OverlayRenderer; import net.runelite.client.ui.overlay.OverlayRenderer;
public class RuneLite public class RuneLite
{ {
public static final File RUNELITE_DIR = new File(System.getProperty("user.home"), ".runelite"); public static final File RUNELITE_DIR = new File(System.getProperty("user.home"), ".runelite");
public static final File REPO_DIR = new File(RUNELITE_DIR, "repository"); public static final File REPO_DIR = new File(RUNELITE_DIR, "repository");
private static OptionSet options; private static OptionSet options;
private static Client client; private static Client client;
private static RuneLite runelite; private static RuneLite runelite;
private ClientUI gui; private ClientUI gui;
private PluginManager pluginManager; private PluginManager pluginManager;
private OverlayRenderer renderer; private OverlayRenderer renderer;
public static void main(String[] args) throws Exception public static void main(String[] args) throws Exception
{ {
OptionParser parser = new OptionParser(); OptionParser parser = new OptionParser();
parser.accepts("developer-mode"); parser.accepts("developer-mode");
options = parser.parse(args); options = parser.parse(args);
runelite = new RuneLite(); runelite = new RuneLite();
runelite.start(); runelite.start();
} }
public void start() throws Exception public void start() throws Exception
{ {
gui = new ClientUI(); gui = new ClientUI();
gui.setVisible(true); gui.setVisible(true);
pluginManager = new PluginManager(); pluginManager = new PluginManager();
pluginManager.loadAll(); pluginManager.loadAll();
renderer = new OverlayRenderer(); renderer = new OverlayRenderer();
} }
public static Client getClient() public static Client getClient()
{ {
return client; return client;
} }
public static void setClient(Client client) public static void setClient(Client client)
{ {
RuneLite.client = client; RuneLite.client = client;
} }
public static RuneLite getRunelite() public static RuneLite getRunelite()
{ {
return runelite; return runelite;
} }
public PluginManager getPluginManager() public PluginManager getPluginManager()
{ {
return pluginManager; return pluginManager;
} }
public OverlayRenderer getRenderer() public OverlayRenderer getRenderer()
{ {
return renderer; return renderer;
} }
public static OptionSet getOptions() public static OptionSet getOptions()
{ {
return options; return options;
} }
} }

View File

@@ -28,88 +28,88 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.runelite.client.ui; package net.runelite.client.ui;
import java.awt.event.ComponentEvent; import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener; import java.awt.event.ComponentListener;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.JPopupMenu; import javax.swing.JPopupMenu;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException; import javax.swing.UnsupportedLookAndFeelException;
public final class ClientUI extends JFrame implements ComponentListener public final class ClientUI extends JFrame implements ComponentListener
{ {
private ClientPanel panel; private ClientPanel panel;
public ClientUI() throws Exception public ClientUI() throws Exception
{ {
init(); init();
pack(); pack();
setTitle("RuneLite"); setTitle("RuneLite");
setLocationRelativeTo(getOwner()); setLocationRelativeTo(getOwner());
setMinimumSize(getSize()); setMinimumSize(getSize());
setResizable(true); setResizable(true);
this.addComponentListener(this); this.addComponentListener(this);
} }
private void init() throws Exception private void init() throws Exception
{ {
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() addWindowListener(new WindowAdapter()
{ {
@Override @Override
public void windowClosing(WindowEvent e) public void windowClosing(WindowEvent e)
{ {
checkExit(); checkExit();
} }
}); });
JPopupMenu.setDefaultLightWeightPopupEnabled(false); JPopupMenu.setDefaultLightWeightPopupEnabled(false);
try try
{ {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} }
catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ignored) catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ignored)
{ {
} }
panel = new ClientPanel(); panel = new ClientPanel();
add(panel); add(panel);
} }
private void checkExit() private void checkExit()
{ {
int result = JOptionPane.showConfirmDialog(this, "Are you sure you want to exit?", "Exit", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); int result = JOptionPane.showConfirmDialog(this, "Are you sure you want to exit?", "Exit", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (result == JOptionPane.OK_OPTION) if (result == JOptionPane.OK_OPTION)
{ {
System.exit(0); System.exit(0);
} }
} }
@Override @Override
public void componentResized(ComponentEvent e) public void componentResized(ComponentEvent e)
{ {
SwingUtilities.invokeLater(() -> pack()); // is this right? SwingUtilities.invokeLater(() -> pack()); // is this right?
} }
@Override @Override
public void componentMoved(ComponentEvent e) public void componentMoved(ComponentEvent e)
{ {
} }
@Override @Override
public void componentShown(ComponentEvent e) public void componentShown(ComponentEvent e)
{ {
} }
@Override @Override
public void componentHidden(ComponentEvent e) public void componentHidden(ComponentEvent e)
{ {
} }
} }

View File

@@ -28,9 +28,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.runelite.client.ui.overlay; package net.runelite.client.ui.overlay;
public enum OverlayPosition public enum OverlayPosition
{ {
TOP_LEFT; TOP_LEFT;
} }

View File

@@ -28,30 +28,30 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.runelite.client; package net.runelite.client;
import java.io.IOException; import java.io.IOException;
import org.junit.Test; import org.junit.Test;
/** /**
* *
* @author Adam * @author Adam
*/ */
public class ConfigLoaderTest public class ConfigLoaderTest
{ {
@Test @Test
public void test() throws IOException public void test() throws IOException
{ {
ConfigLoader loader = new ConfigLoader(); ConfigLoader loader = new ConfigLoader();
loader.fetch(); loader.fetch();
for (String key : loader.getProperties().keySet()) for (String key : loader.getProperties().keySet())
System.out.println(key + ": " + loader.getProperty(key)); System.out.println(key + ": " + loader.getProperty(key));
System.out.println("Applet properties:"); System.out.println("Applet properties:");
for (String key : loader.getAppletProperties().keySet()) for (String key : loader.getAppletProperties().keySet())
System.out.println(key + ": " + loader.getAppletProperty(key)); System.out.println(key + ": " + loader.getAppletProperty(key));
} }
} }