mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-07 08:39:12 +00:00
Merge branch 'development' into bugfix/getsystemprop
This commit is contained in:
@@ -164,7 +164,6 @@ public class Context {
|
|||||||
* Loads the game
|
* Loads the game
|
||||||
*/
|
*/
|
||||||
public void load() {
|
public void load() {
|
||||||
BotUI.getInstance().getJMenuBar().remove(2);
|
|
||||||
Core.verbose(TranslationHelper.translate("PARSING_SERVER_JAR"));
|
Core.verbose(TranslationHelper.translate("PARSING_SERVER_JAR"));
|
||||||
serverProvider.init();
|
serverProvider.init();
|
||||||
serverProvider.parseJar();
|
serverProvider.parseJar();
|
||||||
|
|||||||
@@ -34,9 +34,12 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener,
|
|||||||
private static BotUI instance;
|
private static BotUI instance;
|
||||||
private static JDialog dialog;
|
private static JDialog dialog;
|
||||||
|
|
||||||
private JMenuItem run, pause, stop;
|
private JMenuBar menuBar;
|
||||||
|
private JMenu features, scripts, file;
|
||||||
|
private JMenuItem run, pause, stop, cacheClear, notifications;
|
||||||
private boolean runScript, pauseScript;
|
private boolean runScript, pauseScript;
|
||||||
|
|
||||||
|
|
||||||
public BotUI(String username, String password) {
|
public BotUI(String username, String password) {
|
||||||
if (instance != null) {
|
if (instance != null) {
|
||||||
throw new IllegalStateException("BotUI already created");
|
throw new IllegalStateException("BotUI already created");
|
||||||
@@ -74,11 +77,11 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener,
|
|||||||
|
|
||||||
|
|
||||||
private void createMenu() {
|
private void createMenu() {
|
||||||
JMenuBar menuBar = new JMenuBar();
|
menuBar = new JMenuBar();
|
||||||
|
|
||||||
JMenu file = new JMenu("File");
|
file = new JMenu("File");
|
||||||
JMenu scripts = new JMenu("Script");
|
scripts = new JMenu("Script");
|
||||||
JMenu features = new JMenu("Features");
|
features = new JMenu("Features");
|
||||||
|
|
||||||
JMenuItem screenshot = new JMenuItem("Create screenshot");
|
JMenuItem screenshot = new JMenuItem("Create screenshot");
|
||||||
JMenuItem proxy = new JMenuItem("Network");
|
JMenuItem proxy = new JMenuItem("Network");
|
||||||
@@ -104,10 +107,10 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener,
|
|||||||
stop.setEnabled(false);
|
stop.setEnabled(false);
|
||||||
stop.setIcon(new ImageIcon(Images.getResource("/storage/images/stop.png")));
|
stop.setIcon(new ImageIcon(Images.getResource("/storage/images/stop.png")));
|
||||||
|
|
||||||
JMenuItem cacheClear = new JMenuItem("Clear cache");
|
cacheClear = new JMenuItem("Clear cache");
|
||||||
cacheClear.setIcon(new ImageIcon(Images.getResource("/storage/images/trash.png")));
|
cacheClear.setIcon(new ImageIcon(Images.getResource("/storage/images/trash.png")));
|
||||||
|
|
||||||
JMenuItem notifications = new JMenuItem("Notifications");
|
notifications = new JMenuItem("Notifications");
|
||||||
notifications.setIcon(new ImageIcon(Images.getResource("/storage/images/bell.png")));
|
notifications.setIcon(new ImageIcon(Images.getResource("/storage/images/bell.png")));
|
||||||
|
|
||||||
screenshot.addActionListener(this);
|
screenshot.addActionListener(this);
|
||||||
@@ -341,4 +344,23 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener,
|
|||||||
public void windowOpened(WindowEvent arg0) {
|
public void windowOpened(WindowEvent arg0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JMenu getFeatures() {
|
||||||
|
return features;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JMenu getScripts() {
|
||||||
|
return scripts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JMenu getFile() {
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JMenuItem getCacheClear() {
|
||||||
|
return cacheClear;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JMenuItem getNotifications() {
|
||||||
|
return notifications;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,39 +1,36 @@
|
|||||||
package org.parabot.environment.servers.executers;
|
package org.parabot.environment.servers.executers;
|
||||||
|
|
||||||
import org.parabot.core.Context;
|
import org.parabot.core.Context;
|
||||||
import org.parabot.core.Core;
|
import org.parabot.core.ui.BotUI;
|
||||||
import org.parabot.core.parsers.randoms.RandomParser;
|
|
||||||
import org.parabot.core.ui.components.PaintComponent;
|
import org.parabot.core.ui.components.PaintComponent;
|
||||||
import org.parabot.environment.servers.ServerProvider;
|
import org.parabot.environment.servers.ServerProvider;
|
||||||
|
|
||||||
import java.io.PrintStream;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Executes a server provider
|
* Executes a server provider
|
||||||
*
|
*
|
||||||
* @author Everel
|
* @author Everel
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public abstract class ServerExecuter {
|
public abstract class ServerExecuter {
|
||||||
|
|
||||||
public abstract void run();
|
public abstract void run();
|
||||||
|
|
||||||
public void finalize(final ServerProvider provider, final String serverName) {
|
public void finalize(final ServerProvider provider, final String serverName) {
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
Context context = Context.getInstance(provider);
|
BotUI.getInstance().getCacheClear().setEnabled(false);
|
||||||
context.load();
|
|
||||||
PaintComponent.getInstance().startPainting(context);
|
|
||||||
|
|
||||||
Context.getInstance().getRandomHandler().init();
|
Context context = Context.getInstance(provider);
|
||||||
} catch (Throwable t) {
|
context.load();
|
||||||
t.printStackTrace();
|
PaintComponent.getInstance().startPainting(context);
|
||||||
}
|
|
||||||
}
|
Context.getInstance().getRandomHandler().init();
|
||||||
}).start();
|
} catch (Throwable t) {
|
||||||
}
|
t.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user