Jump to content

Log Says the correct 1234 but goes straight to else.


Recommended Posts

Posted

So Im trying to add the bot if i get messaged 1234 but when i check for 1234 it goes straight to else and the log of the text i checked for says 1234.

 

 public void onMessage(Message message) throws InterruptedException {
    	if(message.getType() == Message.MessageType.GAME){
        	Integer text = Integer.parseInt(message.getMessage());
          	if(text == 1234) {
          		AddFriend(message.getUsername());
          	} else {
          		log(text);
          	}
        }
}

//Also tried this for line 3 and 4.
Integer text = message.getMessage();
if(text == "1234") {

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...