1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Message Listener

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

  1. tnwrestler360

    Joined:
    Jul 31, 2014
    Messages:
    8
    Likes Received:
    0
    So I have the listener implemented now, this is my on message recieved:
    Code (Text):
    1.  
    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.         }
    19.        
    20.     }
    21.  
    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. Wyn

    Wyn

    Joined:
    Jul 10, 2014
    Messages:
    65
    Likes Received:
    7
    Impliment messagelistener.
    Double check the messagetype.

    And please remove that list of else ifs.
     
  3. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    getEventDispatcher().addListener(this) will register the listener with the dispatcher.
     
  4. Wyn

    Wyn

    Joined:
    Jul 10, 2014
    Messages:
    65
    Likes Received:
    7
    I assume he already used that for drawing lul >.>
     
  5. tnwrestler360

    Joined:
    Jul 31, 2014
    Messages:
    8
    Likes Received:
    0
    I knew someone would say something lol. Be polite, it's the support section, I am not releasing snippets here.
     
  6. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    Don't worry about him :p, did any of the suggestions help?
     
  7. tnwrestler360

    Joined:
    Jul 31, 2014
    Messages:
    8
    Likes Received:
    0
    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

Loading...