Message Listener

Discussion in 'Developer Support' started by tnwrestler360, Aug 1, 2014.

  1. So I have the listener implemented now, this is my on message recieved:
    Code (Text):
    2. public void onMessageReceived(MessageEvent e) {
    3.         String message = e.getMessage();
    4.         if(e.getType()==MessageEvent.Type.SERVER){
    5.             if(message.contains("boots")&&toAlchID==items[0]){
    6.                 rightCupboard =true;
    7.             }else if(message.contains("kiteshield")&&toAlchID==items[1]){
    8.                 rightCupboard = true;
    9.             }else if(message.contains("helm")&&toAlchID==items[2]){
    10.                 rightCupboard = true;
    11.             }else if(message.contains("Emerald")&&toAlchID==items[3]){
    12.                 rightCupboard = true;
    13.             }else if(message.contains("longsword")&&toAlchID==items[4]){
    14.                 rightCupboard = true;
    15.             }else{
    16.                 rightCupboard = false;
    17.             }
    18.         }
    20.     }
    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?
  2. Impliment messagelistener.
    Double check the messagetype.

    And please remove that list of else ifs.
  3. getEventDispatcher().addListener(this) will register the listener with the dispatcher.
  4. I assume he already used that for drawing lul >.>
  5. I knew someone would say something lol. Be polite, it's the support section, I am not releasing snippets here.
  6. Don't worry about him :p, did any of the suggestions help?
  7. 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!

Share This Page