mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-03 16:49:10 +00:00
Fixed my wrong file placement
This commit is contained in:
@@ -163,6 +163,7 @@ public class Context {
|
||||
* Loads the game
|
||||
*/
|
||||
public void load() {
|
||||
BotUI.getInstance().getJMenuBar().remove(2);
|
||||
Core.verbose("Parsing server jar...");
|
||||
serverProvider.init();
|
||||
serverProvider.parseJar();
|
||||
|
||||
@@ -12,6 +12,7 @@ import org.parabot.environment.scripts.randoms.Random;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
@@ -25,7 +26,7 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener,
|
||||
private static BotUI instance;
|
||||
private static JDialog dialog;
|
||||
|
||||
private JMenuItem run, pause, stop;
|
||||
private JMenuItem run, pause, stop, cacheClear;
|
||||
private boolean runScript, pauseScript;
|
||||
|
||||
public BotUI(String username, String password) {
|
||||
@@ -64,11 +65,34 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener,
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static boolean deleteDirectory(File directory) {
|
||||
if (directory.exists()) {
|
||||
File[] files = directory.listFiles();
|
||||
if (files != null) {
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
if (files[i].isDirectory()) {
|
||||
deleteDirectory(files[i]);
|
||||
} else {
|
||||
files[i].delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (directory.delete());
|
||||
}
|
||||
|
||||
public static void createDirectory(File directory) {
|
||||
if (!directory.exists()) {
|
||||
directory.mkdir();
|
||||
}
|
||||
}
|
||||
|
||||
private void createMenu() {
|
||||
JMenuBar menuBar = new JMenuBar();
|
||||
|
||||
JMenu file = new JMenu("File");
|
||||
JMenu scripts = new JMenu("Script");
|
||||
JMenu features = new JMenu("Features");
|
||||
|
||||
JMenuItem screenshot = new JMenuItem("Create screenshot");
|
||||
JMenuItem proxy = new JMenuItem("Network");
|
||||
@@ -94,6 +118,9 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener,
|
||||
stop.setEnabled(false);
|
||||
stop.setIcon(new ImageIcon(Images.getResource("/storage/images/stop.png")));
|
||||
|
||||
cacheClear = new JMenuItem("Clear cache");
|
||||
cacheClear.setIcon(new ImageIcon(Images.getResource("/storage/images/trash.png")));
|
||||
|
||||
screenshot.addActionListener(this);
|
||||
proxy.addActionListener(this);
|
||||
randoms.addActionListener(this);
|
||||
@@ -101,6 +128,7 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener,
|
||||
logger.addActionListener(this);
|
||||
explorer.addActionListener(this);
|
||||
exit.addActionListener(this);
|
||||
cacheClear.addActionListener(this);
|
||||
|
||||
run.addActionListener(this);
|
||||
pause.addActionListener(this);
|
||||
@@ -118,8 +146,12 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener,
|
||||
scripts.add(pause);
|
||||
scripts.add(stop);
|
||||
|
||||
features.add(cacheClear);
|
||||
|
||||
menuBar.add(file);
|
||||
menuBar.add(scripts);
|
||||
menuBar.add(features);
|
||||
|
||||
|
||||
setJMenuBar(menuBar);
|
||||
}
|
||||
@@ -173,7 +205,7 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener,
|
||||
BotUI.getInstance().revalidate();
|
||||
if (!Logger.getInstance().isClearable()) {
|
||||
Logger.getInstance().setClearable();
|
||||
} else if(Logger.getInstance().isClearable() && !Logger.getInstance().isVisible()) {
|
||||
} else if (Logger.getInstance().isClearable() && !Logger.getInstance().isVisible()) {
|
||||
Logger.clearLogger();
|
||||
Logger.addMessage("Logger started", false);
|
||||
}
|
||||
@@ -181,6 +213,10 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener,
|
||||
case "Disable dialog":
|
||||
BotDialog.getInstance().setVisible(!dialog.isVisible());
|
||||
break;
|
||||
case "Clear cache":
|
||||
deleteDirectory(new File("C:/Users/Eric/Documents/Parabot/cache"));
|
||||
createDirectory(new File("C:/Users/Eric/Documents/Parabot/cache"));
|
||||
break;
|
||||
default:
|
||||
System.out.println("Invalid command: " + command);
|
||||
}
|
||||
@@ -274,4 +310,5 @@ public class BotUI extends JFrame implements ActionListener, ComponentListener,
|
||||
@Override
|
||||
public void windowOpened(WindowEvent arg0) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.awt.image.RescaleOp;
|
||||
/**
|
||||
* An informative JPanel which tells the user what bot is doing
|
||||
*
|
||||
* @author Everel, EmmaStone
|
||||
* @author Everel
|
||||
*/
|
||||
public class VerboseLoader extends JPanel implements ProgressListener {
|
||||
private static final long serialVersionUID = 7412412644921803896L;
|
||||
@@ -144,6 +144,7 @@ public class VerboseLoader extends JPanel implements ProgressListener {
|
||||
login.setOpaque(false);
|
||||
|
||||
login.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (manager.login(userInput.getText(), passInput.getText(), false)) {
|
||||
@@ -156,17 +157,17 @@ public class VerboseLoader extends JPanel implements ProgressListener {
|
||||
|
||||
});
|
||||
|
||||
loginPanel.add(Box.createRigidArea(new Dimension(0, 8)));
|
||||
loginPanel.add(Box.createRigidArea(new Dimension(0, 5)));
|
||||
loginPanel.add(usernameLabel);
|
||||
loginPanel.add(Box.createRigidArea(new Dimension(0, 4)));
|
||||
loginPanel.add(Box.createRigidArea(new Dimension(0, 5)));
|
||||
loginPanel.add(userInput);
|
||||
loginPanel.add(Box.createRigidArea(new Dimension(0, 4)));
|
||||
loginPanel.add(Box.createRigidArea(new Dimension(0, 5)));
|
||||
loginPanel.add(passwordLabel);
|
||||
loginPanel.add(Box.createRigidArea(new Dimension(0, 4)));
|
||||
loginPanel.add(Box.createRigidArea(new Dimension(0, 5)));
|
||||
loginPanel.add(passInput);
|
||||
loginPanel.add(Box.createRigidArea(new Dimension(0, 2)));
|
||||
loginPanel.add(Box.createRigidArea(new Dimension(0, 5)));
|
||||
loginPanel.add(login);
|
||||
loginPanel.add(Box.createRigidArea(new Dimension(0, 4)));
|
||||
loginPanel.add(Box.createRigidArea(new Dimension(0, 5)));
|
||||
|
||||
add(loginPanel, new GridBagConstraints());
|
||||
}
|
||||
@@ -204,10 +205,10 @@ public class VerboseLoader extends JPanel implements ProgressListener {
|
||||
g.setStroke(new BasicStroke(5));
|
||||
g.setPaint(Color.WHITE);
|
||||
|
||||
g.draw(new Line2D.Float(0, 1, this.getWidth(), 1)); //TOP
|
||||
g.draw(new Line2D.Float(0, 0, 0, 120)); //LEFT
|
||||
g.draw(new Line2D.Float(0, 120, this.getWidth(), 120)); //BOTTOM
|
||||
g.draw(new Line2D.Float(this.getWidth() - 6, 0, this.getWidth() - 6, 120)); //RIGHT
|
||||
g.draw(new Line2D.Float(0, 0, this.getWidth(), 0));
|
||||
g.draw(new Line2D.Float(0, 0, 0, 120));
|
||||
g.draw(new Line2D.Float(0, 120, this.getWidth(), 120));
|
||||
g.draw(new Line2D.Float(this.getWidth() - 6, 0, this.getWidth() - 6, 120));
|
||||
|
||||
g.setColor(Color.white);
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
Reference in New Issue
Block a user