- Joined
- Feb 23, 2021
- Messages
- 4
- Thread Author
- #1
Hi,
For the life of me I cant get the EventListeners to work.
I found this post which I think steered me in right direction, but still I cant log out anything in the event methods and my debugger wont stick inside those methods either. But it did not seem to help me.
Resolved - Event listener not firing?
Any suggestions or examples on this matter?
This is my EventListener
And this is my Main bot
For the life of me I cant get the EventListeners to work.
I found this post which I think steered me in right direction, but still I cant log out anything in the event methods and my debugger wont stick inside those methods either. But it did not seem to help me.
Resolved - Event listener not firing?
Any suggestions or examples on this matter?
This is my EventListener
Code:
@NoArgsConstructor
public class PrayerFlick implements EngineListener {
@Override
public void onCycleStart() {
Environment.getBot().getLogger().info("Experience gained 1");
}
@Override
public void onTickStart() {
Environment.getBot().getLogger().info("Experience gained 2");
}
@Override
public void onEngineStateChanged(EngineStateEvent event) {
Environment.getBot().getLogger().info("Experience gained 3" + event.toString());
}
}
And this is my Main bot
Code:
public class RunBot extends TreeBot {
public PrayerFlick prayerFlick = new PrayerFlick();
public EmptyRoot emptyRoot = new EmptyRoot();
public void onStart(String... arguments) {
this.getEventDispatcher().addListener(prayerFlick);
Environment.getBot().getLogger().info("Done");
}
@Override
public LeafTask createRootTask() {
return emptyRoot;
}
}
Last edited: