/** * Hops to specified location. * * @param x x * @param y y */ public static void hop(int x, int y) { last.move(x, y); com.infibot.client.accessors.Mouse m = Game.getClient().getMouse(); m.mouseMoved( new MouseEvent( Game.getCanvas(), MouseEvent.MOUSE_MOVED, System.currentTimeMillis(), 0, x, y, 0, false)); }
/** * Left or right clicks with the mouse. * * @param left boolean indicating left-click or right-click */ public static void click(boolean left) { com.infibot.client.accessors.Mouse m = Game.getClient().getMouse(); m.mousePressed( new MouseEvent( Game.getCanvas(), MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), 0, last.x, last.y, 1, false, left ? MouseEvent.BUTTON1 : MouseEvent.BUTTON3)); Task.sleep(Random.nextGaussian(100, 50)); long l = System.currentTimeMillis(); m.mouseReleased( new MouseEvent( Game.getCanvas(), MouseEvent.MOUSE_RELEASED, l, 0, last.x, last.y, 1, false)); m.mouseClicked( new MouseEvent(Game.getCanvas(), MouseEvent.MOUSE_CLICKED, l, 0, last.x, last.y, 1, false)); }