use of com.laytonsmith.core.events.EventMixinInterface in project CommandHelper by EngineHub.
the class ExtensionTracker method registerEvent.
public void registerEvent(Event e) {
if (e instanceof AbstractEvent) {
AbstractEvent ae = (AbstractEvent) e;
// Get the mixin for this server, and add it to e
Class mixinClass = StaticLayer.GetServerEventMixin();
try {
Constructor mixinConstructor = mixinClass.getConstructor(AbstractEvent.class);
EventMixinInterface mixin = (EventMixinInterface) mixinConstructor.newInstance(e);
ae.setAbstractEventMixin(mixin);
} catch (Exception ex) {
// This is a serious problem, and it should kill the plugin, for fast failure detection.
throw new Error("Could not properly instantiate the mixin class. " + "The constructor with the signature \"public " + mixinClass.getSimpleName() + "(AbstractEvent e)\" is missing" + " from " + mixinClass.getName());
}
}
// Finally, add it to the list, and hook it.
if (!events.containsKey(e.driver())) {
events.put(e.driver(), new TreeSet<Event>());
}
events.get(e.driver()).add(e);
}
Aggregations