Robot java and program blocking the clicks of the same

2

I'm making a very simple robot for a game. my code:

if(e.getKeyChar() == 'e'){

Point p = new Point();
p = MouseInfo.getPointerInfo().getLocation();
textField1.setText(""+p.x);  
textField2.setText(""+p.y);
}

if(e.getKeyChar() == 's'){
try {
   Robot robot = new Robot();
   robot.delay(3000);         
robot.mouseMove(Integer.parseInt(textField1.getText()),Integer.parseInt(textField2.getText()));
   robot.mousePress(InputEvent.BUTTON1_MASK);
   robot.mouseRelease(InputEvent.BUTTON1_MASK);
   robot.delay(1000); 

   } catch (AWTException ex) {
        Logger.getLogger(Tela.class.getName()).log(Level.SEVERE, null, ex);
   }

Finally, this is an excerpt of the code, which is the mouse coordinate, and when you press S , it moves the mouse and clicks. very simple.

It works fine, however, inside the game, it does not work. apparently, the game knows that it is coming from a "robot" and not from a user, hence blocks the command. Is there another way to do this?

I mentioned the xpadder program because it works. ie, is it possible to perform in any other way that works?

    
asked by anonymous 19.06.2016 / 20:10

0 answers