Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Message Listener

Joined
Jul 31, 2014
Messages
8
So I have the listener implemented now, this is my on message recieved:
Code:
public void onMessageReceived(MessageEvent e) {
        String message = e.getMessage();
        if(e.getType()==MessageEvent.Type.SERVER){
            if(message.contains("boots")&&toAlchID==items[0]){
                rightCupboard =true;
            }else if(message.contains("kiteshield")&&toAlchID==items[1]){
                rightCupboard = true;
            }else if(message.contains("helm")&&toAlchID==items[2]){
                rightCupboard = true;
            }else if(message.contains("Emerald")&&toAlchID==items[3]){
                rightCupboard = true;
            }else if(message.contains("longsword")&&toAlchID==items[4]){
                rightCupboard = true;
            }else{
                rightCupboard = false;
            }
        }
       
    }
The problem is I don't think the listener is ever getting the message. Is there something I have to put in my onStart to start the listener?
 

wyn

Joined
Jul 10, 2014
Messages
65
Impliment messagelistener.
Double check the messagetype.

And please remove that list of else ifs.
 
Engineer
Joined
Jul 28, 2013
Messages
2,776
getEventDispatcher().addListener(this) will register the listener with the dispatcher.
 
Joined
Jul 31, 2014
Messages
8
Don't worry about him :p, did any of the suggestions help?
Just trying to call him out so others aren't afraid to post their code in the Support section. I just got off of work, but I am almost positive its the Message type if block now. I will keep you updated. Thanks again!
 
Top