Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SomeCrazyEvent extends Event<SomeCrazyEventListener>
- {
- public void notify(SomeCrazyEventListener listener) {
- listener.onSomeCrazyEvent(this); // This way classes can listen to multiple events
- }
- }
- class SomeClass implements SomeCrazyEventListener
- {
- public SomeClass() {
- EventManager.subscribe(SomeCrazyEvent.Class, this);
- }
- public void onSomeCrazyEvent(SomeCrazyEvent event) {
- // do event
- }
- }
- EventManager.notify(new SomeCrazyEvent(foobar));
Add Comment
Please, Sign In to add comment