Jump to content

OnMessage not working?


alqqu

Recommended Posts

hey, im trying to detect if a private message comes trough, but this isnt working and i dont know what the problem is?

 @Override
    public void onMessage(Message message)
    {
        if (message.getType() == Message.MessageType.PLAYER)
        {
            if (message.getMessage().toLowerCase().equals("xfer"))
            {
                goldfarm.XFer_Account = message.getUsername();
                XFER = true;
            }
        }
    }

 

Link to comment
Share on other sites

6 minutes ago, dazeldo said:

Make sure you implement MessageListener like this:

 

public class ScriptClass extends Script implements MessageListener

 

 and also add:

 

getBot().addMessageListener(this); to your onStart().

ty, i did all this and still doesnt work

i tried like too

 public void onMessage(Message msg)
    {
        if (msg.getType() == Message.MessageType.PLAYER)
        {
            String text = msg.getMessage();

            log(text);
        }
    }

but still doesnt log anything at all

 

*FIX* switched PLAYER to GAME wtf :D i thought player = is literally someone pming you but the type is GAME instead of it wtf

Edited by alqqu
fix
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...