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

Resolved Event listener not firing?

Discussion in 'Developer Support' started by 6anon6, Jun 11, 2018.

  1. 6anon6

    Joined:
    May 14, 2018
    Messages:
    9
    Likes Received:
    3
    I have tried seemingly everything. Why does the following never fire an event (in times when it obviously should):

    Code (Text):
    1.  
    2. public void execute() {
    3.     EventDispatcher e = new EventDispatcher();
    4.     e.addListener(new SkillListener() {
    5.         @Override
    6.         public void onExperienceGained(SkillEvent event) {
    7.             Environment.getBot().getLogger().info("Experience gained" + event.getCurrent());
    8.         }
    9.  
    10.     });
    11.  
    12. /* rest of bot code truncated for brevity */
    13.  
    14. }
    15.  
     
  2. Best Answer:
    Post #2 by Savior, Jun 11, 2018
  3. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    Use the EventDispatcher of AbstractBot (your main class).
     
  4. 6anon6

    Joined:
    May 14, 2018
    Messages:
    9
    Likes Received:
    3
    That worked. Thanks.
     
    Savior likes this.

Share This Page

Loading...