mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-07 16:49:10 +00:00
Final core package proper code style fixes
This commit is contained in:
@@ -14,6 +14,6 @@ public class Configuration {
|
|||||||
public static final String GET_SERVER_PROVIDER_INFO = "http://sdn.parabot.org/providers/getInformation.php?id=";
|
public static final String GET_SERVER_PROVIDER_INFO = "http://sdn.parabot.org/providers/getInformation.php?id=";
|
||||||
public static final String GET_BOT_VERSION = "http://bot.parabot.org/version.txt";
|
public static final String GET_BOT_VERSION = "http://bot.parabot.org/version.txt";
|
||||||
|
|
||||||
public static final double BOT_VERSION = 2.04; // BETA
|
public static final double BOT_VERSION = 2.05; // BETA
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,10 +24,11 @@ import org.parabot.core.classpath.ClassPath;
|
|||||||
*/
|
*/
|
||||||
public class ASMClassLoader extends ClassLoader {
|
public class ASMClassLoader extends ClassLoader {
|
||||||
|
|
||||||
private Map<String, Class<?>> classCache = new HashMap<String, Class<?>>();
|
private Map<String, Class<?>> classCache;
|
||||||
public ClassPath classPath = null;
|
public ClassPath classPath;
|
||||||
|
|
||||||
public ASMClassLoader(final ClassPath classPath) {
|
public ASMClassLoader(final ClassPath classPath) {
|
||||||
|
this.classCache = new HashMap<String, Class<?>>();
|
||||||
this.classPath = classPath;
|
this.classPath = classPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,13 +18,13 @@ import org.parabot.core.asm.interfaces.Injectable;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class AddGetterAdapter implements Opcodes, Injectable {
|
public class AddGetterAdapter implements Opcodes, Injectable {
|
||||||
private ClassNode into = null;
|
private ClassNode into;
|
||||||
private ClassNode fieldLocation = null;
|
private ClassNode fieldLocation;
|
||||||
private FieldNode fieldNode = null;
|
private FieldNode fieldNode;
|
||||||
private String methodName = null;
|
private String methodName;
|
||||||
private String returnDesc = null;
|
private String returnDesc;
|
||||||
private boolean staticField = false;
|
private boolean staticField;
|
||||||
private boolean staticMethod = false;
|
private boolean staticMethod;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ import org.parabot.core.asm.interfaces.Injectable;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class AddInterfaceAdapter implements Injectable {
|
public class AddInterfaceAdapter implements Injectable {
|
||||||
|
private static String accessorPackage;
|
||||||
|
|
||||||
private static String accessorPackage = null;
|
private ClassNode node;
|
||||||
private ClassNode node = null;
|
private String interfaceClass;
|
||||||
private String interfaceClass = null;
|
|
||||||
|
|
||||||
public AddInterfaceAdapter(ClassNode node, String interfaceClass) {
|
public AddInterfaceAdapter(ClassNode node, String interfaceClass) {
|
||||||
this.node = node;
|
this.node = node;
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ import org.parabot.core.asm.interfaces.Injectable;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class AddInvokerAdapter implements Opcodes, Injectable {
|
public class AddInvokerAdapter implements Opcodes, Injectable {
|
||||||
private ClassNode into = null;
|
private ClassNode into;
|
||||||
private ClassNode methodLocation = null;
|
private ClassNode methodLocation;
|
||||||
private MethodNode mn = null;
|
private MethodNode mn;
|
||||||
private String argsDesc = null;
|
private String argsDesc;
|
||||||
private String returnDesc = null;
|
private String returnDesc;
|
||||||
private String methodName = null;
|
private String methodName;
|
||||||
|
|
||||||
public AddInvokerAdapter(final ClassNode methodLocation,
|
public AddInvokerAdapter(final ClassNode methodLocation,
|
||||||
final ClassNode into, final MethodNode mn, final String argsDesc,
|
final ClassNode into, final MethodNode mn, final String argsDesc,
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ import org.parabot.core.asm.interfaces.Injectable;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class AddSetterAdapter implements Opcodes, Injectable {
|
public class AddSetterAdapter implements Opcodes, Injectable {
|
||||||
private ClassNode fieldLocation = null;
|
private ClassNode fieldLocation;
|
||||||
private ClassNode into = null;
|
private ClassNode into;
|
||||||
private FieldNode field = null;
|
private FieldNode field;
|
||||||
private String name = null;
|
private String name;
|
||||||
private String desc = null;
|
private String desc;
|
||||||
private boolean methodStatic = false;
|
private boolean methodStatic;
|
||||||
|
|
||||||
public AddSetterAdapter(ClassNode fieldLocation, ClassNode into,
|
public AddSetterAdapter(ClassNode fieldLocation, ClassNode into,
|
||||||
FieldNode field, String name, String desc, boolean methodStatic) {
|
FieldNode field, String name, String desc, boolean methodStatic) {
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ import org.parabot.core.asm.interfaces.Injectable;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class AddSuperAdapter implements Injectable {
|
public class AddSuperAdapter implements Injectable {
|
||||||
private ClassNode node = null;
|
private ClassNode node;
|
||||||
private String superClass = null;
|
private String superClass;
|
||||||
|
|
||||||
public AddSuperAdapter(final ClassNode node, final String superClass) {
|
public AddSuperAdapter(final ClassNode node, final String superClass) {
|
||||||
this.node = node;
|
this.node = node;
|
||||||
|
|||||||
@@ -14,13 +14,12 @@ import org.parabot.core.asm.interfaces.Injectable;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Getter implements Injectable {
|
public class Getter implements Injectable {
|
||||||
|
private ClassNode into;
|
||||||
private ClassNode into = null;
|
private ClassNode fieldLocation;
|
||||||
private ClassNode fieldLocation = null;
|
private FieldNode fieldNode;
|
||||||
private FieldNode fieldNode = null;
|
private String methodName;
|
||||||
private String methodName = null;
|
private String returnDesc;
|
||||||
private String returnDesc = null;
|
private boolean staticMethod;
|
||||||
private boolean staticMethod = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ import org.parabot.core.asm.interfaces.Injectable;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Invoker implements Injectable {
|
public class Invoker implements Injectable {
|
||||||
private ClassNode into = null;
|
private ClassNode into;
|
||||||
private ClassNode methodLocation = null;
|
private ClassNode methodLocation;
|
||||||
private MethodNode mn = null;
|
private MethodNode mn;
|
||||||
private String argsDesc = null;
|
private String argsDesc;
|
||||||
private String returnDesc = null;
|
private String returnDesc;
|
||||||
private String methodName = null;
|
private String methodName;
|
||||||
|
|
||||||
public Invoker(String methodLoc, String invMethName, String argsDesc,
|
public Invoker(String methodLoc, String invMethName, String argsDesc,
|
||||||
String returnDesc, String methodName) {
|
String returnDesc, String methodName) {
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ import org.parabot.core.asm.interfaces.Injectable;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Setter implements Injectable {
|
public class Setter implements Injectable {
|
||||||
private ClassNode fieldLocation = null;
|
private ClassNode fieldLocation;
|
||||||
private ClassNode into = null;
|
private ClassNode into;
|
||||||
private FieldNode field = null;
|
private FieldNode field;
|
||||||
private String name = null;
|
private String name;
|
||||||
private String desc = null;
|
private String desc;
|
||||||
private boolean methodStatic = false;
|
private boolean methodStatic;
|
||||||
|
|
||||||
public Setter(final String fieldLocation, String into, final String fieldName, final String methodName, final String desc, final boolean methodStatic) {
|
public Setter(final String fieldLocation, String into, final String fieldName, final String methodName, final String desc, final boolean methodStatic) {
|
||||||
this.fieldLocation = ASMUtils.getClass(fieldLocation);
|
this.fieldLocation = ASMUtils.getClass(fieldLocation);
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import org.parabot.core.asm.interfaces.Injectable;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Super implements Injectable {
|
public class Super implements Injectable {
|
||||||
private String className = null;
|
private String className;
|
||||||
private String superClassName = null;
|
private String superClassName;
|
||||||
|
|
||||||
public Super(String className, String superClassName) {
|
public Super(String className, String superClassName) {
|
||||||
this.className = className;
|
this.className = className;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class ScriptDescription {
|
|||||||
public String[] servers;
|
public String[] servers;
|
||||||
public String isVip;
|
public String isVip;
|
||||||
public String isPremium;
|
public String isPremium;
|
||||||
public int sdnId = -1;
|
public int sdnId;
|
||||||
public String jarName;
|
public String jarName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public final class AccountManager {
|
|||||||
private static boolean validated;
|
private static boolean validated;
|
||||||
private static AccountManager instance;
|
private static AccountManager instance;
|
||||||
|
|
||||||
private Account account = null;
|
private Account account;
|
||||||
|
|
||||||
private AccountManager() {
|
private AccountManager() {
|
||||||
|
|
||||||
|
|||||||
@@ -30,23 +30,14 @@ import javax.swing.border.EmptyBorder;
|
|||||||
* Non swing methods are thread safe.
|
* Non swing methods are thread safe.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
public class LogTextArea extends JList
|
public class LogTextArea extends JList {
|
||||||
{
|
|
||||||
private static final int MAX_ENTRIES = 100;
|
private static final int MAX_ENTRIES = 100;
|
||||||
private static final Rectangle BOTTOM_OF_WINDOW = new Rectangle(0, Integer.MAX_VALUE, 0, 0);
|
private static final Rectangle BOTTOM_OF_WINDOW = new Rectangle(0,
|
||||||
|
Integer.MAX_VALUE, 0, 0);
|
||||||
private static final long serialVersionUID = 0;
|
private static final long serialVersionUID = 0;
|
||||||
private final LogQueue logQueue = new LogQueue();
|
private static final Formatter formatter = new Formatter() {
|
||||||
private final LogAreaListModel model = new LogAreaListModel();
|
private final SimpleDateFormat dateFormat = new SimpleDateFormat(
|
||||||
private final Runnable scrollToBottom = new Runnable()
|
"hh:mm:ss");
|
||||||
{
|
|
||||||
public void run() {
|
|
||||||
scrollRectToVisible(LogTextArea.BOTTOM_OF_WINDOW);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private static final Formatter formatter = new Formatter()
|
|
||||||
{
|
|
||||||
private final SimpleDateFormat dateFormat = new SimpleDateFormat("hh:mm:ss");
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String format(final LogRecord record) {
|
public String format(final LogRecord record) {
|
||||||
@@ -55,30 +46,37 @@ public class LogTextArea extends JList
|
|||||||
final int maxLen = 16;
|
final int maxLen = 16;
|
||||||
final String append = "...";
|
final String append = "...";
|
||||||
|
|
||||||
return String.format("[%s] %-" + maxLen + "s %s %s", dateFormat.format(record.getMillis()), name.length() > maxLen ? name.substring(0, maxLen - append.length()) + append : name, record.getMessage(), throwableToString(record.getThrown()));
|
return String.format(
|
||||||
|
"[%s] %-" + maxLen + "s %s %s",
|
||||||
|
dateFormat.format(record.getMillis()),
|
||||||
|
name.length() > maxLen ? name.substring(0,
|
||||||
|
maxLen - append.length())
|
||||||
|
+ append : name, record.getMessage(),
|
||||||
|
throwableToString(record.getThrown()));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
private static final Formatter copyPasteFormatter = new LogFormatter(false);
|
||||||
|
|
||||||
|
private final LogQueue logQueue;
|
||||||
|
private final LogAreaListModel model;
|
||||||
|
private final Runnable scrollToBottom;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public LogTextArea() {
|
||||||
|
logQueue = new LogQueue();
|
||||||
|
model = new LogAreaListModel();
|
||||||
|
scrollToBottom = new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
scrollRectToVisible(LogTextArea.BOTTOM_OF_WINDOW);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static String throwableToString(final Throwable t) {
|
|
||||||
if (t != null) {
|
|
||||||
final Writer exception = new StringWriter();
|
|
||||||
final PrintWriter printWriter = new PrintWriter(exception);
|
|
||||||
t.printStackTrace(printWriter);
|
|
||||||
return exception.toString();
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Formatter copyPasteFormatter = new LogFormatter(false);
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public LogTextArea()
|
|
||||||
{
|
|
||||||
setModel(model);
|
setModel(model);
|
||||||
setCellRenderer(new Renderer());
|
setCellRenderer(new Renderer());
|
||||||
setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
|
setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
|
||||||
String fontName = Font.MONOSPACED;
|
String fontName = Font.MONOSPACED;
|
||||||
for (final Font font : GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts()) {
|
for (final Font font : GraphicsEnvironment
|
||||||
|
.getLocalGraphicsEnvironment().getAllFonts()) {
|
||||||
final String name = font.getName();
|
final String name = font.getName();
|
||||||
if (name.matches("Monaco|Consolas")) {
|
if (name.matches("Monaco|Consolas")) {
|
||||||
fontName = name;
|
fontName = name;
|
||||||
@@ -100,16 +98,17 @@ public class LogTextArea extends JList
|
|||||||
logQueue.queue(new WrappedLogRecord(logRecord));
|
logQueue.queue(new WrappedLogRecord(logRecord));
|
||||||
}
|
}
|
||||||
|
|
||||||
private class LogAreaListModel extends AbstractListModel
|
private class LogAreaListModel extends AbstractListModel {
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 0;
|
private static final long serialVersionUID = 0;
|
||||||
|
|
||||||
private List<WrappedLogRecord> records = new ArrayList<WrappedLogRecord>(LogTextArea.MAX_ENTRIES);
|
private List<WrappedLogRecord> records = new ArrayList<WrappedLogRecord>(
|
||||||
|
LogTextArea.MAX_ENTRIES);
|
||||||
|
|
||||||
public void addAllElements(final List<WrappedLogRecord> obj) {
|
public void addAllElements(final List<WrappedLogRecord> obj) {
|
||||||
records.addAll(obj);
|
records.addAll(obj);
|
||||||
if (getSize() > LogTextArea.MAX_ENTRIES) {
|
if (getSize() > LogTextArea.MAX_ENTRIES) {
|
||||||
records.subList(0, (getSize() - LogTextArea.MAX_ENTRIES)).clear();
|
records.subList(0, (getSize() - LogTextArea.MAX_ENTRIES))
|
||||||
|
.clear();
|
||||||
|
|
||||||
fireContentsChanged(this, 0, (getSize() - 1));
|
fireContentsChanged(this, 0, (getSize() - 1));
|
||||||
} else {
|
} else {
|
||||||
@@ -129,11 +128,11 @@ public class LogTextArea extends JList
|
|||||||
/**
|
/**
|
||||||
* Flushes every #FLUSH_RATE (milliseconds)
|
* Flushes every #FLUSH_RATE (milliseconds)
|
||||||
*/
|
*/
|
||||||
private class LogQueue implements Runnable
|
private class LogQueue implements Runnable {
|
||||||
{
|
|
||||||
public static final int FLUSH_RATE = 1000;
|
public static final int FLUSH_RATE = 1000;
|
||||||
private final Object lock = new Object();
|
private final Object lock = new Object();
|
||||||
private List<WrappedLogRecord> queue = new ArrayList<WrappedLogRecord>(100);
|
private List<WrappedLogRecord> queue = new ArrayList<WrappedLogRecord>(
|
||||||
|
100);
|
||||||
|
|
||||||
public void queue(final WrappedLogRecord record) {
|
public void queue(final WrappedLogRecord record) {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
@@ -166,13 +165,17 @@ public class LogTextArea extends JList
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Renderer implements ListCellRenderer
|
private static class Renderer implements ListCellRenderer {
|
||||||
{
|
|
||||||
private final Border EMPTY_BORDER = new EmptyBorder(1, 1, 1, 1);
|
private final Border EMPTY_BORDER = new EmptyBorder(1, 1, 1, 1);
|
||||||
private final Border SELECTED_BORDER = UIManager.getBorder("List.focusCellHighlightBorder");
|
private final Border SELECTED_BORDER = UIManager
|
||||||
private final Color DARK_GREEN = new Color(0, 0xcc, 0), DARK_RED = new Color(0xcc, 0, 0), DARK_PINK = new Color(0xff, 0, 0x66);
|
.getBorder("List.focusCellHighlightBorder");
|
||||||
|
private final Color DARK_GREEN = new Color(0, 0xcc, 0),
|
||||||
|
DARK_RED = new Color(0xcc, 0, 0), DARK_PINK = new Color(0xff,
|
||||||
|
0, 0x66);
|
||||||
|
|
||||||
public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) {
|
public Component getListCellRendererComponent(final JList list,
|
||||||
|
final Object value, final int index, final boolean isSelected,
|
||||||
|
final boolean cellHasFocus) {
|
||||||
if (!(value instanceof WrappedLogRecord)) {
|
if (!(value instanceof WrappedLogRecord)) {
|
||||||
return new JLabel();
|
return new JLabel();
|
||||||
}
|
}
|
||||||
@@ -183,7 +186,8 @@ public class LogTextArea extends JList
|
|||||||
result.setText(wlr.formatted);
|
result.setText(wlr.formatted);
|
||||||
result.setComponentOrientation(list.getComponentOrientation());
|
result.setComponentOrientation(list.getComponentOrientation());
|
||||||
result.setFont(list.getFont());
|
result.setFont(list.getFont());
|
||||||
result.setBorder(cellHasFocus || isSelected ? SELECTED_BORDER : EMPTY_BORDER);
|
result.setBorder(cellHasFocus || isSelected ? SELECTED_BORDER
|
||||||
|
: EMPTY_BORDER);
|
||||||
|
|
||||||
result.setForeground(Color.BLACK);
|
result.setForeground(Color.BLACK);
|
||||||
|
|
||||||
@@ -196,7 +200,9 @@ public class LogTextArea extends JList
|
|||||||
result.setForeground(DARK_PINK);
|
result.setForeground(DARK_PINK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wlr.record.getLevel() == Level.FINE || wlr.record.getLevel() == Level.FINER || wlr.record.getLevel() == Level.FINEST) {
|
if (wlr.record.getLevel() == Level.FINE
|
||||||
|
|| wlr.record.getLevel() == Level.FINER
|
||||||
|
|| wlr.record.getLevel() == Level.FINEST) {
|
||||||
result.setForeground(DARK_GREEN);
|
result.setForeground(DARK_GREEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,15 +227,14 @@ public class LogTextArea extends JList
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrap the log records so we can control the copy paste text (via #toString)
|
* Wrap the log records so we can control the copy paste text (via
|
||||||
|
* #toString)
|
||||||
*/
|
*/
|
||||||
private class WrappedLogRecord
|
private class WrappedLogRecord {
|
||||||
{
|
|
||||||
public final LogRecord record;
|
public final LogRecord record;
|
||||||
public final String formatted;
|
public final String formatted;
|
||||||
|
|
||||||
public WrappedLogRecord(final LogRecord record)
|
public WrappedLogRecord(final LogRecord record) {
|
||||||
{
|
|
||||||
this.record = record;
|
this.record = record;
|
||||||
formatted = LogTextArea.formatter.format(record);
|
formatted = LogTextArea.formatter.format(record);
|
||||||
}
|
}
|
||||||
@@ -239,4 +244,14 @@ public class LogTextArea extends JList
|
|||||||
return LogTextArea.copyPasteFormatter.format(record);
|
return LogTextArea.copyPasteFormatter.format(record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String throwableToString(final Throwable t) {
|
||||||
|
if (t != null) {
|
||||||
|
final Writer exception = new StringWriter();
|
||||||
|
final PrintWriter printWriter = new PrintWriter(exception);
|
||||||
|
t.printStackTrace(printWriter);
|
||||||
|
return exception.toString();
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ import org.w3c.dom.Node;
|
|||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
public class XMLHookParser extends HookParser {
|
public class XMLHookParser extends HookParser {
|
||||||
private boolean parsedInterfaces;
|
|
||||||
private Document doc;
|
private Document doc;
|
||||||
private HashMap<String, String> interfaceMap;
|
private HashMap<String, String> interfaceMap;
|
||||||
private HashMap<String, String> constants;
|
private HashMap<String, String> constants;
|
||||||
|
private boolean parsedInterfaces;
|
||||||
|
|
||||||
public XMLHookParser(HookFile hookFile) {
|
public XMLHookParser(HookFile hookFile) {
|
||||||
super(hookFile);
|
super(hookFile);
|
||||||
|
|||||||
@@ -32,14 +32,14 @@ import org.parabot.core.ui.utils.SwingUtil;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class LoginUI extends JFrame {
|
public class LoginUI extends JFrame {
|
||||||
|
|
||||||
private static final long serialVersionUID = 2032832552863466297L;
|
private static final long serialVersionUID = 2032832552863466297L;
|
||||||
private static LoginUI instance;
|
private static LoginUI instance;
|
||||||
|
private static AccountManager manager;
|
||||||
|
|
||||||
private JTextField txtUsername;
|
private JTextField txtUsername;
|
||||||
private JPasswordField txtPassword;
|
private JPasswordField txtPassword;
|
||||||
private JButton cmdLogin;
|
private JButton cmdLogin;
|
||||||
private JButton cmdRegister;
|
private JButton cmdRegister;
|
||||||
private static AccountManager manager;
|
|
||||||
|
|
||||||
public static final AccountManagerAccess MANAGER_FETCHER = new AccountManagerAccess() {
|
public static final AccountManagerAccess MANAGER_FETCHER = new AccountManagerAccess() {
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import java.awt.event.ActionListener;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class NetworkUI {
|
public class NetworkUI {
|
||||||
|
|
||||||
public JFrame frame;
|
public JFrame frame;
|
||||||
private JTextField proxyHostField;
|
private JTextField proxyHostField;
|
||||||
private JTextField proxyPortField;
|
private JTextField proxyPortField;
|
||||||
|
|||||||
@@ -27,14 +27,18 @@ import java.util.HashMap;
|
|||||||
public final class ScriptSelector extends JFrame {
|
public final class ScriptSelector extends JFrame {
|
||||||
public static ScriptParser parser;
|
public static ScriptParser parser;
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private HashMap<String, DefaultMutableTreeNode> categories = new HashMap<String, DefaultMutableTreeNode>();
|
|
||||||
private HashMap<String, ScriptDescription> format = new HashMap<String, ScriptDescription>();
|
private HashMap<String, DefaultMutableTreeNode> categories;
|
||||||
private DefaultMutableTreeNode root = new DefaultMutableTreeNode("Scripts");
|
private HashMap<String, ScriptDescription> format;
|
||||||
|
private DefaultMutableTreeNode root;
|
||||||
private DefaultTreeModel model;
|
private DefaultTreeModel model;
|
||||||
private final int WIDTH;
|
private final int WIDTH;
|
||||||
private final int HEIGHT;
|
private final int HEIGHT;
|
||||||
|
|
||||||
public ScriptSelector() {
|
public ScriptSelector() {
|
||||||
|
this.categories = new HashMap<String, DefaultMutableTreeNode>();
|
||||||
|
this.format = new HashMap<String, ScriptDescription>();
|
||||||
|
this.root = new DefaultMutableTreeNode("Scripts");
|
||||||
this.WIDTH = 640;
|
this.WIDTH = 640;
|
||||||
this.HEIGHT = 256 + 128;
|
this.HEIGHT = 256 + 128;
|
||||||
this.model = new DefaultTreeModel(root);
|
this.model = new DefaultTreeModel(root);
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public class ServerSelector extends JFrame {
|
|||||||
public static String initServer;
|
public static String initServer;
|
||||||
private static final long serialVersionUID = 5238720307271493899L;
|
private static final long serialVersionUID = 5238720307271493899L;
|
||||||
private static ServerSelector instance;
|
private static ServerSelector instance;
|
||||||
|
|
||||||
private JPanel panel;
|
private JPanel panel;
|
||||||
|
|
||||||
public static ServerSelector getInstance() {
|
public static ServerSelector getInstance() {
|
||||||
|
|||||||
@@ -32,12 +32,12 @@ public class BotToolbar extends JToolBar {
|
|||||||
private static final long serialVersionUID = 5373484845104212180L;
|
private static final long serialVersionUID = 5373484845104212180L;
|
||||||
private static BotToolbar instance;
|
private static BotToolbar instance;
|
||||||
private static Map<TabButton, Context> environments = new HashMap<TabButton, Context>();
|
private static Map<TabButton, Context> environments = new HashMap<TabButton, Context>();
|
||||||
|
|
||||||
private JButton tab;
|
private JButton tab;
|
||||||
private final JButton run;
|
private final JButton run;
|
||||||
private final JButton stop;
|
private final JButton stop;
|
||||||
|
private boolean runScript;
|
||||||
private boolean runScript = false;
|
private boolean pauseScript;
|
||||||
private boolean pauseScript = false;
|
|
||||||
|
|
||||||
public BotToolbar() {
|
public BotToolbar() {
|
||||||
this.run = new JButton();
|
this.run = new JButton();
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public class GamePanel extends JPanel {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private static GamePanel instance;
|
private static GamePanel instance;
|
||||||
private static VerboseLoader loader = VerboseLoader.get();
|
private static VerboseLoader loader = VerboseLoader.get();
|
||||||
|
|
||||||
public Context context;
|
public Context context;
|
||||||
|
|
||||||
private GamePanel() {
|
private GamePanel() {
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import org.parabot.core.logging.TextAreaLogHandler;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class LogArea extends JScrollPane {
|
public class LogArea extends JScrollPane {
|
||||||
|
|
||||||
private static final long serialVersionUID = 6571141103751675714L;
|
private static final long serialVersionUID = 6571141103751675714L;
|
||||||
private static LogTextArea logArea = new LogTextArea();
|
private static LogTextArea logArea = new LogTextArea();
|
||||||
private static LogArea instance;
|
private static LogArea instance;
|
||||||
|
|||||||
@@ -19,8 +19,9 @@ import org.parabot.core.ui.images.Images;
|
|||||||
*/
|
*/
|
||||||
public class VerboseLoader extends JPanel implements ProgressListener {
|
public class VerboseLoader extends JPanel implements ProgressListener {
|
||||||
private static final long serialVersionUID = 7412412644921803896L;
|
private static final long serialVersionUID = 7412412644921803896L;
|
||||||
private static VerboseLoader current = null;
|
private static VerboseLoader current;
|
||||||
private static String state = "Initializing loader...";
|
private static String state = "Initializing loader...";
|
||||||
|
|
||||||
private FontMetrics fontMetrics;
|
private FontMetrics fontMetrics;
|
||||||
private BufferedImage bot_image;
|
private BufferedImage bot_image;
|
||||||
private ProgressBar p;
|
private ProgressBar p;
|
||||||
|
|||||||
@@ -13,15 +13,15 @@ import javax.imageio.ImageIO;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public final class Images {
|
public final class Images {
|
||||||
private static final HashMap<String, BufferedImage> imageCache = new HashMap<String, BufferedImage>();
|
private static final HashMap<String, BufferedImage> IMAGE_CACHE = new HashMap<String, BufferedImage>();
|
||||||
|
|
||||||
public static BufferedImage getResource(final String resource) {
|
public static BufferedImage getResource(final String resource) {
|
||||||
if(imageCache.containsKey(resource)) {
|
if(IMAGE_CACHE.containsKey(resource)) {
|
||||||
return imageCache.get(resource);
|
return IMAGE_CACHE.get(resource);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
final BufferedImage img = ImageIO.read(Images.class.getResourceAsStream(resource));
|
final BufferedImage img = ImageIO.read(Images.class.getResourceAsStream(resource));
|
||||||
imageCache.put(resource, img);
|
IMAGE_CACHE.put(resource, img);
|
||||||
return img;
|
return img;
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
throw new RuntimeException("Failed to load image from resource. " + t.getMessage());
|
throw new RuntimeException("Failed to load image from resource. " + t.getMessage());
|
||||||
|
|||||||
@@ -19,8 +19,9 @@ import java.awt.event.MouseMotionListener;
|
|||||||
*/
|
*/
|
||||||
public class ServerWidget extends JPanel implements MouseListener,
|
public class ServerWidget extends JPanel implements MouseListener,
|
||||||
MouseMotionListener {
|
MouseMotionListener {
|
||||||
public ServerDescription desc;
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public ServerDescription desc;
|
||||||
private String name;
|
private String name;
|
||||||
private boolean hovered;
|
private boolean hovered;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user