Advertisement
Guest User

FFXCheater

a guest
Mar 24th, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.27 KB | None | 0 0
  1. import java.awt.AWTException;
  2. import java.awt.Color;
  3. import java.awt.Robot;
  4. import java.awt.event.KeyEvent;
  5.  
  6. public class FFXCheater {
  7.  
  8.     public static void main(String[] args) throws AWTException {
  9.         final Robot r = new Robot();
  10.         new Thread() {
  11.  
  12.             @Override
  13.             public void run() {
  14.                 int i = 0;
  15.                 while (true) {
  16.                     Color c = r.getPixelColor(600, 500);
  17.                     if (isWhite(c)) {
  18.                         wait(50 + getRandom(5));
  19.                         r.keyPress(KeyEvent.VK_SPACE);
  20.                         i++;
  21.                         System.out.println("SPAZIO! (" + i + ")");
  22.                         wait(1000);
  23.                     }
  24.                     wait(10);
  25.                 }
  26.             }
  27.  
  28.             private boolean isWhite(Color c) {
  29.                 return c.getRed() > 150 && c.getGreen() > 150 && c.getBlue() > 150;
  30.             }
  31.  
  32.             private void wait(int i) {
  33.                 try {
  34.                     sleep(i);
  35.                 } catch (InterruptedException ex) {
  36.                 }
  37.             }
  38.  
  39.             private int getRandom(int e) {
  40.                 return (int) (Math.random() * 2 * e) - e;
  41.             }
  42.         }.start();
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement