Jump to content

OnMessage not working?


Recommended Posts

Posted

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;
            }
        }
    }

 

Posted (edited)
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
Posted
23 hours 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().

Btw, that doesn't actually do anything, it's redundant.

Spoiler

97% sure l0l

 

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...