Guest
Public paste!

Untitled

By: a guest | Mar 20th, 2010 | Syntax: None | Size: 90.42 KB | Hits: 68 | Expires: Never
Copy text to clipboard
  1. import java.awt.*;
  2. import com.speljohan.rsbot.script.*;
  3. import java.awt.Color;
  4. import java.awt.Graphics;
  5. import java.awt.Point;
  6. import java.util.Map;
  7. import com.speljohan.rsbot.bot.Bot;
  8. import com.speljohan.rsbot.event.events.ServerMessageEvent;
  9. import com.speljohan.rsbot.event.listeners.PaintListener;
  10. import com.speljohan.rsbot.event.listeners.ServerMessageListener;
  11. import com.speljohan.rsbot.script.Script;
  12. import com.speljohan.rsbot.script.wrappers.RSInterface;
  13. import com.speljohan.rsbot.script.wrappers.RSObject;
  14. import com.speljohan.rsbot.script.wrappers.RSTile;
  15. import java.io.*;
  16. import java.net.*;
  17. import javax.swing.JOptionPane;
  18. import javax.swing.JFileChooser;
  19. import java.util.Properties;
  20. import java.awt.event.ActionEvent;
  21. import java.awt.event.ActionListener;
  22. import java.io.File;
  23. import java.io.FileInputStream;
  24. import java.io.FileOutputStream;
  25. import java.io.IOException;
  26. import java.lang.reflect.Method;
  27. import java.util.ArrayList;
  28. import java.util.List;
  29. import java.util.logging.Level;
  30. import com.speljohan.rsbot.plugin.NonPluginClass;
  31.  
  32.  
  33. public class WorldWideMiner extends Script implements PaintListener,
  34.                                                      ServerMessageListener{
  35.  
  36.     // ANIMATIONS
  37.     public final int MINING_BRONZE = 625;
  38.     public final int MINING_IRON = 626;
  39.     public final int MINING_STEEL = 627;
  40.     public final int MINING_MITHRIL = 629;
  41.     public final int MINING_ADAMANT = 628;
  42.     public final int MINING_RUNE = 624;
  43.  
  44.     // GENERAL ROCKS AND PICKAXES
  45.     public int rockOne[];
  46.     public int rockTwo[];
  47.     public int rockThree[];
  48.     public int[] Copper = {11938, 11936, 11963, 11937, 9709, 9708, 9710, 11960,
  49.                            11962, 11961, 31080, 31082};
  50.     public int[] Tin = {11935, 11934, 11933, 11959, 11957, 11959, 11958, 9714,
  51.                         9716, 31079, 31077, 31078};
  52.     public int[] Gold = {37312, 37310, 9722, 9720, 15505, 15503, 11185, 11184,
  53.                          11183, 9720, 9722, 37313, 31065, 31066};
  54.     public int[] Silver = {37305, 37304, 37306, 9714, 9716, 9713, 11950, 11949,
  55.                            11948, 11950};
  56.     public int[] Mithril = {11942, 11944, 11943, 32438, 32439, 31086, 31087, 31088};
  57.     public int[] Adamant = {11939, 11941, 32435, 32436, 11940, 31083, 31084,
  58.                             31085, 31083};
  59.     public int[] Clay = {711, 9713, 15503, 15504, 15505, 31062, 31063};
  60.     public int[] Coal = {11930, 11931, 11932, 11930, 11963, 11964, 2096, 2097,
  61.                          14850, 14851, 14852, 32426, 32426, 31068, 31069, 31070,
  62.                          31068};
  63.     public int[] Sandstone = {10946};
  64.     public int[] Granite = {10947};
  65.     public int[] Iron = {2093, 2093, 2092, 9717, 9719, 9717, 9718, 11956, 11955,
  66.                          11954, 37307, 37309, 31072, 31073, 31071};
  67.     public int[] Runite = {451};
  68.     public int[] axes = { 1265, 1275, 1269, 1271, 1273, 1267};
  69.  
  70.     // OTHER MINING STUFF
  71.     public String Place;
  72.     public int tries = 0;
  73.     public int bankID;
  74.     public int rockID;
  75.     public boolean bankrocks;
  76.     public boolean power;
  77.     public final int xx1 = random(575,580);
  78.     public final int yy1 = random(379,383);
  79.     public final int xx2 = random(540,545);
  80.     public final int yy2 = random(416,424);
  81.     public final int xx3 = random(575,580);
  82.     public final int yy3 = random(402,407);
  83.     public final int xx4 = random(540,545);
  84.     public final int yy4 = random(446,449);
  85.     public final int xx5 = random(575,580);
  86.     public final int yy5 = random(440,445);
  87.     public final int xx6 = random(540,545);
  88.     public final int yy6 = random(458,463);
  89.  
  90.     // MINING GUILD STUFF
  91.     public RSTile[] bankToLadder = new RSTile[] {new RSTile(3012, 3355),
  92.                                    new RSTile(3023, 3359),
  93.                                    new RSTile(3026, 3349),
  94.                                    new RSTile(3030, 3338),
  95.                                    new RSTile(3022, 3338)};
  96.     public RSTile ladderTile = new RSTile(3019, 3337);
  97.     public RSTile ladderLoc = new RSTile(3019, 3338);
  98.     public RSTile ladder;
  99.     public int downLadderID = 2113;
  100.     public RSTile[] ladderToMine = new RSTile[] {new RSTile(3019, 9737),
  101.                                    new RSTile(3026, 9737),
  102.                                    new RSTile(3037, 9737)};
  103.     public RSTile[] mineToLadder = reversePath(ladderToMine);
  104.     public RSTile ladderTile2 = new RSTile(3019, 9737);
  105.     public RSTile ladderLoc2 = new RSTile(3019, 9738);
  106.     public int upLadderID = 30941;
  107.     public RSTile[] ladderToBank = reversePath(bankToLadder);
  108.  
  109.     // TILES AND PATHS
  110.     public RSTile[] toBank;
  111.         public RSTile[] toPlace;
  112.     public RSTile returnTo;
  113.     public RSTile runTo;
  114.     public RSTile playerPos;
  115.     public RSTile Rock;
  116.     public RSTile Bank;
  117.     public RSTile bankTile;
  118.  
  119.     // PAINT STUFF
  120.     public long startTime = System.currentTimeMillis();
  121.     public int startLevel = 0;
  122.     public int expgain = 0;
  123.         public int tinprice = 34;
  124.         public int copperprice = 72;
  125.         public int clayprice = 100;
  126.         public int ironprice = 100;
  127.         public int silverprice = 186;
  128.         public int coalprice = 175;
  129.         public int goldprice = 456;
  130.         public int mithprice = 211;
  131.         public int adamantprice = 1030;
  132.     public String name = "";
  133.     public String status = "";
  134.     public double x1;
  135.     public String rockOne1;
  136.     public String rockTwo2;
  137.     public String rockThree3;
  138.     public int mined = 0;
  139.     public int gem = 0;
  140.     public double exp = 0;
  141.         public double price = 0;
  142.     public int roll = 0;
  143.  
  144.     // OTHER
  145.     public boolean startScript = false;
  146.     private final Settings settings = new Settings();
  147.     private final String SETTINGS_FILE_NAME = "WorldWideMinerSettings.ini";
  148.         // Variables declaration - do not modify
  149.     private javax.swing.JCheckBox chkSettings;
  150.     private javax.swing.JCheckBox chkthird;
  151.     private javax.swing.JComboBox firstRock;
  152.     private javax.swing.JButton jButton1;
  153.     private javax.swing.JButton jButton2;
  154.     private javax.swing.JButton jButton3;
  155.     private javax.swing.JLabel jLabel1;
  156.     private javax.swing.JLabel jLabel10;
  157.     private javax.swing.JLabel jLabel11;
  158.     private javax.swing.JLabel jLabel12;
  159.     private javax.swing.JLabel jLabel13;
  160.     private javax.swing.JLabel jLabel14;
  161.     private javax.swing.JLabel jLabel15;
  162.     private javax.swing.JLabel jLabel16;
  163.     private javax.swing.JLabel jLabel17;
  164.     private javax.swing.JLabel jLabel18;
  165.     private javax.swing.JLabel jLabel19;
  166.     private javax.swing.JLabel jLabel2;
  167.     private javax.swing.JLabel jLabel20;
  168.     private javax.swing.JLabel jLabel21;
  169.     private javax.swing.JLabel jLabel22;
  170.     private javax.swing.JLabel jLabel23;
  171.     private javax.swing.JLabel jLabel24;
  172.     private javax.swing.JLabel jLabel25;
  173.     private javax.swing.JLabel jLabel26;
  174.     private javax.swing.JLabel jLabel27;
  175.     private javax.swing.JLabel jLabel28;
  176.     private javax.swing.JLabel jLabel29;
  177.     private javax.swing.JLabel jLabel3;
  178.     private javax.swing.JLabel jLabel30;
  179.     private javax.swing.JLabel jLabel31;
  180.     private javax.swing.JLabel jLabel32;
  181.     private javax.swing.JLabel jLabel33;
  182.     private javax.swing.JLabel jLabel34;
  183.     private javax.swing.JLabel jLabel35;
  184.     private javax.swing.JLabel jLabel36;
  185.     private javax.swing.JLabel jLabel37;
  186.     private javax.swing.JLabel jLabel38;
  187.     private javax.swing.JLabel jLabel4;
  188.     private javax.swing.JLabel jLabel5;
  189.     private javax.swing.JLabel jLabel6;
  190.     private javax.swing.JLabel jLabel7;
  191.     private javax.swing.JLabel jLabel8;
  192.     private javax.swing.JLabel jLabel9;
  193.     private javax.swing.JPanel jPanel1;
  194.     private javax.swing.JPanel jPanel2;
  195.     private javax.swing.JPanel jPanel3;
  196.     private javax.swing.JSeparator jSeparator1;
  197.     private javax.swing.JSeparator jSeparator2;
  198.     private javax.swing.JSeparator jSeparator3;
  199.     private javax.swing.JSeparator jSeparator4;
  200.     private javax.swing.JSeparator jSeparator6;
  201.     private javax.swing.JSeparator jSeparator7;
  202.     private javax.swing.JTabbedPane jTabbedPane1;
  203.     private javax.swing.JComboBox mineLocation;
  204.     private javax.swing.JComboBox secondRock;
  205.     private javax.swing.JComboBox thirdRock;
  206.     private javax.swing.JLabel thirdRockLabel;
  207.  
  208.         // GET STUFF
  209.     public String getName(){
  210.                 return "World-Wide-Miner";
  211.         }
  212.  
  213.         public String getAuthor(){
  214.                 return "Sean + Hieroglyphics";
  215.         }
  216.  
  217.         public String getScriptCategory(){
  218.                 return "Mining";
  219.         }
  220.  
  221.         public double getVersion(){
  222.                 return 1.75;
  223.         }
  224.         public String getScriptDescription() {
  225.                 String html = "<html>";
  226.                 html += "<body>";
  227.                 html += "<center>";
  228.                 html += "<b><font size=\"5\" color=\"black\">" + getName() + "</font></b>";
  229.                 html += "<br></br>";
  230.                 html += "<font size=\"4\" color=\"black\">by Sean, Updated by Hieroglyphics<br></b></font>";
  231.                 html += "<br></br>";
  232.                 html += "<font size=\"3\" color=\"black\"><b> </b>All Options are set on the GUI</b></font>";
  233.                 html += "</center></body>";
  234.                 html += "</html>";
  235.                 return (html);
  236.         }
  237.  
  238.  
  239.     public void onRepaint(Graphics render) {
  240.         long millis = System.currentTimeMillis() - startTime;
  241.         long hours = millis / (1000 * 60 * 60);
  242.         millis -= hours * (1000 * 60 * 60);
  243.         long minutes = millis / (1000 * 60);
  244.         millis -= minutes * (1000 * 60);
  245.         long seconds = millis / 1000;
  246.         long minutes2 = minutes + (hours * 60);
  247.  
  248.         float rocksec = 0;
  249.         if ((minutes > 0 || hours > 0 || seconds > 0) && exp > 0) {
  250.             rocksec = ((float) mined)/(float)(seconds + (minutes*60) + (hours*60*60));
  251.         }
  252.         float rockmin = rocksec * 60;
  253.         float rockhour = rockmin * 60;
  254.  
  255.  
  256.         int LevelChange = skills.getCurrentSkillLevel(STAT_MINING) - startLevel;
  257.         if(startScript){
  258.             render.setColor(new Color(215, 218, 231, 85));
  259.             render.fill3DRect(4, 115, 228, 223, true); //4, 133, 210, 205
  260.             render.setColor(Color.black);
  261.             render.setFont(new Font("sansserif", Font.BOLD, 12));
  262.             render.drawString("WWM - Hieroglyphics Style", 7, 134);
  263.             render.setColor(Color.cyan);
  264.             render.drawString("WWM - Hieroglyphics Style", 8, 133);
  265.             render.setColor(Color.black);
  266.             render.setFont(new Font("sansserif", Font.PLAIN, 12));
  267.             render.drawString("Time running: " + hours + " hrs " + minutes + " mins "
  268.                               + seconds + " secs", 7, 151);
  269.             if(bankrocks){
  270.                 render.drawString("Banking: On", 7, 169);
  271.             }else if(power){
  272.                 render.drawString("Banking: Off", 7, 169);
  273.             }
  274.             render.drawString("Mining Location: " + Place, 7, 187);
  275.             if(rockOne1.equals(rockTwo2) && rockOne1.equals(rockThree3)){
  276.                 render.drawString("Currently Mining: " + rockOne1, 7, 205);
  277.             }else if(!rockOne1.equals(rockTwo2) && rockOne1.equals(rockThree3)){
  278.                 render.drawString("Currently Mining: " + rockOne1 + ", " +
  279.                                     rockTwo2, 7, 205);
  280.             }else{
  281.                 render.drawString("Currently Mining: " + rockOne1 + ", " +
  282.                                     rockTwo2 + ", " + rockThree3, 7, 205);
  283.             }
  284.             render.drawString("Rocks Mined: " + mined, 7, 223);
  285.             render.drawString("Mined per hour: " + (int)rockhour + " Rocks", 7, 241);
  286.             render.drawString("Exp Gained: " + exp, 7, 259);
  287.                         render.drawString("Money Gained: " + price, 7, 277);
  288.             render.drawString("Levels Gained: " + LevelChange, 7, 295);
  289.             render.drawString("Gems found: " + gem, 7, 313);
  290.             render.setColor(Color.cyan);
  291.             render.drawString("Status: " + status, 7, 331);
  292.         }
  293.         }
  294.  
  295. class Settings implements NonPluginClass {
  296.  
  297.                 boolean thirdRockCheck = true;
  298.         boolean save = true;
  299.                 String location = "";
  300.                 String rock1 = "";
  301.         String rock2 = "";
  302.         String rock3 = "";
  303.                 String filename = "WorldWideMinerSettings.ini";
  304.  
  305.                 public Settings() {
  306.                 }
  307.  
  308.                 public String booleanToString(final boolean a) {
  309.                         if (a) {
  310.                                 return "true";
  311.                         } else {
  312.                                 return "false";
  313.                         }
  314.                 }
  315.  
  316.                 public boolean extractBoolean(final String text) {
  317.                         return text.equals("true");
  318.                 }
  319.  
  320.                 public int[] extractIntegers(String text) {
  321.                         int[] ints = null;
  322.                         try {
  323.                                 text = text.replaceAll(" ", "");
  324.                                 final String[] strInts = text.split(",");
  325.                                 ints = new int[strInts.length];
  326.                                 for (int a = 0; a < strInts.length; a++) {
  327.                                         ints[a] = Integer.parseInt(strInts[a]);
  328.                                 }
  329.                         } catch (final Exception e) {
  330.                         }
  331.                         return ints;
  332.                 }
  333.  
  334.                 public String[] extractStrings(final String text) {
  335.                         return text.split(",");
  336.                 }
  337.  
  338.                 public String getSetting(final String settingName) {
  339.                         try {
  340.                                 final Properties p = new Properties();
  341.                                 p.load(new FileInputStream(filename));
  342.                                 return p.getProperty(settingName);
  343.                         } catch (final IOException ioe) {
  344.                 log("Error 'getSetting'  " + ioe);
  345.                                 return "";
  346.                         }
  347.                 }
  348.  
  349.                 public String[][] getSettingsArray() {
  350.                         final ArrayList<String[]> settingsArray = new ArrayList<String[]>();
  351.  
  352.                         settingsArray
  353.                                         .add(new String[] { "LOCATION", location });
  354.                         settingsArray.add(new String[] { "ROCKONE",
  355.                                         rock1 });
  356.                         settingsArray.add(new String[] { "ROCKTWO",
  357.                                         rock2 });
  358.             settingsArray.add(new String[] { "ROCKTHREECHECK",
  359.                                         booleanToString(thirdRockCheck) });
  360.             settingsArray.add(new String[] { "SAVE",
  361.                                         booleanToString(save) });
  362.                         if (thirdRockCheck) {
  363.                                 settingsArray.add(new String[] { "ROCKTHREE",
  364.                                                 rock3 });
  365.                         }
  366.                        
  367.                         final String[][] stringArray = new String[settingsArray.size()][2];
  368.                         for (int a = 0; a < settingsArray.size(); a++) {
  369.                                 stringArray[a][0] = settingsArray.get(a)[0];
  370.                                 stringArray[a][1] = settingsArray.get(a)[1];
  371.                         }
  372.  
  373.                         return stringArray;
  374.                 }
  375.  
  376.                 public String intArrayToString(final int[] array) {
  377.                         String intArray = null;
  378.                         try {
  379.                                 if (array.length > 0) {
  380.                                         intArray = "";
  381.                                         for (int a = 0; a < array.length; a++) {
  382.                                                 if (array[a] != 0) {
  383.                                                         intArray += array[a];
  384.                                                         if (a != array.length - 1) {
  385.                                                                 intArray += ",";
  386.                                                         }
  387.                                                 }
  388.                                         }
  389.                                         return intArray;
  390.                                 }
  391.                         } catch (final Exception e) {
  392.                         }
  393.                         return "";
  394.                 }
  395.  
  396.                 public void saveSettings(final String[][] settings,
  397.                                 final String filename) {
  398.                         try {
  399.                                 final Properties p = new Properties();
  400.                                 final File file = new File(filename);
  401.                                 file.createNewFile();
  402.                                 p.load(new FileInputStream(filename));
  403.                                 for (final String[] setting : settings) {
  404.                                         p.setProperty(setting[0], setting[1]);
  405.                                 }
  406.                                 final FileOutputStream out = new FileOutputStream(filename);
  407.                                 p.store(out, "");
  408.                         } catch (final IOException ioe) {
  409.                         }
  410.                 }
  411.  
  412.                 public void setSettings() {
  413.                         try {
  414.                                 location = getSetting("LOCATION");
  415.                 save = extractBoolean(getSetting("SAVE"));
  416.                                 rock1 = getSetting("ROCKONE");
  417.                                 rock2 = getSetting("ROCKTWO");
  418.                 thirdRockCheck = extractBoolean(getSetting("ROCKTHREECHECK"));
  419.                                 if (thirdRockCheck) {
  420.                     rock3 = getSetting("ROCKTHREE");
  421.                                 }
  422.                         } catch (final Exception e) {
  423.                 log("Error 'setSettings'  " + e);
  424.                         }
  425.                 }
  426.  
  427.                 public boolean settingsExist(final String filename) {
  428.                         final File settingsFile = new File(filename);
  429.                         return settingsFile.exists();
  430.                 }
  431.  
  432.                 public String stringArrayToString(final String[] array) {
  433.                         String strArray = null;
  434.                         try {
  435.                                 strArray = "";
  436.                                 if (array.length <= 0) {
  437.                                         return "";
  438.                                 }
  439.                                 for (int a = 0; a < array.length; a++) {
  440.                                         if (!array[a].equals(null) && !array[a].equals("")) {
  441.                                                 strArray += array[a].trim();
  442.                                                 if (a != array.length - 1) {
  443.                                                         strArray += ",";
  444.                                                 }
  445.                                         }
  446.                                 }
  447.                         } catch (final Exception e) {
  448.                         }
  449.                         return strArray;
  450.                 }
  451.         }
  452.        
  453.    
  454.     // ONSTART/FINISH
  455.     public boolean onStart(Map<String, String> args) {
  456.        new WWMGUI().setVisible(true);
  457.        while (!startScript) {
  458.                         wait(10);
  459.            }
  460.        Bot.getEventManager().addListener(PaintListener.class, this);
  461.        if(isLoggedIn()){
  462.              startLevel = skills.getCurrentSkillLevel(STAT_MINING);
  463.        }
  464.        return true;
  465.     }
  466.  
  467.  
  468.  
  469.     public void onFinish(){
  470.         Bot.getEventManager().removeListener(PaintListener.class, this);
  471.         return;
  472.     }
  473.  
  474.     // NEEDED RANDOM THINGS
  475.  
  476.     public void serverMessageRecieved(ServerMessageEvent e) {
  477.         String word = e.getMessage().toLowerCase();
  478.         if (word.contains("manage to mine") && word.contains("tin")) {
  479.             mined++;
  480.             exp = (exp + 17.5);
  481.                         price = (price + tinprice);
  482.         }
  483.         if (word.contains("manage to mine") && word.contains("copper")) {
  484.             mined++;
  485.             exp = (exp + 17.5);
  486.                         price = (price + copperprice);
  487.         }
  488.         if (word.contains("manage to mine") && word.contains("clay")) {
  489.             mined++;
  490.             exp = (exp + 5);
  491.                         price = (price + clayprice);
  492.         }
  493.         if (word.contains("manage to mine") && word.contains("iron")) {
  494.             mined++;
  495.             exp = (exp + 35);
  496.                         price = (price + ironprice);
  497.         }
  498.         if (word.contains("manage to mine") && word.contains("silver")) {
  499.             mined++;
  500.             exp = (exp + 40);
  501.                         price = (price + silverprice);
  502.         }
  503.         if (word.contains("manage to mine") && word.contains("coal")) {
  504.             mined++;
  505.             exp = (exp + 50);
  506.                         price = (price + coalprice);
  507.         }
  508.         if (word.contains("manage to mine") && word.contains("gold")) {
  509.             mined++;
  510.             exp = (exp + 65);
  511.                         price = (price + goldprice);
  512.         }
  513.         if (word.contains("manage to mine") && word.contains("mithril")) {
  514.             mined++;
  515.             exp = (exp + 80);
  516.                         price = (price + mithprice);
  517.         }
  518.         if (word.contains("manage to mine") && word.contains("adamant")) {
  519.             mined++;
  520.             exp = (exp + 95);
  521.                         price = (price + adamantprice);
  522.         }
  523.  
  524.         if (word.contains("died")) {
  525.             log("You have died!");
  526.             stopAllScripts();
  527.         }
  528.         if (word.contains("you just found")) {
  529.             gem++;
  530.             exp = (exp + 65);
  531.         }
  532.     }
  533.  
  534.     public void stopScripts() {
  535.                 System.out.println("All Scripts Stopped");
  536.                 Bot.getScriptHandler().stopAllScripts();
  537.         }
  538.  
  539.     public void checkenergy(){
  540.         if(!isRunning()){
  541.             if(getEnergy() >= random(50, 100)){
  542.                 log("You have enough energy, turning on 'run'");
  543.                 setRun(true);
  544.             }
  545.         }
  546.     }
  547.  
  548.     public boolean nearBank(){
  549.         RSObject banker = findObject(bankID);
  550.         if(banker == null || distanceTo(banker) >= 5){
  551.             return false;
  552.         }else{
  553.             return true;
  554.         }
  555.     }
  556.  
  557.  
  558.     public void openBank(){
  559.         try {
  560.             if (findObject(bankID) != null) {
  561.                 while(getMyPlayer().isMoving()){
  562.                     wait(10);
  563.                 }
  564.                 if(distanceTo(bankTile) > 2){
  565.                     if(tileOnMap(bankTile)){
  566.                         walkTileMM(bankTile);
  567.                         wait(300);
  568.                         openBank();
  569.                     }
  570.                 }else if(distanceTo(bankTile) <= 2){
  571.                     status = "Opening bank...";
  572.                     RSObject Banker = findObject(bankID);
  573.                     Bank = Banker.getLocation();
  574.                     Point location = Calculations.tileToScreen(Bank);
  575.                     if (location.x == -1 || location.y == -1) wait(500);
  576.                     clickMouse(location, 2, 2, false);
  577.                     wait(300);
  578.                     if(getMenuActions().contains("Use-quickly")){
  579.                         atMenu("Use-quickly");
  580.                         wait(800);
  581.                     }else{
  582.                         if(getMenuActions().contains("Use-quickly")){
  583.                             atMenu("Cancel");
  584.                             setCameraRotation(random(1,360));
  585.                         }
  586.                     }
  587.                 }
  588.             }else{
  589.                 walkPathMM(randomizePath(toBank, 2 , 2) , 17);
  590.             }
  591.         } catch (Exception e) { }
  592.     }
  593.  
  594.     public void depositMine(){
  595.         try {
  596.             if (RSInterface.getInterface(INTERFACE_BANK).isValid()) {
  597.                 status = "Depositing rocks...";
  598.                 bank.depositAllExcept(axes);
  599.                 wait(400);
  600.                 bank.close();
  601.             }
  602.         } catch (Exception e) { }
  603.     }
  604.  
  605.  
  606.     public boolean needtobankMine(){
  607.         if(isInventoryFull()){
  608.             return true;
  609.         }else{
  610.             return false;
  611.         }
  612.     }
  613.  
  614.  
  615.     public void antiban(){
  616.         roll = random(0, 20);
  617.         if(roll == 7){
  618.             setCameraRotation(random(1,360));
  619.         }
  620.     }
  621.  
  622.     public void runCombat(){
  623.         try {
  624.             if(distanceTo(returnTo) <= 30){
  625.                 if(getMyPlayer().isInCombat()){
  626.                     log("In Combat, Running!");
  627.                     status = "Running from combat...";
  628.                     setRun(true);
  629.                     if(tileOnMap(runTo)){
  630.                         walkTileMM(runTo);
  631.                         wait(20000);
  632.                     }
  633.                 }
  634.             }
  635.         } catch (Exception e) { }
  636.     }
  637.  
  638.     public boolean animationCheck(){
  639.         if(getMyPlayer().getAnimation() == MINING_BRONZE
  640.                 || getMyPlayer().getAnimation() == MINING_IRON
  641.                 || getMyPlayer().getAnimation() == MINING_STEEL
  642.                 || getMyPlayer().getAnimation() == MINING_MITHRIL
  643.                 || getMyPlayer().getAnimation() == MINING_ADAMANT
  644.                 || getMyPlayer().getAnimation() == MINING_RUNE){
  645.             return true;
  646.         }else{
  647.             return false;
  648.         }
  649.     }
  650.  
  651.     private RSObject findSecondRock(int... rockIDs) {
  652.         final int X = Bot.getClient().getBaseX();
  653.         final int Y = Bot.getClient().getBaseY();
  654.         RSObject rockA = null;
  655.         RSObject rockB = null;
  656.         double distA = Double.MAX_VALUE;
  657.         double distB = Double.MAX_VALUE;
  658.         RSObject rockT;
  659.         boolean identified;
  660.         double distT;
  661.         try {
  662.             for (int x = 0; x < 104; x++) {
  663.                 for (int y = 0; y < 104; y++) {
  664.                     if ((rockT = getObjectAt((X + x), (Y + y))) != null) {
  665.                         identified = false;
  666.                         for (int ID : rockIDs) {
  667.                             if (ID == rockT.getID()) {
  668.                                 identified = true;
  669.                                 break;
  670.                             }
  671.                         }
  672.                         if (identified) {
  673.                             if ((distT = distanceTo(rockT)) < distA) {
  674.                                 rockB = rockA;
  675.                                 distB = distA;
  676.                                 rockA = rockT;
  677.                                 distA = distT;
  678.                             } else if (distT < distB) {
  679.                                 rockB = rockT;
  680.                                 distB = distT;
  681.                             }
  682.                         }
  683.                     }
  684.                 }
  685.             }
  686.         } catch (Exception e) { }
  687.         return rockB;
  688.     }
  689.  
  690.     public int Hover(){
  691.         try {
  692.             RSObject rock = findSecondRock(rockOne);
  693.             RSObject rock2 = findSecondRock(rockTwo);
  694.             if(rock == null){
  695.                 if(rock2 != null){
  696.                     Rock = rock2.getLocation();
  697.                     Point location = Calculations.tileToScreen(Rock);
  698.                     Point mouse = getMouseLocation();
  699.                     if (location.x == -1 || location.y == -1) return 500;
  700.                     if (Math.abs(location.x - mouse.x) <= 5){
  701.                         return 150;
  702.                     }
  703.                     moveMouse(location, 2, 2);
  704.                 }
  705.             }else if(rock != null){
  706.                 Rock = rock.getLocation();
  707.                 Point location = Calculations.tileToScreen(Rock);
  708.                 Point mouse = getMouseLocation();
  709.                 if (location.x == -1 || location.y == -1) return 500;
  710.                 if (Math.abs(location.x - mouse.x) <= 5){
  711.                     return 150;
  712.                 }
  713.                 moveMouse(location, 2, 2);
  714.             }
  715.         } catch (Exception e) { }
  716.         return 150;
  717.     }
  718.  
  719.     public int rockThere(RSObject rock){
  720.         try {
  721.             if(rock != null){
  722.                 rockID = rock.getID();
  723.                 Rock = rock.getLocation();
  724.                 playerPos = getMyPlayer().getLocation();
  725.                 playerPos = new RSTile(playerPos.getX() -1, playerPos.getY());
  726.                 Point clickStop = Calculations.tileToScreen(playerPos);
  727.                 if(getObjectAt(Rock).getID() != rockID){
  728.                     clickMouse(clickStop, 2, 2, true);
  729.                     return 200;
  730.                 }
  731.             }
  732.         } catch (Exception e) { }
  733.         return 150;
  734.     }
  735.  
  736.     public int clickRock(RSObject rock){
  737.         try {
  738.             rockID = rock.getID();
  739.             Rock = rock.getLocation();
  740.             playerPos = getMyPlayer().getLocation();
  741.             Point clickStop = Calculations.tileToScreen(playerPos);
  742.             Point location = Calculations.tileToScreen(Rock);
  743.             Point mouse = getMouseLocation();
  744.             if (location.x == -1 || location.y == -1) return 500;
  745.                 if (Math.abs(location.x - mouse.x) <= 5){
  746.                     if(getMenuActions().contains("Mine")){
  747.                         status = "Clicking rock...";
  748.                         clickMouse(true);
  749.                         wait(300);
  750.                         while(getMyPlayer().isMoving()){
  751.                             rockThere(rock);
  752.                             wait(10);
  753.                         }
  754.                         wait(300);
  755.                         if(!animationCheck()){
  756.                             tries++;
  757.                         }else if(animationCheck()){
  758.                             tries = 0;
  759.                             rockThere(rock);
  760.                         }
  761.                         if(tries >= 10){
  762.                             tries = 0;
  763.                             setCameraRotation(random(1,360));
  764.                         }
  765.                     }else if(!getMenuActions().contains("Mine")){
  766.                         tries++;
  767.                         if(tries >= 10){
  768.                             tries = 0;
  769.                             setCameraRotation(random(1,360));
  770.                         }
  771.                         wait(150);
  772.                     }
  773.                 }else{
  774.                     status = "Moving mouse to rock...";
  775.                     moveMouse(location, 2, 2);
  776.                     if(getMenuActions().contains("Mine")){
  777.                         status = "Clicking rock...";
  778.                         clickMouse(true);
  779.                         wait(300);
  780.                         while(getMyPlayer().isMoving()){
  781.                             rockThere(rock);
  782.                             wait(10);
  783.                         }
  784.                         wait(300);
  785.                         if(!animationCheck()){
  786.                             tries++;
  787.                         }else if(animationCheck()){
  788.                             tries = 0;
  789.                             rockThere(rock);
  790.                         }
  791.                         if(tries >= 10){
  792.                             tries = 0;
  793.                             setCameraRotation(random(1,360));
  794.                         }
  795.                     }else if(!getMenuActions().contains("Mine")){
  796.                         tries++;
  797.                         if(tries >= 10){
  798.                             tries = 0;
  799.                             setCameraRotation(random(1,360));
  800.                         }
  801.                         wait(150);
  802.                     }
  803.                 }
  804.             } catch (Exception e) { }
  805.             return 150;
  806.     }
  807.  
  808.     public int Mine(){
  809.         runCombat();
  810.         if(animationCheck()){
  811.             Hover();
  812.             return 150;
  813.             }
  814.         if(getMyPlayer().isMoving()){
  815.             return 150;
  816.         }
  817.         status = "Searching for rock...";
  818.         RSObject rock1 = findObject(rockOne);
  819.         RSObject rock2 = findObject(rockTwo);
  820.         RSObject rock3 = findObject(rockThree);
  821.         if(rock1 == null && rock2 == null && rock3 == null){
  822.             if(getMyPlayer().getLocation() != returnTo){
  823.                 try {
  824.                     if(tileOnMap(returnTo)){
  825.                         walkTileMM(returnTo);
  826.                     }
  827.                     return 150;
  828.                 } catch (Exception e) { }
  829.             }
  830.         }
  831.         if(rock1 != null){
  832.             if (tileOnScreen(rock1.getLocation())) {
  833.                 clickRock(rock1);
  834.                 return 150;
  835.             } else {
  836.                 try {
  837.                     if(tileOnMap(rock1.getLocation())){
  838.                         walkTileMM(rock1.getLocation());
  839.                     }
  840.                     return 150;
  841.                 } catch (Exception e) { }
  842.  
  843.             }
  844.         }
  845.         if(rock2 != null){
  846.             if (tileOnScreen(rock2.getLocation())) {
  847.                 clickRock(rock2);
  848.                 return 150;
  849.             } else {
  850.                 try {
  851.                     if(tileOnMap(rock2.getLocation())){
  852.                         walkTileMM(rock2.getLocation());
  853.                     }
  854.                     return 150;
  855.                 } catch (Exception e) { }
  856.             }
  857.         }
  858.         if(rock3 != null){
  859.             if (tileOnScreen(rock3.getLocation())) {
  860.                 clickRock(rock3);
  861.                 return 150;
  862.             } else {
  863.                 try {
  864.                     if(tileOnMap(rock3.getLocation())){
  865.                         walkTileMM(rock3.getLocation());
  866.                     }
  867.                     return 150;
  868.                 } catch (Exception e) { }
  869.             }
  870.         }
  871.         return 200;
  872.     }
  873.  
  874.     public void Drop() { // Thanks Dwuxi
  875.         status = "Dropping rocks...";
  876.         if(isInventoryFull()){
  877.             if (getCurrentTab() == TAB_INVENTORY) {
  878.                 clickMouse(xx1,yy1,3,3,false);
  879.                 clickMouse(xx2,yy2,3,3,true);
  880.                 clickMouse(xx3,yy3,3,3,false);
  881.                 clickMouse(xx4,yy4,3,3,true);
  882.                 clickMouse(xx5,yy5,3,3,false);
  883.                 clickMouse(xx6,yy6,3,3,true);
  884.             } else {
  885.                 openTab(TAB_INVENTORY);
  886.             }
  887.         }
  888.     }
  889.  
  890.  
  891.   //----------------------------------------------//
  892.  //-----------------STATE STUFF------------------//
  893. //----------------------------------------------//
  894.  
  895.     private boolean playerInArea(int maxX, int maxY, int minX, int minY) { //
  896.                 int x = getMyPlayer().getLocation().getX();
  897.                 int y = getMyPlayer().getLocation().getY();
  898.                 if (x >= minX && x <= maxX && y >= minY && y <= maxY)
  899.                 {
  900.                         return true;
  901.                 }
  902.                 return false;
  903.         }
  904.  
  905.     private int bankstate(){
  906.         try {
  907.             if(!bank.isOpen()){
  908.                 openBank();
  909.                 depositMine();
  910.                 return 500;
  911.             }else if(bank.isOpen()){
  912.                 depositMine();
  913.                 return 500;
  914.             }
  915.         } catch (Exception e) { }
  916.         return 30;
  917.     }
  918.  
  919.     private int walktobankstate(){
  920.         try {
  921.             if(distanceTo(getDestination()) > 5){
  922.                 if(getMyPlayer().isMoving()){
  923.                     return 800;
  924.                 }
  925.             }
  926.             walkPathMM(randomizePath(toBank, 2 , 2) , 18);
  927.         } catch (Exception e) { }
  928.         return 500;
  929.     }
  930.  
  931.     private int toBankFromLadder(){
  932.         try {
  933.             if(distanceTo(getDestination()) > 5){
  934.                 if(getMyPlayer().isMoving()){
  935.                     return 800;
  936.                 }
  937.             }
  938.             walkPathMM(randomizePath(ladderToBank, 2 , 2) , 18);
  939.         } catch (Exception e) { }
  940.         return 500;
  941.     }
  942.  
  943.     private int toLadderFromBank(){
  944.         try {
  945.             if(distanceTo(getDestination()) > 5){
  946.                 if(getMyPlayer().isMoving()){
  947.                     return 800;
  948.                 }
  949.             }
  950.             walkPathMM(randomizePath(bankToLadder, 2 , 2) , 17);
  951.         } catch (Exception e) { }
  952.         return 500;
  953.     }
  954.  
  955.     private int toLadderFromMine(){
  956.         try {
  957.             if(distanceTo(getDestination()) > 5){
  958.                 if(getMyPlayer().isMoving()){
  959.                     return 800;
  960.                 }
  961.             }
  962.             walkPathMM(randomizePath(mineToLadder, 2 , 2) , 17);
  963.         } catch (Exception e) { }
  964.         return 500;
  965.     }
  966.  
  967.    private int toMineFromLadder(){
  968.         try {
  969.             if (distanceTo(returnTo) >= 5 || returnTo == null){
  970.                 if (distanceTo(returnTo) <= 15){
  971.                     if(tileOnMap(returnTo)){
  972.                         walkTileMM(returnTo);
  973.                     }
  974.                     return 500;
  975.                 }else{
  976.                     if(distanceTo(getDestination()) > 5){
  977.                         if(getMyPlayer().isMoving()){
  978.                             return 800;
  979.                         }
  980.                     }
  981.                     walkPathMM(randomizePath(ladderToMine, 2 , 2) , 17);
  982.                     return 500;
  983.                 }
  984.             }
  985.         } catch (Exception e) { }
  986.         return 30;
  987.     }
  988.  
  989.     private int downLadder(){
  990.         RSObject Ladder = getObjectAt(ladderLoc);
  991.         if(Ladder == null){
  992.             toLadderFromBank();
  993.         }else if(Ladder != null){
  994.             try {
  995.                 if(getMyPlayer().getLocation() != ladderTile){
  996.                     if(tileOnMap(ladderTile)){
  997.                         walkTileMM(ladderTile);
  998.                         wait(3000);
  999.                     }
  1000.                 }
  1001.             } catch (Exception e) { }
  1002.             while(getMyPlayer().isMoving()){
  1003.                 wait(30);
  1004.             }
  1005.             setCompass('n');
  1006.             ladder = Ladder.getLocation();
  1007.             Point location = Calculations.tileToScreen(ladder);
  1008.             Point mouse = getMouseLocation();
  1009.             if (location.x == -1 || location.y == -1) return 500;
  1010.             clickMouse(location, 1, 1, false);
  1011.             if(getMenuActions().contains("Climb-down")){
  1012.                 atMenu("Climb-down");
  1013.                 wait(3000);
  1014.             }else{
  1015.                 atMenu("Cancel");
  1016.                 setCameraRotation(random(1,360));
  1017.                 if(tileOnMap(ladderTile)){
  1018.                     walkTileMM(ladderTile);
  1019.                     wait(3000);
  1020.                 }
  1021.                 wait(500);
  1022.             }
  1023.         }
  1024.         return 200;
  1025.     }
  1026.  
  1027.     private int upLadder(){
  1028.         RSObject Ladder = getObjectAt(ladderLoc2);
  1029.         if(Ladder == null){
  1030.             toLadderFromMine();
  1031.         }else if(Ladder != null){
  1032.             try {
  1033.                 if(getMyPlayer().getLocation() != ladderTile2){
  1034.                     if(tileOnMap(ladderTile2)){
  1035.                         walkTileMM(ladderTile2);
  1036.                         wait(3000);
  1037.                     }
  1038.                 }
  1039.             } catch (Exception e) { }
  1040.             while(getMyPlayer().isMoving()){
  1041.                 wait(30);
  1042.             }
  1043.             setCompass('n');
  1044.             ladder = Ladder.getLocation();
  1045.             Point location = Calculations.tileToScreen(ladder);
  1046.             Point mouse = getMouseLocation();
  1047.             if (location.x == -1 || location.y == -1) return 500;
  1048.             clickMouse(location, 1, 1, false);
  1049.             if(getMenuActions().contains("Climb-up")){
  1050.                 atMenu("Climb-up");
  1051.                 wait(3000);
  1052.             }else{
  1053.                 atMenu("Cancel");
  1054.                 setCameraRotation(random(1,360));
  1055.                 if(tileOnMap(ladderTile2)){
  1056.                     walkTileMM(ladderTile2);
  1057.                     wait(3000);
  1058.                 }
  1059.                 wait(500);
  1060.             }
  1061.         }
  1062.         return 200;
  1063.     }
  1064.  
  1065.     private int walktoplacestate(){
  1066.         try {
  1067.             if (distanceTo(returnTo) >= 5 || returnTo == null){
  1068.                 if (distanceTo(returnTo) <= 15){
  1069.                     if(tileOnMap(returnTo)){
  1070.                         walkTileMM(returnTo);
  1071.                     }
  1072.                     return 500;
  1073.                 }else{
  1074.                     if(distanceTo(getDestination()) > 5){
  1075.                         if(getMyPlayer().isMoving()){
  1076.                             return 800;
  1077.                         }
  1078.                     }
  1079.                     walkPathMM(randomizePath(toPlace, 2 , 2) , 17);
  1080.                     return 500;
  1081.                 }
  1082.             }
  1083.         } catch (Exception e) { }
  1084.         return 30;
  1085.     }
  1086.  
  1087.  
  1088.     private enum Status{
  1089.         bankstate, bankstate2, walkToBankstate, minestate, walkToPlacestate, dropstate,
  1090.         downLadderState, upLadderState, walkToDown, walkToUp;
  1091.  
  1092.     }
  1093.  
  1094.     private Status getState(){
  1095.         if(bankrocks && Place != "Mining Guild"){
  1096.             if(needtobankMine() && nearBank()){
  1097.                 return Status.bankstate;
  1098.             }
  1099.             if(Place != "Al Kharid"){
  1100.                 if(!isInventoryFull() && distanceTo(returnTo) <= 15 &&
  1101.                         !needtobankMine()){
  1102.                     return Status.minestate;
  1103.                 }
  1104.             }else if(Place == "Al Kharid"){
  1105.                 if(!isInventoryFull() && distanceTo(returnTo) <= 20 &&
  1106.                         !needtobankMine()){
  1107.                     return Status.minestate;
  1108.                 }
  1109.             }
  1110.             if(!isInventoryFull() && distanceTo(returnTo) > 15){
  1111.                 return Status.walkToPlacestate;
  1112.             }
  1113.             if(needtobankMine() && !nearBank()){
  1114.                 return Status.walkToBankstate;
  1115.             }
  1116.         }else if(bankrocks && Place == "Mining Guild"){
  1117.             if(needtobankMine() && nearBank()){
  1118.                 return Status.bankstate;
  1119.             }
  1120.             if(!needtobankMine() && !playerInArea(3024, 3342, 3014, 3336)
  1121.                     && getMyPlayer().getLocation().getY() < 9000){
  1122.                 return Status.walkToDown;
  1123.             }
  1124.             if(!needtobankMine() && playerInArea(3024, 3342, 3014, 3336)){
  1125.                 return Status.downLadderState;
  1126.             }
  1127.             if(!needtobankMine() && getMyPlayer().getLocation().getY() > 9000
  1128.                     && distanceTo(returnTo) > 15){
  1129.                 return Status.walkToPlacestate;
  1130.             }
  1131.             if(!isInventoryFull() && distanceTo(returnTo) <= 15 &&
  1132.                     !needtobankMine()){
  1133.                 return Status.minestate;
  1134.             }
  1135.             if(needtobankMine() && getMyPlayer().getLocation().getY() > 9000
  1136.                     && !playerInArea(3021, 9741, 3017, 9737)){
  1137.                 return Status.walkToUp;
  1138.             }
  1139.             if(needtobankMine() && getMyPlayer().getLocation().getY() > 9000
  1140.                     && playerInArea(3021, 9741, 3017, 9737)){
  1141.                 return Status.upLadderState;
  1142.             }
  1143.             if(needtobankMine() && getMyPlayer().getLocation().getY() < 9000 &&
  1144.                     !nearBank()){
  1145.                 return Status.walkToBankstate;
  1146.             }
  1147.  
  1148.         }else if(power){
  1149.             if(!isInventoryFull()){
  1150.                 return Status.minestate;
  1151.             }
  1152.             if(isInventoryFull()){
  1153.                 return Status.dropstate;
  1154.             }
  1155.         }
  1156.         return null;
  1157.     }
  1158.  
  1159.   //----------------------------------------------//
  1160.  //---------------END STATE STUFF----------------//
  1161. //----------------------------------------------//
  1162.  
  1163. public int loop() {
  1164.     checkenergy();
  1165.         antiban();
  1166.     if(bankrocks && Place != "Mining Guild"){
  1167.         switch(getState()){
  1168.         case bankstate:
  1169.             status = "Banking...";
  1170.             bankstate();
  1171.             return 200;
  1172.         case walkToBankstate:
  1173.             status = "Walking to bank...";
  1174.             walktobankstate();
  1175.             return 200;
  1176.         case minestate:
  1177.             status = "Mining...";
  1178.             Mine();
  1179.             return 200;
  1180.         case walkToPlacestate:
  1181.             status = "Walking to mine...";
  1182.             walktoplacestate();
  1183.             return 200;
  1184.         default:
  1185.             return 200;
  1186.         }
  1187.     }else if(bankrocks && Place == "Mining Guild"){
  1188.         switch(getState()){
  1189.         case bankstate:
  1190.             status = "Banking...";
  1191.             bankstate();
  1192.             return 200;
  1193.         case walkToDown:
  1194.             status = "Walking to down ladder...";
  1195.             toLadderFromBank();
  1196.             return 200;
  1197.         case downLadderState:
  1198.             status = "Going down ladder...";
  1199.             downLadder();
  1200.             return 200;
  1201.         case walkToPlacestate:
  1202.             status = "Walking to mine...";
  1203.             toMineFromLadder();
  1204.             return 200;
  1205.         case minestate:
  1206.             status = "Mining...";
  1207.             Mine();
  1208.             return 200;
  1209.         case walkToUp:
  1210.             status = "Walking to up ladder...";
  1211.             toLadderFromMine();
  1212.             return 200;
  1213.         case upLadderState:
  1214.             status = "Going up ladder...";
  1215.             upLadder();
  1216.             return 200;
  1217.         case walkToBankstate:
  1218.             status = "Walking to bank...";
  1219.             toBankFromLadder();
  1220.             return 200;
  1221.         default:
  1222.             return 200;
  1223.         }
  1224.     }else if(power){
  1225.         switch(getState()){
  1226.         case minestate:
  1227.             status = "Mining...";
  1228.             Mine();
  1229.             return 200;
  1230.        case dropstate:
  1231.             status = "Dropping rocks...";
  1232.             Drop();
  1233.             return 200;
  1234.         default:
  1235.             return 200;
  1236.         }
  1237.     }
  1238.     return 100;
  1239. }
  1240.  
  1241.  class WWMGUI extends javax.swing.JFrame {
  1242.  
  1243.     /** Creates new form WWMGUI */
  1244.     public WWMGUI() {
  1245.         initComponents();
  1246.     }
  1247.  
  1248.     /** This method is called from within the constructor to
  1249.      * initialize the form.
  1250.      * WARNING: Do NOT modify this code. The content of this method is
  1251.      * always regenerated by the Form Editor.
  1252.      */
  1253.     @SuppressWarnings("unchecked")
  1254.     // <editor-fold defaultstate="collapsed" desc="Generated Code">
  1255.     private void initComponents() {
  1256.  
  1257.         jPanel1 = new javax.swing.JPanel();
  1258.         jTabbedPane1 = new javax.swing.JTabbedPane();
  1259.         jPanel2 = new javax.swing.JPanel();
  1260.         jLabel2 = new javax.swing.JLabel();
  1261.         jLabel1 = new javax.swing.JLabel();
  1262.         jSeparator1 = new javax.swing.JSeparator();
  1263.         jLabel3 = new javax.swing.JLabel();
  1264.         jLabel4 = new javax.swing.JLabel();
  1265.         jLabel5 = new javax.swing.JLabel();
  1266.         jButton1 = new javax.swing.JButton();
  1267.         jLabel6 = new javax.swing.JLabel();
  1268.         jLabel7 = new javax.swing.JLabel();
  1269.         jLabel8 = new javax.swing.JLabel();
  1270.         jLabel9 = new javax.swing.JLabel();
  1271.         jLabel10 = new javax.swing.JLabel();
  1272.         jLabel11 = new javax.swing.JLabel();
  1273.         jLabel12 = new javax.swing.JLabel();
  1274.         jLabel13 = new javax.swing.JLabel();
  1275.         jButton2 = new javax.swing.JButton();
  1276.         chkSettings = new javax.swing.JCheckBox();
  1277.         jButton4 = new javax.swing.JButton();
  1278.         jPanel3 = new javax.swing.JPanel();
  1279.         jLabel14 = new javax.swing.JLabel();
  1280.         jSeparator2 = new javax.swing.JSeparator();
  1281.         jLabel15 = new javax.swing.JLabel();
  1282.         jLabel16 = new javax.swing.JLabel();
  1283.         mineLocation = new javax.swing.JComboBox();
  1284.         jLabel17 = new javax.swing.JLabel();
  1285.         firstRock = new javax.swing.JComboBox();
  1286.         jLabel18 = new javax.swing.JLabel();
  1287.         secondRock = new javax.swing.JComboBox();
  1288.         jSeparator3 = new javax.swing.JSeparator();
  1289.         jLabel19 = new javax.swing.JLabel();
  1290.         jSeparator4 = new javax.swing.JSeparator();
  1291.         jLabel20 = new javax.swing.JLabel();
  1292.         jLabel21 = new javax.swing.JLabel();
  1293.         jLabel22 = new javax.swing.JLabel();
  1294.         jLabel23 = new javax.swing.JLabel();
  1295.         jLabel24 = new javax.swing.JLabel();
  1296.         jLabel25 = new javax.swing.JLabel();
  1297.         jLabel26 = new javax.swing.JLabel();
  1298.         jLabel27 = new javax.swing.JLabel();
  1299.         jLabel28 = new javax.swing.JLabel();
  1300.         jLabel29 = new javax.swing.JLabel();
  1301.         jLabel30 = new javax.swing.JLabel();
  1302.         chkthird = new javax.swing.JCheckBox();
  1303.         thirdRock = new javax.swing.JComboBox();
  1304.         thirdRockLabel = new javax.swing.JLabel();
  1305.         jLabel31 = new javax.swing.JLabel();
  1306.         jLabel32 = new javax.swing.JLabel();
  1307.         jLabel33 = new javax.swing.JLabel();
  1308.         jLabel34 = new javax.swing.JLabel();
  1309.         jLabel35 = new javax.swing.JLabel();
  1310.         jSeparator6 = new javax.swing.JSeparator();
  1311.         jSeparator7 = new javax.swing.JSeparator();
  1312.         jLabel36 = new javax.swing.JLabel();
  1313.         jLabel37 = new javax.swing.JLabel();
  1314.         jLabel38 = new javax.swing.JLabel();
  1315.         jButton3 = new javax.swing.JButton();
  1316.  
  1317.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  1318.         setTitle("WorldWideMiner by Sean");
  1319.         setAlwaysOnTop(true);
  1320.         setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
  1321.  
  1322.         jTabbedPane1.setBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(0, 102, 102), java.awt.Color.darkGray));
  1323.         jTabbedPane1.setForeground(new java.awt.Color(0, 51, 51));
  1324.         jTabbedPane1.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);
  1325.         jTabbedPane1.setName("Tabs"); // NOI18N
  1326.         jTabbedPane1.setVerifyInputWhenFocusTarget(false);
  1327.  
  1328.         jLabel2.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
  1329.         jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
  1330.         jLabel2.setText("By Sean");
  1331.         jLabel2.setName("ByLabel"); // NOI18N
  1332.  
  1333.         jLabel1.setFont(new java.awt.Font("Tunga", 1, 24));
  1334.         jLabel1.setForeground(new java.awt.Color(0, 102, 102));
  1335.         jLabel1.setText("World-Wide-Miner!");
  1336.         jLabel1.setName("NameLabel"); // NOI18N
  1337.  
  1338.         jLabel3.setFont(new java.awt.Font("Tahoma", 1, 11));
  1339.         jLabel3.setText("What does the script do?");
  1340.  
  1341.         jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
  1342.         jLabel4.setText("This script mines ores from all across the world of Runescape.  You can choose to either bank or ");
  1343.         jLabel4.setVerticalAlignment(javax.swing.SwingConstants.TOP);
  1344.  
  1345.         jLabel5.setText("powermine these ores.");
  1346.  
  1347.         jButton1.setText("Start Script");
  1348.         jButton1.addActionListener(new java.awt.event.ActionListener() {
  1349.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  1350.                 jButton1ActionPerformed(evt);
  1351.             }
  1352.         });
  1353.  
  1354.         jLabel6.setFont(new java.awt.Font("Tahoma", 1, 11));
  1355.         jLabel6.setText("Where should I start the script?");
  1356.  
  1357.         jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
  1358.         jLabel7.setText("There are several places where you can start this script.  These would be:");
  1359.         jLabel7.setVerticalAlignment(javax.swing.SwingConstants.TOP);
  1360.  
  1361.         jLabel8.setText("1. At the Mine (If banking or powermining)");
  1362.  
  1363.         jLabel9.setText("2. At the Bank (If banking)");
  1364.  
  1365.         jLabel10.setText("3. Somewhere between the Bank and the Mine (If banking)");
  1366.  
  1367.         jLabel11.setFont(new java.awt.Font("Tahoma", 1, 11));
  1368.         jLabel11.setText("How can I repay you for this awesome script?!?");
  1369.  
  1370.         jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
  1371.         jLabel12.setText("Donations are very much appreciated!  You can either click the donate button below to donate to ");
  1372.         jLabel12.setVerticalAlignment(javax.swing.SwingConstants.TOP);
  1373.  
  1374.         jLabel13.setText("my paypal, or you can pm me with pins or other rs things.");
  1375.  
  1376.         jButton2.setText("Cancel Script");
  1377.         jButton2.addActionListener(new java.awt.event.ActionListener() {
  1378.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  1379.                 jButton2ActionPerformed(evt);
  1380.             }
  1381.         });
  1382.  
  1383.         chkSettings.setSelected(true);
  1384.         chkSettings.setText("Save Settings");
  1385.  
  1386.         jButton4.setText("Load Settings");
  1387.         jButton4.addActionListener(new java.awt.event.ActionListener() {
  1388.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  1389.                 jButton4ActionPerformed(evt);
  1390.             }
  1391.         });
  1392.  
  1393.         javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
  1394.         jPanel2.setLayout(jPanel2Layout);
  1395.         jPanel2Layout.setHorizontalGroup(
  1396.             jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1397.             .addGroup(jPanel2Layout.createSequentialGroup()
  1398.                 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1399.                     .addGroup(jPanel2Layout.createSequentialGroup()
  1400.                         .addContainerGap()
  1401.                         .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1402.                             .addGroup(jPanel2Layout.createSequentialGroup()
  1403.                                 .addComponent(jLabel1)
  1404.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1405.                                 .addComponent(jLabel2))
  1406.                             .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 251, javax.swing.GroupLayout.PREFERRED_SIZE)
  1407.                             .addComponent(jLabel3)))
  1408.                     .addGroup(jPanel2Layout.createSequentialGroup()
  1409.                         .addGap(20, 20, 20)
  1410.                         .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1411.                             .addComponent(jLabel5)
  1412.                             .addComponent(jLabel4)))
  1413.                     .addGroup(jPanel2Layout.createSequentialGroup()
  1414.                         .addContainerGap()
  1415.                         .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1416.                             .addComponent(jLabel6)
  1417.                             .addGroup(jPanel2Layout.createSequentialGroup()
  1418.                                 .addGap(10, 10, 10)
  1419.                                 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1420.                                     .addComponent(jLabel7)
  1421.                                     .addGroup(jPanel2Layout.createSequentialGroup()
  1422.                                         .addGap(10, 10, 10)
  1423.                                         .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1424.                                             .addComponent(jLabel9)
  1425.                                             .addComponent(jLabel8)
  1426.                                             .addComponent(jLabel10)))))))
  1427.                     .addGroup(jPanel2Layout.createSequentialGroup()
  1428.                         .addContainerGap()
  1429.                         .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1430.                             .addComponent(jLabel11)
  1431.                             .addGroup(jPanel2Layout.createSequentialGroup()
  1432.                                 .addGap(10, 10, 10)
  1433.                                 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1434.                                     .addComponent(jLabel13)
  1435.                                     .addComponent(jLabel12))))))
  1436.                 .addContainerGap(71, Short.MAX_VALUE))
  1437.             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
  1438.                 .addContainerGap()
  1439.                 .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  1440.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1441.                 .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  1442.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 234, Short.MAX_VALUE)
  1443.                 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1444.                     .addComponent(chkSettings)
  1445.                     .addComponent(jButton4))
  1446.                 .addGap(37, 37, 37))
  1447.         );
  1448.         jPanel2Layout.setVerticalGroup(
  1449.             jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1450.             .addGroup(jPanel2Layout.createSequentialGroup()
  1451.                 .addContainerGap()
  1452.                 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  1453.                     .addComponent(jLabel2)
  1454.                     .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
  1455.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1456.                 .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
  1457.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1458.                 .addComponent(jLabel3)
  1459.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1460.                 .addComponent(jLabel4)
  1461.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1462.                 .addComponent(jLabel5)
  1463.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  1464.                 .addComponent(jLabel6)
  1465.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1466.                 .addComponent(jLabel7)
  1467.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1468.                 .addComponent(jLabel8)
  1469.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1470.                 .addComponent(jLabel9)
  1471.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1472.                 .addComponent(jLabel10)
  1473.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  1474.                 .addComponent(jLabel11)
  1475.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1476.                 .addComponent(jLabel12)
  1477.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1478.                 .addComponent(jLabel13)
  1479.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 89, Short.MAX_VALUE)
  1480.                 .addComponent(chkSettings)
  1481.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1482.                 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  1483.                     .addComponent(jButton1)
  1484.                     .addComponent(jButton2)
  1485.                     .addComponent(jButton4))
  1486.                 .addContainerGap())
  1487.         );
  1488.  
  1489.         jTabbedPane1.addTab("Script Information", jPanel2);
  1490.  
  1491.         jLabel14.setFont(new java.awt.Font("Tunga", 1, 24));
  1492.         jLabel14.setForeground(new java.awt.Color(0, 102, 102));
  1493.         jLabel14.setText("World-Wide-Miner!");
  1494.         jLabel14.setName("NameLabel"); // NOI18N
  1495.  
  1496.         jLabel15.setFont(new java.awt.Font("Bookman Old Style", 0, 11));
  1497.         jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
  1498.         jLabel15.setText("By Sean");
  1499.         jLabel15.setName("ByLabel"); // NOI18N
  1500.  
  1501.         jLabel16.setFont(new java.awt.Font("Tahoma", 1, 11));
  1502.         jLabel16.setText("Mining Location:");
  1503.  
  1504.         mineLocation.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Power-Mining", "Varrock East", "Varrock West", "Al Kharid", "Rimmington", "Barbarian Village", "Mining Guild", "West Lumbridge Swamp" }));
  1505.  
  1506.  
  1507.         jLabel17.setFont(new java.awt.Font("Tahoma", 1, 11));
  1508.         jLabel17.setText("First rock to mine:");
  1509.  
  1510.         firstRock.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Tin", "Copper", "Clay", "Iron", "Silver", "Gold", "Coal", "Mithril", "Adamant" }));
  1511.  
  1512.  
  1513.         jLabel18.setFont(new java.awt.Font("Tahoma", 1, 11));
  1514.         jLabel18.setText("Second rock to mine:");
  1515.  
  1516.         secondRock.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "None", "Tin", "Copper", "Clay", "Iron", "Silver", "Gold", "Coal", "Mithril", "Adamant" }));
  1517.  
  1518.  
  1519.         jSeparator3.setOrientation(javax.swing.SwingConstants.VERTICAL);
  1520.  
  1521.         jLabel19.setFont(new java.awt.Font("Tahoma", 1, 11));
  1522.         jLabel19.setText("Wonder what each mine has?  Look below!");
  1523.  
  1524.         jLabel20.setFont(new java.awt.Font("Tahoma", 1, 11));
  1525.         jLabel20.setText("Varrock East:");
  1526.  
  1527.         jLabel21.setText("6 Tin, 9 Copper, 4 Iron");
  1528.  
  1529.         jLabel22.setFont(new java.awt.Font("Tahoma", 1, 11));
  1530.         jLabel22.setText("Varrock West:");
  1531.  
  1532.         jLabel23.setText("3 Clay, 8 Tin, 3 Iron, 3 Silver");
  1533.  
  1534.         jLabel24.setFont(new java.awt.Font("Tahoma", 1, 11));
  1535.         jLabel24.setText("Al Kharid:");
  1536.  
  1537.         jLabel25.setText("1 Tin, 4 Copper, 9 Iron, 3 Coal, 5 Silver, 2 Gold, 2 Mithril,");
  1538.  
  1539.         jLabel26.setFont(new java.awt.Font("Tahoma", 1, 11));
  1540.         jLabel26.setText("Rimmington:");
  1541.  
  1542.         jLabel27.setText("2 Clay, 2 Tin, 5 Copper, 6 Iron, 2 Gold");
  1543.  
  1544.         jLabel28.setFont(new java.awt.Font("Tahoma", 1, 11));
  1545.         jLabel28.setText("Barbarian Village:");
  1546.  
  1547.         jLabel29.setText("5 Tin, 4 Coal");
  1548.  
  1549.         jLabel30.setText("2 Adamant");
  1550.  
  1551.         chkthird.setFont(new java.awt.Font("Tahoma", 1, 11));
  1552.         chkthird.setSelected(true);
  1553.         chkthird.setText("Third Rock?");
  1554.         chkthird.addActionListener(new java.awt.event.ActionListener() {
  1555.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  1556.                 chkthirdActionPerformed(evt);
  1557.             }
  1558.         });
  1559.  
  1560.         thirdRock.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Tin", "Copper", "Clay", "Iron", "Silver", "Gold", "Coal", "Mithril", "Adamant" }));
  1561.  
  1562.  
  1563.         thirdRockLabel.setFont(new java.awt.Font("Tahoma", 1, 11));
  1564.         thirdRockLabel.setText("Third rock to mine:");
  1565.         thirdRockLabel.setOpaque(true);
  1566.  
  1567.         jLabel31.setFont(new java.awt.Font("Tahoma", 1, 11));
  1568.         jLabel31.setText("Mining Guild:");
  1569.  
  1570.         jLabel32.setText("37 Coal, 5 Mithril");
  1571.  
  1572.         jLabel33.setFont(new java.awt.Font("Tahoma", 1, 11));
  1573.         jLabel33.setText("West Lumbridge Swamp:");
  1574.  
  1575.         jLabel34.setText("7 Coal, 5 Mithril, 2 Adamant");
  1576.  
  1577.         jLabel35.setFont(new java.awt.Font("Tahoma", 1, 11));
  1578.         jLabel35.setText("Update your script here!");
  1579.  
  1580.         jLabel36.setText("Click the 'Check for update' button to see if you have the latest script.");
  1581.  
  1582.         jLabel37.setText("If you don't, You will be asked if you would like to connect to the internet to");
  1583.  
  1584.         jLabel38.setText("update.");
  1585.  
  1586.         jButton3.setText("Check for update");
  1587.         jButton3.addActionListener(new java.awt.event.ActionListener() {
  1588.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  1589.                 jButton3ActionPerformed(evt);
  1590.             }
  1591.         });
  1592.  
  1593.         javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
  1594.         jPanel3.setLayout(jPanel3Layout);
  1595.         jPanel3Layout.setHorizontalGroup(
  1596.             jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1597.             .addGroup(jPanel3Layout.createSequentialGroup()
  1598.                 .addContainerGap()
  1599.                 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1600.                     .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 251, javax.swing.GroupLayout.PREFERRED_SIZE)
  1601.                     .addGroup(jPanel3Layout.createSequentialGroup()
  1602.                         .addComponent(jLabel14)
  1603.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1604.                         .addComponent(jLabel15))
  1605.                     .addGroup(jPanel3Layout.createSequentialGroup()
  1606.                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1607.                             .addComponent(jLabel16)
  1608.                             .addGroup(jPanel3Layout.createSequentialGroup()
  1609.                                 .addGap(10, 10, 10)
  1610.                                 .addComponent(mineLocation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  1611.                             .addComponent(jLabel17)
  1612.                             .addGroup(jPanel3Layout.createSequentialGroup()
  1613.                                 .addGap(10, 10, 10)
  1614.                                 .addComponent(firstRock, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  1615.                             .addComponent(jLabel18)
  1616.                             .addGroup(jPanel3Layout.createSequentialGroup()
  1617.                                 .addGap(10, 10, 10)
  1618.                                 .addComponent(secondRock, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  1619.                             .addComponent(chkthird)
  1620.                             .addComponent(thirdRockLabel)
  1621.                             .addGroup(jPanel3Layout.createSequentialGroup()
  1622.                                 .addGap(10, 10, 10)
  1623.                                 .addComponent(thirdRock, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
  1624.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1625.                         .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE)
  1626.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1627.                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1628.                             .addComponent(jSeparator7, javax.swing.GroupLayout.PREFERRED_SIZE, 359, javax.swing.GroupLayout.PREFERRED_SIZE)
  1629.                             .addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 359, javax.swing.GroupLayout.PREFERRED_SIZE)
  1630.                             .addComponent(jLabel35)
  1631.                             .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 251, javax.swing.GroupLayout.PREFERRED_SIZE)
  1632.                             .addComponent(jLabel19)
  1633.                             .addGroup(jPanel3Layout.createSequentialGroup()
  1634.                                 .addComponent(jLabel20)
  1635.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1636.                                 .addComponent(jLabel21))
  1637.                             .addGroup(jPanel3Layout.createSequentialGroup()
  1638.                                 .addComponent(jLabel22)
  1639.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1640.                                 .addComponent(jLabel23))
  1641.                             .addGroup(jPanel3Layout.createSequentialGroup()
  1642.                                 .addComponent(jLabel24)
  1643.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1644.                                 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1645.                                     .addComponent(jLabel30)
  1646.                                     .addComponent(jLabel25)))
  1647.                             .addGroup(jPanel3Layout.createSequentialGroup()
  1648.                                 .addComponent(jLabel26)
  1649.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1650.                                 .addComponent(jLabel27))
  1651.                             .addGroup(jPanel3Layout.createSequentialGroup()
  1652.                                 .addComponent(jLabel28)
  1653.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1654.                                 .addComponent(jLabel29))
  1655.                             .addGroup(jPanel3Layout.createSequentialGroup()
  1656.                                 .addComponent(jLabel31)
  1657.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1658.                                 .addComponent(jLabel32))
  1659.                             .addGroup(jPanel3Layout.createSequentialGroup()
  1660.                                 .addComponent(jLabel33)
  1661.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1662.                                 .addComponent(jLabel34))
  1663.                             .addComponent(jLabel36)
  1664.                             .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
  1665.                                 .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
  1666.                                     .addComponent(jLabel38)
  1667.                                     .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  1668.                                     .addComponent(jButton3))
  1669.                                 .addComponent(jLabel37, javax.swing.GroupLayout.Alignment.LEADING)))))
  1670.                 .addContainerGap(14, Short.MAX_VALUE))
  1671.         );
  1672.         jPanel3Layout.setVerticalGroup(
  1673.             jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1674.             .addGroup(jPanel3Layout.createSequentialGroup()
  1675.                 .addContainerGap()
  1676.                 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  1677.                     .addComponent(jLabel15)
  1678.                     .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
  1679.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1680.                 .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
  1681.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1682.                 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1683.                     .addGroup(jPanel3Layout.createSequentialGroup()
  1684.                         .addComponent(jLabel19)
  1685.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1686.                         .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
  1687.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1688.                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  1689.                             .addComponent(jLabel20)
  1690.                             .addComponent(jLabel21))
  1691.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1692.                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  1693.                             .addComponent(jLabel22)
  1694.                             .addComponent(jLabel23))
  1695.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1696.                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  1697.                             .addComponent(jLabel24)
  1698.                             .addComponent(jLabel25))
  1699.                         .addGap(1, 1, 1)
  1700.                         .addComponent(jLabel30)
  1701.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1702.                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  1703.                             .addComponent(jLabel26)
  1704.                             .addComponent(jLabel27))
  1705.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1706.                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  1707.                             .addComponent(jLabel28)
  1708.                             .addComponent(jLabel29))
  1709.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1710.                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  1711.                             .addComponent(jLabel31)
  1712.                             .addComponent(jLabel32))
  1713.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1714.                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  1715.                             .addComponent(jLabel33)
  1716.                             .addComponent(jLabel34))
  1717.                         .addGap(62, 62, 62)
  1718.                         .addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
  1719.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1720.                         .addComponent(jLabel35)
  1721.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1722.                         .addComponent(jSeparator7, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
  1723.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1724.                         .addComponent(jLabel36)
  1725.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1726.                         .addComponent(jLabel37)
  1727.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1728.                         .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  1729.                             .addComponent(jLabel38)
  1730.                             .addComponent(jButton3))
  1731.                         .addGap(15, 15, 15))
  1732.                     .addGroup(jPanel3Layout.createSequentialGroup()
  1733.                         .addComponent(jLabel16)
  1734.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1735.                         .addComponent(mineLocation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  1736.                         .addGap(18, 18, 18)
  1737.                         .addComponent(jLabel17)
  1738.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1739.                         .addComponent(firstRock, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  1740.                         .addGap(18, 18, 18)
  1741.                         .addComponent(jLabel18)
  1742.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1743.                         .addComponent(secondRock, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
  1744.                         .addGap(18, 18, 18)
  1745.                         .addComponent(chkthird)
  1746.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  1747.                         .addComponent(thirdRockLabel)
  1748.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  1749.                         .addComponent(thirdRock, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
  1750.                         .addContainerGap())
  1751.                     .addComponent(jSeparator3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 377, Short.MAX_VALUE)))
  1752.         );
  1753.  
  1754.         jTabbedPane1.addTab("Configuration", jPanel3);
  1755.  
  1756.         javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
  1757.         jPanel1.setLayout(jPanel1Layout);
  1758.         jPanel1Layout.setHorizontalGroup(
  1759.             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1760.             .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 569, Short.MAX_VALUE)
  1761.         );
  1762.         jPanel1Layout.setVerticalGroup(
  1763.             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1764.             .addComponent(jTabbedPane1)
  1765.         );
  1766.  
  1767.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  1768.         getContentPane().setLayout(layout);
  1769.         layout.setHorizontalGroup(
  1770.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1771.             .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  1772.         );
  1773.         layout.setVerticalGroup(
  1774.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  1775.             .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  1776.         );
  1777.  
  1778.         pack();
  1779.     }// </editor-fold>
  1780.  
  1781.         private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
  1782.             setVisible(false);
  1783.             stopScripts();
  1784.         }
  1785.  
  1786.         private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
  1787.             settings.location = mineLocation.getSelectedItem().toString();
  1788.                         settings.rock1 = firstRock.getSelectedItem().toString();
  1789.             settings.rock2 = secondRock.getSelectedItem().toString();
  1790.             settings.thirdRockCheck = chkthird.isSelected();
  1791.             settings.rock3 = thirdRock.getSelectedItem().toString();
  1792.             settings.save = chkSettings.isSelected();
  1793.            
  1794.             if(mineLocation.getSelectedItem() == "Varrock East"){
  1795.                 Place = "Varrock East";
  1796.                 bankID = 11402;
  1797.                 bankrocks = true;
  1798.                 power = false;
  1799.                 toPlace = new RSTile[] {new RSTile(3253, 3420),
  1800.                           new RSTile(3262, 3428), new RSTile(3275, 3427),
  1801.                           new RSTile(3285, 3420), new RSTile(3290, 3408),
  1802.                           new RSTile(3291, 3396), new RSTile(3293, 3385),
  1803.                           new RSTile(3291, 3374), new RSTile(3285, 3365)};
  1804.                 toBank = reversePath(toPlace);
  1805.                 bankTile = new RSTile(3253, 3420);
  1806.                 returnTo = new RSTile(3286, 3365);
  1807.                 runTo = new RSTile(3287, 3368);
  1808.             }else if(mineLocation.getSelectedItem() == "Varrock West"){
  1809.                 Place = "Varrock West";
  1810.                 bankID = 11402;
  1811.                 bankrocks = true;
  1812.                 power = false;
  1813.                 toPlace = new RSTile[] {new RSTile(3184, 3437),
  1814.                         new RSTile(3183, 3429), new RSTile(3173, 3426),
  1815.                         new RSTile(3172, 3414), new RSTile(3171, 3401),
  1816.                         new RSTile(3176, 3389), new RSTile(3182, 3380),
  1817.                         new RSTile(3181, 3371)};
  1818.                 toBank = reversePath(toPlace);
  1819.                 bankTile = new RSTile(3182, 3438);
  1820.                 returnTo = new RSTile(3180, 3371);
  1821.                 runTo = new RSTile(3180, 3381);
  1822.             }else if(mineLocation.getSelectedItem() == "Al Kharid"){
  1823.                 Place = "Al Kharid";
  1824.                 bankID = 35647;
  1825.                 bankrocks = true;
  1826.                 power = false;
  1827.                 toPlace = new RSTile[] {new RSTile(3269, 3167),
  1828.                          new RSTile(3277, 3175), new RSTile(3282, 3189),
  1829.                          new RSTile(3283, 3204), new RSTile(3289, 3217),
  1830.                          new RSTile(3291, 3233), new RSTile(3292, 3249),
  1831.                          new RSTile(3295, 3264), new RSTile(3293, 3278),
  1832.                          new RSTile(3299, 3294), new RSTile(3298, 3301)};
  1833.                 toBank = reversePath(toPlace);
  1834.                 bankTile = new RSTile(3269, 3168);
  1835.                 returnTo = new RSTile(3300, 3304);
  1836.                 runTo = new RSTile(3289, 3304);
  1837.             }else if(mineLocation.getSelectedItem() == "Rimmington"){
  1838.                 Place = "Rimmington";
  1839.                 bankID = 11758;
  1840.                 bankrocks = true;
  1841.                 power = false;
  1842.                 toBank = new RSTile[] {new RSTile(2976, 3240),
  1843.                         new RSTile(2975, 3249), new RSTile(2977, 3263),
  1844.                         new RSTile(2981, 3274), new RSTile(2987, 3288),
  1845.                         new RSTile(2995, 3302), new RSTile(2999, 3311),
  1846.                         new RSTile(3007, 3320), new RSTile(3008, 3333),
  1847.                         new RSTile(3007, 3346), new RSTile(3012, 3355)};
  1848.                 bankTile = new RSTile(3012, 3355);
  1849.                 toPlace = reversePath(toBank);
  1850.                 returnTo = new RSTile(2976, 3240);
  1851.                 runTo = new RSTile(2977, 3251);
  1852.             }else if(mineLocation.getSelectedItem() == "Barbarian Village"){
  1853.                 Place = "Barbarian Village";
  1854.                 bankID = 26972;
  1855.                 bankrocks = true;
  1856.                 power = false;
  1857.                 toBank = new RSTile[] {new RSTile(3081, 3423),
  1858.                          new RSTile(3084, 3437), new RSTile(3091, 3449),
  1859.                          new RSTile(3099, 3464), new RSTile(3099, 3478),
  1860.                          new RSTile(3093, 3490)};
  1861.                 bankTile = new RSTile(3094, 3491);
  1862.                 toPlace = reversePath(toBank);
  1863.                 returnTo = new RSTile(3081, 3423);
  1864.                 runTo = new RSTile(3076, 3433);
  1865.             }else if(mineLocation.getSelectedItem() == "Mining Guild"){
  1866.                 Place = "Mining Guild";
  1867.                 bankID = 11758;
  1868.                 bankrocks = true;
  1869.                 power = false;
  1870.                 bankTile = new RSTile(3012, 3355);
  1871.                 returnTo = new RSTile(3043, 9737);
  1872.             }else if(mineLocation.getSelectedItem() == "West Lumbridge Swamp"){
  1873.                 Place = "West Lumby Swamp";
  1874.                 bankID = 2213;
  1875.                 bankrocks = true;
  1876.                 power = false;
  1877.                 toBank = new RSTile[] {new RSTile(3146, 3148),
  1878.                          new RSTile(3149, 3158), new RSTile(3144, 3167),
  1879.                          new RSTile(3141, 3181), new RSTile(3140, 3194),
  1880.                          new RSTile(3136, 3207), new RSTile(3121, 3211),
  1881.                          new RSTile(3112, 3222), new RSTile(3106, 3235),
  1882.                          new RSTile(3093, 3243)};
  1883.                 bankTile = new RSTile(3092, 3244);
  1884.                 toPlace = reversePath(toBank);
  1885.                 returnTo = new RSTile(3147, 3149);
  1886.                 runTo = new RSTile(3162, 3151);
  1887.             }else if(mineLocation.getSelectedItem() == "Power-Mining"){
  1888.                 Place = "Anywhere";
  1889.                 bankrocks = false;
  1890.                 power = true;
  1891.             }
  1892.  
  1893.             if(firstRock.getSelectedItem() == "Tin"){
  1894.                 rockOne = Tin;
  1895.                 rockOne1 = "Tin";
  1896.             }else if(firstRock.getSelectedItem() == "Copper"){
  1897.                 rockOne = Copper;
  1898.                 rockOne1 = "Copper";
  1899.             }else if(firstRock.getSelectedItem() == "Clay"){
  1900.                 rockOne = Clay;
  1901.                 rockOne1 = "Clay";
  1902.             }else if(firstRock.getSelectedItem() == "Iron"){
  1903.                 rockOne = Iron;
  1904.                 rockOne1 = "Iron";
  1905.             }else if(firstRock.getSelectedItem() == "Silver"){
  1906.                 rockOne = Silver;
  1907.                 rockOne1 = "Silver";
  1908.             }else if(firstRock.getSelectedItem() == "Gold"){
  1909.                 rockOne = Gold;
  1910.                 rockOne1 = "Gold";
  1911.             }else if(firstRock.getSelectedItem() == "Coal"){
  1912.                 rockOne = Coal;
  1913.                 rockOne1 = "Coal";
  1914.             }else if(firstRock.getSelectedItem() == "Mithril"){
  1915.                 rockOne = Mithril;
  1916.                 rockOne1 = "Mithril";
  1917.             }else if(firstRock.getSelectedItem() == "Adamant"){
  1918.                 rockOne = Adamant;
  1919.                 rockOne1 = "Adamant";
  1920.             }
  1921.  
  1922.             if(secondRock.getSelectedItem() == "Tin"){
  1923.                 rockTwo = Tin;
  1924.                 rockTwo2 = "Tin";
  1925.             }else if(secondRock.getSelectedItem() == "Copper"){
  1926.                 rockTwo = Copper;
  1927.                 rockTwo2 = "Copper";
  1928.             }else if(secondRock.getSelectedItem() == "Clay"){
  1929.                 rockTwo = Clay;
  1930.                 rockTwo2 = "Clay";
  1931.             }else if(secondRock.getSelectedItem() == "Iron"){
  1932.                 rockTwo = Iron;
  1933.                 rockTwo2 = "Iron";
  1934.             }else if(secondRock.getSelectedItem() == "Silver"){
  1935.                 rockTwo = Silver;
  1936.                 rockTwo2 = "Silver";
  1937.             }else if(secondRock.getSelectedItem() == "Gold"){
  1938.                 rockTwo = Gold;
  1939.                 rockTwo2 = "Gold";
  1940.             }else if(secondRock.getSelectedItem() == "Coal"){
  1941.                 rockTwo = Coal;
  1942.                 rockTwo2 = "Coal";
  1943.             }else if(secondRock.getSelectedItem() == "Mithril"){
  1944.                 rockTwo = Mithril;
  1945.                 rockTwo2 = "Mithril";
  1946.             }else if(secondRock.getSelectedItem() == "Adamant"){
  1947.                 rockTwo = Adamant;
  1948.                 rockTwo2 = "Adamant";
  1949.             }else if(secondRock.getSelectedItem() == "None"){
  1950.                 rockTwo = rockOne;
  1951.                 rockTwo2 = "None";
  1952.             }
  1953.  
  1954.             if(chkthird.isSelected()){
  1955.                 if(thirdRock.getSelectedItem() == "Tin"){
  1956.                     rockThree = Tin;
  1957.                     rockThree3 = "Tin";
  1958.                 }else if(thirdRock.getSelectedItem() == "Copper"){
  1959.                     rockThree = Copper;
  1960.                     rockThree3 = "Copper";
  1961.                 }else if(thirdRock.getSelectedItem() == "Clay"){
  1962.                     rockThree = Clay;
  1963.                     rockThree3 = "Clay";
  1964.                 }else if(thirdRock.getSelectedItem() == "Iron"){
  1965.                     rockThree = Iron;
  1966.                     rockThree3 = "Iron";
  1967.                 }else if(thirdRock.getSelectedItem() == "Silver"){
  1968.                     rockThree = Silver;
  1969.                     rockThree3 = "Silver";
  1970.                 }else if(thirdRock.getSelectedItem() == "Gold"){
  1971.                     rockThree = Gold;
  1972.                     rockThree3 = "Gold";
  1973.                 }else if(thirdRock.getSelectedItem() == "Coal"){
  1974.                     rockThree = Coal;
  1975.                     rockThree3 = "Coal";
  1976.                 }else if(thirdRock.getSelectedItem() == "Mithril"){
  1977.                     rockThree = Mithril;
  1978.                     rockThree3 = "Mithril";
  1979.                 }else if(thirdRock.getSelectedItem() == "Adamant"){
  1980.                     rockThree = Adamant;
  1981.                     rockThree3 = "Adamant";
  1982.                 }else if(thirdRock.getSelectedItem() == "None"){
  1983.                     rockThree = rockOne;
  1984.                     rockThree3 = "None";
  1985.                 }
  1986.             }else if(!chkthird.isSelected()){
  1987.                 rockThree = rockOne;
  1988.                 rockThree3 = "None";
  1989.             }
  1990.                         if (chkSettings.isSelected()) {
  1991.                                 try {
  1992.                                         settings.saveSettings(settings.getSettingsArray(),
  1993.                                                         SETTINGS_FILE_NAME);
  1994.                                         log("Successfully saved settings at " + SETTINGS_FILE_NAME);
  1995.                                 } catch (final Exception e) {
  1996.                                         log("saving settings error");
  1997.                                 }
  1998.                         }
  1999.             setVisible(false);
  2000.             startScript = true;
  2001.         }
  2002.  
  2003.         private void chkthirdActionPerformed(java.awt.event.ActionEvent evt) {
  2004.             if(chkthird.isSelected()){
  2005.                 thirdRock.setVisible(true);
  2006.                 thirdRockLabel.setVisible(true);
  2007.             }else if(!chkthird.isSelected()){
  2008.                 thirdRock.setVisible(false);
  2009.                 thirdRockLabel.setVisible(false);
  2010.             }
  2011.         }
  2012.  
  2013.     private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
  2014.         URLConnection url = null;
  2015.         BufferedReader in = null;
  2016.         BufferedWriter out = null;
  2017.         //Ask the user if they'd like to check for an update...
  2018.         if(JOptionPane.showConfirmDialog(null, "Would you like to check for updates?\nPlease Note this requires an internet connection and the script will write files to your harddrive!") == 0){ //If they would, continue
  2019.             try{
  2020.                 //Open the version text file
  2021.                 url = new URL("http://hillsideib.110mb.com/scripts/WorldWideMinerVERSION.txt").openConnection();
  2022.                 //Create an input stream for it
  2023.                 in = new BufferedReader(new InputStreamReader(url.getInputStream()));
  2024.                 //Check if the current version is outdated
  2025.                 if(Double.parseDouble(in.readLine()) > getVersion()) {
  2026.                     //If it is, check if the user would like to update.
  2027.                     if(JOptionPane.showConfirmDialog(null, "Update found. Do you want to update?") == 0){
  2028.                         //If so, allow the user to choose the file to be updated.
  2029.                            JOptionPane.showMessageDialog(null, "Please choose 'WorldWideMiner.java' in your scripts folder and hit 'Open'");
  2030.                            JFileChooser fc = new JFileChooser();
  2031.                            //Make sure "Open" was clicked.
  2032.                            if(fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION){
  2033.                                //If so, set up the URL for the .java file and set up the IO.
  2034.                                url = new URL("http://hillsideib.110mb.com/scripts/WorldWideMiner.java").openConnection();
  2035.                             in = new BufferedReader(new InputStreamReader(url.getInputStream()));
  2036.                             out = new BufferedWriter(new FileWriter(fc.getSelectedFile().getPath()));
  2037.                             String inp;
  2038.                             /* Until we reach the end of the file, write the next line in the file
  2039.                              * and add a new line. Then flush the buffer to ensure we lose
  2040.                              * no data in the process.
  2041.                              */
  2042.                             while((inp = in.readLine()) != null){
  2043.                                 out.write(inp);
  2044.                                 out.newLine();
  2045.                                 out.flush();
  2046.                             }
  2047.                             //Notify the user that the script has been updated, and a recompile and reload is needed.
  2048.                                log("Script successfully downloaded. Please recompile and reload your scripts!");
  2049.                            } else log("Update canceled");
  2050.                     } else log("Update canceled");
  2051.                 } else
  2052.                     JOptionPane.showMessageDialog(null, "You have the latest version. :)"); //User has the latest version. Tell them!
  2053.                 if(in != null)
  2054.                     in.close();
  2055.                 if(out != null)
  2056.                     out.close();
  2057.             } catch (IOException e){
  2058.                 log("Problem getting version :/");
  2059.             }
  2060.         }
  2061.     }
  2062.    
  2063.         private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
  2064.             if (settings.settingsExist(SETTINGS_FILE_NAME)) {
  2065.                 try {
  2066.                     settings.setSettings();
  2067.                     firstRock.setSelectedItem(settings.rock1);
  2068.                     secondRock.setSelectedItem(settings.rock2);
  2069.                     mineLocation.setSelectedItem(settings.location);
  2070.                         chkthird.setSelected(settings.thirdRockCheck);
  2071.                     chkSettings.setSelected(settings.save);
  2072.                     if (settings.thirdRockCheck) {
  2073.                         thirdRock.setSelectedItem(settings.rock3);
  2074.                     }
  2075.                 } catch (final Exception e) {
  2076.                     log("error getting settings: " + e);
  2077.                 }
  2078.             } else {
  2079.             }
  2080.         }
  2081.    // Variables declaration - do not modify
  2082.     private javax.swing.JCheckBox chkSettings;
  2083.     private javax.swing.JCheckBox chkthird;
  2084.     private javax.swing.JComboBox firstRock;
  2085.     private javax.swing.JButton jButton1;
  2086.     private javax.swing.JButton jButton2;
  2087.     private javax.swing.JButton jButton3;
  2088.     private javax.swing.JButton jButton4;
  2089.     private javax.swing.JLabel jLabel1;
  2090.     private javax.swing.JLabel jLabel10;
  2091.     private javax.swing.JLabel jLabel11;
  2092.     private javax.swing.JLabel jLabel12;
  2093.     private javax.swing.JLabel jLabel13;
  2094.     private javax.swing.JLabel jLabel14;
  2095.     private javax.swing.JLabel jLabel15;
  2096.     private javax.swing.JLabel jLabel16;
  2097.     private javax.swing.JLabel jLabel17;
  2098.     private javax.swing.JLabel jLabel18;
  2099.     private javax.swing.JLabel jLabel19;
  2100.     private javax.swing.JLabel jLabel2;
  2101.     private javax.swing.JLabel jLabel20;
  2102.     private javax.swing.JLabel jLabel21;
  2103.     private javax.swing.JLabel jLabel22;
  2104.     private javax.swing.JLabel jLabel23;
  2105.     private javax.swing.JLabel jLabel24;
  2106.     private javax.swing.JLabel jLabel25;
  2107.     private javax.swing.JLabel jLabel26;
  2108.     private javax.swing.JLabel jLabel27;
  2109.     private javax.swing.JLabel jLabel28;
  2110.     private javax.swing.JLabel jLabel29;
  2111.     private javax.swing.JLabel jLabel3;
  2112.     private javax.swing.JLabel jLabel30;
  2113.     private javax.swing.JLabel jLabel31;
  2114.     private javax.swing.JLabel jLabel32;
  2115.     private javax.swing.JLabel jLabel33;
  2116.     private javax.swing.JLabel jLabel34;
  2117.     private javax.swing.JLabel jLabel35;
  2118.     private javax.swing.JLabel jLabel36;
  2119.     private javax.swing.JLabel jLabel37;
  2120.     private javax.swing.JLabel jLabel38;
  2121.     private javax.swing.JLabel jLabel4;
  2122.     private javax.swing.JLabel jLabel5;
  2123.     private javax.swing.JLabel jLabel6;
  2124.     private javax.swing.JLabel jLabel7;
  2125.     private javax.swing.JLabel jLabel8;
  2126.     private javax.swing.JLabel jLabel9;
  2127.     private javax.swing.JPanel jPanel1;
  2128.     private javax.swing.JPanel jPanel2;
  2129.     private javax.swing.JPanel jPanel3;
  2130.     private javax.swing.JSeparator jSeparator1;
  2131.     private javax.swing.JSeparator jSeparator2;
  2132.     private javax.swing.JSeparator jSeparator3;
  2133.     private javax.swing.JSeparator jSeparator4;
  2134.     private javax.swing.JSeparator jSeparator6;
  2135.     private javax.swing.JSeparator jSeparator7;
  2136.     private javax.swing.JTabbedPane jTabbedPane1;
  2137.     private javax.swing.JComboBox mineLocation;
  2138.     private javax.swing.JComboBox secondRock;
  2139.     private javax.swing.JComboBox thirdRock;
  2140.     private javax.swing.JLabel thirdRockLabel;
  2141.     // End of variables declaration
  2142.  
  2143. }
  2144. }