Change line endings to LF
This commit is contained in:
@@ -28,95 +28,95 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.runelite.client;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ConfigLoader
|
||||
{
|
||||
private static URL configURL;
|
||||
|
||||
public static final String CODEBASE = "codebase";
|
||||
public static final String INITIAL_JAR = "initial_jar";
|
||||
public static final String INITIAL_CLASS = "initial_class";
|
||||
public static final String APP_MINWIDTH = "applet_minwidth";
|
||||
public static final String APP_MINHEIGHT = "applet_minheight";
|
||||
|
||||
private final Map<String, String> properties = new HashMap<>(),
|
||||
appletProperties = new HashMap<>();
|
||||
|
||||
static
|
||||
{
|
||||
try
|
||||
{
|
||||
configURL = new URL("http://oldschool.runescape.com/jav_config.ws"); // https redirects us to rs3
|
||||
}
|
||||
catch (MalformedURLException ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void fetch() throws IOException
|
||||
{
|
||||
URLConnection conn = configURL.openConnection();
|
||||
try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())))
|
||||
{
|
||||
String str;
|
||||
|
||||
while ((str = in.readLine()) != null)
|
||||
{
|
||||
int idx = str.indexOf('=');
|
||||
|
||||
if (idx == -1)
|
||||
continue;
|
||||
|
||||
String s = str.substring(0, idx);
|
||||
|
||||
if (s.equals("param"))
|
||||
{
|
||||
str = str.substring(idx + 1);
|
||||
idx = str.indexOf('=');
|
||||
s = str.substring(0, idx);
|
||||
|
||||
appletProperties.put(s, str.substring(idx + 1));
|
||||
}
|
||||
else if (s.equals("msg"))
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
else
|
||||
{
|
||||
properties.put(s, str.substring(idx + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getProperty(String name)
|
||||
{
|
||||
return properties.get(name);
|
||||
}
|
||||
|
||||
public Map<String, String> getProperties()
|
||||
{
|
||||
return properties;
|
||||
}
|
||||
|
||||
public String getAppletProperty(String name)
|
||||
{
|
||||
return appletProperties.get(name);
|
||||
}
|
||||
|
||||
public Map<String, String> getAppletProperties()
|
||||
{
|
||||
return appletProperties;
|
||||
}
|
||||
}
|
||||
package net.runelite.client;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ConfigLoader
|
||||
{
|
||||
private static URL configURL;
|
||||
|
||||
public static final String CODEBASE = "codebase";
|
||||
public static final String INITIAL_JAR = "initial_jar";
|
||||
public static final String INITIAL_CLASS = "initial_class";
|
||||
public static final String APP_MINWIDTH = "applet_minwidth";
|
||||
public static final String APP_MINHEIGHT = "applet_minheight";
|
||||
|
||||
private final Map<String, String> properties = new HashMap<>(),
|
||||
appletProperties = new HashMap<>();
|
||||
|
||||
static
|
||||
{
|
||||
try
|
||||
{
|
||||
configURL = new URL("http://oldschool.runescape.com/jav_config.ws"); // https redirects us to rs3
|
||||
}
|
||||
catch (MalformedURLException ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void fetch() throws IOException
|
||||
{
|
||||
URLConnection conn = configURL.openConnection();
|
||||
try (BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())))
|
||||
{
|
||||
String str;
|
||||
|
||||
while ((str = in.readLine()) != null)
|
||||
{
|
||||
int idx = str.indexOf('=');
|
||||
|
||||
if (idx == -1)
|
||||
continue;
|
||||
|
||||
String s = str.substring(0, idx);
|
||||
|
||||
if (s.equals("param"))
|
||||
{
|
||||
str = str.substring(idx + 1);
|
||||
idx = str.indexOf('=');
|
||||
s = str.substring(0, idx);
|
||||
|
||||
appletProperties.put(s, str.substring(idx + 1));
|
||||
}
|
||||
else if (s.equals("msg"))
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
else
|
||||
{
|
||||
properties.put(s, str.substring(idx + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getProperty(String name)
|
||||
{
|
||||
return properties.get(name);
|
||||
}
|
||||
|
||||
public Map<String, String> getProperties()
|
||||
{
|
||||
return properties;
|
||||
}
|
||||
|
||||
public String getAppletProperty(String name)
|
||||
{
|
||||
return appletProperties.get(name);
|
||||
}
|
||||
|
||||
public Map<String, String> getAppletProperties()
|
||||
{
|
||||
return appletProperties;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,70 +28,70 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.runelite.client;
|
||||
|
||||
import java.applet.Applet;
|
||||
import java.applet.AppletContext;
|
||||
import java.applet.AppletStub;
|
||||
import java.awt.Dimension;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
public class RSStub implements AppletStub
|
||||
{
|
||||
private final ConfigLoader config;
|
||||
private final Applet app;
|
||||
|
||||
public RSStub(ConfigLoader config, Applet app)
|
||||
{
|
||||
this.config = config;
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getDocumentBase()
|
||||
{
|
||||
return getCodeBase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getCodeBase()
|
||||
{
|
||||
try
|
||||
{
|
||||
return new URL(config.getProperty(ConfigLoader.CODEBASE));
|
||||
}
|
||||
catch (MalformedURLException ex)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParameter(String name)
|
||||
{
|
||||
return config.getAppletProperty(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppletContext getAppletContext()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appletResize(int width, int height)
|
||||
{
|
||||
Dimension d = new Dimension(width, height);
|
||||
|
||||
app.setSize(d);
|
||||
app.setPreferredSize(d);
|
||||
}
|
||||
|
||||
}
|
||||
package net.runelite.client;
|
||||
|
||||
import java.applet.Applet;
|
||||
import java.applet.AppletContext;
|
||||
import java.applet.AppletStub;
|
||||
import java.awt.Dimension;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
public class RSStub implements AppletStub
|
||||
{
|
||||
private final ConfigLoader config;
|
||||
private final Applet app;
|
||||
|
||||
public RSStub(ConfigLoader config, Applet app)
|
||||
{
|
||||
this.config = config;
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getDocumentBase()
|
||||
{
|
||||
return getCodeBase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getCodeBase()
|
||||
{
|
||||
try
|
||||
{
|
||||
return new URL(config.getProperty(ConfigLoader.CODEBASE));
|
||||
}
|
||||
catch (MalformedURLException ex)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParameter(String name)
|
||||
{
|
||||
return config.getAppletProperty(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppletContext getAppletContext()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appletResize(int width, int height)
|
||||
{
|
||||
Dimension d = new Dimension(width, height);
|
||||
|
||||
app.setSize(d);
|
||||
app.setPreferredSize(d);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,78 +28,78 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.runelite.client;
|
||||
|
||||
import java.io.File;
|
||||
import joptsimple.OptionParser;
|
||||
import joptsimple.OptionSet;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.plugins.PluginManager;
|
||||
import net.runelite.client.ui.ClientUI;
|
||||
import net.runelite.client.ui.overlay.OverlayRenderer;
|
||||
|
||||
|
||||
public class 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");
|
||||
|
||||
private static OptionSet options;
|
||||
private static Client client;
|
||||
private static RuneLite runelite;
|
||||
|
||||
private ClientUI gui;
|
||||
private PluginManager pluginManager;
|
||||
private OverlayRenderer renderer;
|
||||
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
OptionParser parser = new OptionParser();
|
||||
parser.accepts("developer-mode");
|
||||
options = parser.parse(args);
|
||||
|
||||
runelite = new RuneLite();
|
||||
runelite.start();
|
||||
}
|
||||
|
||||
public void start() throws Exception
|
||||
{
|
||||
gui = new ClientUI();
|
||||
gui.setVisible(true);
|
||||
|
||||
pluginManager = new PluginManager();
|
||||
pluginManager.loadAll();
|
||||
|
||||
renderer = new OverlayRenderer();
|
||||
}
|
||||
|
||||
public static Client getClient()
|
||||
{
|
||||
return client;
|
||||
}
|
||||
|
||||
public static void setClient(Client client)
|
||||
{
|
||||
RuneLite.client = client;
|
||||
}
|
||||
|
||||
public static RuneLite getRunelite()
|
||||
{
|
||||
return runelite;
|
||||
}
|
||||
|
||||
public PluginManager getPluginManager()
|
||||
{
|
||||
return pluginManager;
|
||||
}
|
||||
|
||||
public OverlayRenderer getRenderer()
|
||||
{
|
||||
return renderer;
|
||||
}
|
||||
|
||||
public static OptionSet getOptions()
|
||||
{
|
||||
return options;
|
||||
}
|
||||
}
|
||||
package net.runelite.client;
|
||||
|
||||
import java.io.File;
|
||||
import joptsimple.OptionParser;
|
||||
import joptsimple.OptionSet;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.plugins.PluginManager;
|
||||
import net.runelite.client.ui.ClientUI;
|
||||
import net.runelite.client.ui.overlay.OverlayRenderer;
|
||||
|
||||
|
||||
public class 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");
|
||||
|
||||
private static OptionSet options;
|
||||
private static Client client;
|
||||
private static RuneLite runelite;
|
||||
|
||||
private ClientUI gui;
|
||||
private PluginManager pluginManager;
|
||||
private OverlayRenderer renderer;
|
||||
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
OptionParser parser = new OptionParser();
|
||||
parser.accepts("developer-mode");
|
||||
options = parser.parse(args);
|
||||
|
||||
runelite = new RuneLite();
|
||||
runelite.start();
|
||||
}
|
||||
|
||||
public void start() throws Exception
|
||||
{
|
||||
gui = new ClientUI();
|
||||
gui.setVisible(true);
|
||||
|
||||
pluginManager = new PluginManager();
|
||||
pluginManager.loadAll();
|
||||
|
||||
renderer = new OverlayRenderer();
|
||||
}
|
||||
|
||||
public static Client getClient()
|
||||
{
|
||||
return client;
|
||||
}
|
||||
|
||||
public static void setClient(Client client)
|
||||
{
|
||||
RuneLite.client = client;
|
||||
}
|
||||
|
||||
public static RuneLite getRunelite()
|
||||
{
|
||||
return runelite;
|
||||
}
|
||||
|
||||
public PluginManager getPluginManager()
|
||||
{
|
||||
return pluginManager;
|
||||
}
|
||||
|
||||
public OverlayRenderer getRenderer()
|
||||
{
|
||||
return renderer;
|
||||
}
|
||||
|
||||
public static OptionSet getOptions()
|
||||
{
|
||||
return options;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,88 +28,88 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.runelite.client.ui;
|
||||
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.UnsupportedLookAndFeelException;
|
||||
|
||||
public final class ClientUI extends JFrame implements ComponentListener
|
||||
{
|
||||
private ClientPanel panel;
|
||||
|
||||
public ClientUI() throws Exception
|
||||
{
|
||||
init();
|
||||
pack();
|
||||
setTitle("RuneLite");
|
||||
setLocationRelativeTo(getOwner());
|
||||
setMinimumSize(getSize());
|
||||
setResizable(true);
|
||||
this.addComponentListener(this);
|
||||
}
|
||||
|
||||
private void init() throws Exception
|
||||
{
|
||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||
|
||||
addWindowListener(new WindowAdapter()
|
||||
{
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e)
|
||||
{
|
||||
checkExit();
|
||||
}
|
||||
});
|
||||
|
||||
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
|
||||
try
|
||||
{
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
}
|
||||
catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ignored)
|
||||
{
|
||||
}
|
||||
|
||||
panel = new ClientPanel();
|
||||
add(panel);
|
||||
}
|
||||
|
||||
private void checkExit()
|
||||
{
|
||||
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)
|
||||
{
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e)
|
||||
{
|
||||
SwingUtilities.invokeLater(() -> pack()); // is this right?
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentMoved(ComponentEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentShown(ComponentEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentHidden(ComponentEvent e)
|
||||
{
|
||||
}
|
||||
package net.runelite.client.ui;
|
||||
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.UnsupportedLookAndFeelException;
|
||||
|
||||
public final class ClientUI extends JFrame implements ComponentListener
|
||||
{
|
||||
private ClientPanel panel;
|
||||
|
||||
public ClientUI() throws Exception
|
||||
{
|
||||
init();
|
||||
pack();
|
||||
setTitle("RuneLite");
|
||||
setLocationRelativeTo(getOwner());
|
||||
setMinimumSize(getSize());
|
||||
setResizable(true);
|
||||
this.addComponentListener(this);
|
||||
}
|
||||
|
||||
private void init() throws Exception
|
||||
{
|
||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||
|
||||
addWindowListener(new WindowAdapter()
|
||||
{
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e)
|
||||
{
|
||||
checkExit();
|
||||
}
|
||||
});
|
||||
|
||||
JPopupMenu.setDefaultLightWeightPopupEnabled(false);
|
||||
try
|
||||
{
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
}
|
||||
catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ignored)
|
||||
{
|
||||
}
|
||||
|
||||
panel = new ClientPanel();
|
||||
add(panel);
|
||||
}
|
||||
|
||||
private void checkExit()
|
||||
{
|
||||
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)
|
||||
{
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e)
|
||||
{
|
||||
SwingUtilities.invokeLater(() -> pack()); // is this right?
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentMoved(ComponentEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentShown(ComponentEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentHidden(ComponentEvent e)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -28,9 +28,9 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.runelite.client.ui.overlay;
|
||||
|
||||
public enum OverlayPosition
|
||||
{
|
||||
TOP_LEFT;
|
||||
}
|
||||
package net.runelite.client.ui.overlay;
|
||||
|
||||
public enum OverlayPosition
|
||||
{
|
||||
TOP_LEFT;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user