Tsopic Posted April 16, 2014 Share Posted April 16, 2014 How to make a method which does something when game returns certian message. Link to comment Share on other sites More sharing options...
Guest Apogee Posted April 16, 2014 Share Posted April 16, 2014 public void onMessage(String message) throws InterruptedException { if (message.contains("You manage to mine some")) { log("cookies.") } If i mine some ore in-game, and i get a game message that has the text "you manage to mine some", then it will output with something in the If statement. In this case, if i mine something, then the log will display "cookies." I hope i helped. Link to comment Share on other sites More sharing options...
Deffiliate Posted April 16, 2014 Share Posted April 16, 2014 (edited) public void onMessage(String message) throws InterruptedException { if (message.contains("You manage to mine some")) { log("cookies.") } If i mine some ore in-game, and i get a game message that has the text "you manage to mine some", then it will output with something in the If statement. In this case, if i mine something, then the log will display "cookies." I hope i helped. This^ Also, you should note that you don't actually want to perform any actions inside of the onMessage(). Use the message you receive to assign certain variables a value, or determine what you SHOULD do. Edited April 16, 2014 by Deffiliate Link to comment Share on other sites More sharing options...