Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package jaclib.runtime_exception;
- import java.awt.Graphics;
- import java.util.concurrent.TimeUnit;
- import javax.swing.JOptionPane;
- import jaclib.hardware_heap.Bot;
- import jdk.internal.dynalink.support.BottomGuardingDynamicLinker;
- import com.Class360;
- import com.Class63;
- import com.client;
- import bot.utils.Item;
- import bot.utils.Tile;
- /**
- *
- * @author Milkshakeboy22 Script: Woodcutting
- *
- */
- public class Woodcutting extends Script {
- private String username; // remembers username login
- private String password; // remembers password login
- private static long timeBegan; // used for total-time run on script
- private static long timeRan; // used for total-time run on script
- @Override
- public boolean onStart() {
- timeBegan = System.currentTimeMillis();
- this.username = Class360.username;
- this.password = Class360.password;
- /**
- * JOptionPane for tree selection
- */
- JOptionPane.showMessageDialog(null,
- "Please note: you will need to be in the area of the tree before starting the script.");
- String[] selectionValues = { "Willow" };
- String initialSelection = "Willow";
- String selection = (String) JOptionPane.showInputDialog(null, "Select the tree you would like to cut?",
- "Milkshakeboy22s Woodcutting Bot", JOptionPane.QUESTION_MESSAGE, null, selectionValues,
- initialSelection);
- return started;
- }
- public void run() {
- super.run();
- try {
- setTimeRan(System.currentTimeMillis() - this.timeBegan);
- /**
- * Auto-login if kicked/disconnected
- */
- if (client.WINDOW_PANE_ID * -257444687 == 744) {
- Bot.sendConsoleMessage("Oh dear, something went wrong! We are attempting to log back in.");
- login();
- }
- /**
- * Check to see if user has correct woodcutting level to chop tree selected
- */
- if (Bot.WOODCUTTING < 29) {
- Bot.sendConsoleMessage("You do not have the requirements to woodcut: Willow");
- Thread.sleep(8000);
- } else {
- if (Bot.WOODCUTTING > 29);
- Bot.sendConsoleMessage("We are clicking the tree: Willow");
- Bot.clickObject(38616, new Tile(3082, 3238, 1), 1);
- }
- private final void login() {
- Class63.method741(username, password, 2101690439);
- }
- public static String ft(long duration) {
- String res = "";
- long days = TimeUnit.MILLISECONDS.toDays(duration);
- long hours = TimeUnit.MILLISECONDS.toHours(duration)
- - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration));
- long minutes = TimeUnit.MILLISECONDS.toMinutes(duration)
- - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration));
- long seconds = TimeUnit.MILLISECONDS.toSeconds(duration)
- - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration));
- if (days == 0) {
- res = (hours + ":" + minutes + ":" + seconds);
- } else {
- res = (days + ":" + hours + ":" + minutes + ":" + seconds);
- }
- return res;
- }
- @Override
- public void onRepaint(Graphics g) {
- }
- public static long getTimeRan() {
- return timeRan;
- }
- public void setTimeRan(long timeRan) {
- this.timeRan = timeRan;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement