Jump to content

Log Says the correct 1234 but goes straight to else.


Oliver Queen

Recommended Posts

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") {

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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