- Joined
 - Mar 29, 2016
 
- Messages
 - 54
 
- Thread Author
 - #1
 
I'm trying to use the EventDispatcher (com.runemate.game.api.script.framework.core.EventDispatcher) to fire a custom event I created.
It's not working (its not dispaching) and I can't figure it out why.
Custom Event:
	
	
	
		
Event Listener Interface:
	
	
	
		
Usage:
	
	
	
		
Fire Event:
	
	
	
		
			
			It's not working (its not dispaching) and I can't figure it out why.
Custom Event:
		Code:
	
	package com.TheVTM.bots.BonePrayer.Events;
import com.TheVTM.bots.BonePrayer.UserConfiguration;
import java.util.EventObject;
public class ConfigurationEvent extends EventObject {
    public UserConfiguration userConfiguration;
    public ConfigurationEvent(Object source, UserConfiguration userConfiguration) {
        super(source);
        this.userConfiguration = userConfiguration;
    }
}
	Event Listener Interface:
		Code:
	
	package com.TheVTM.bots.BonePrayer.Events.Listeners;
import com.TheVTM.bots.BonePrayer.Events.ConfigurationEvent;
import java.util.EventListener;
public interface ConfigurationListener extends EventListener {
    public void onConfiguration(ConfigurationEvent event);
}
	Usage:
		Code:
	
	public class Statistics implements ConfigurationListener {
public Statistics() {
  // Register Listeners
  Environment.getScript().getEventDispatcher().addListener(this);
}
@Override
public void onConfiguration(ConfigurationEvent event) {
  LOGGER.log(Level.CONFIG, "Configuring Statistics...");
  // Initialize variables
  initialLevel = Skill.PRAYER.getBaseLevel();
  initialExperiece = Skill.PRAYER.getExperience();
  bonesCounter = 0;
  startTime = System.currentTimeMillis();
}
}
	Fire Event:
		Code:
	
	public class BonePrayer extends TaskScript {
@Override
public void onStart(String...a) {
  super.onStart(a);
  ConfigurationEvent configurationEvent = new ConfigurationEvent(this,
   new UserConfiguration(Players.getLocal().getPosition(), 7));
  getEventDispatcher().process(configurationEvent);
}
}
	




