Skip to content

Better event system using ASM #284

@SoniEx2

Description

@SoniEx2

There could be a better event system with:

  • Priority.
    • LOWEST, LOW, MEDIUM, HIGH and HIGHEST.
  • Cancelability.
    • Being able to cancel events would be useful.
  • Inheritance.
    • That is, instead of having to modify the event bus every time you wanna add a new event, you just add the new event.
  • Multiple handlers for the same event.
    • You could have multiple methods with different names but listening to the same event.
  • Annotations.
    • They look nice.

Example:

@EventHandler
public void onMessage(MessageEvent event) {
    // * stuff here * //
}

@EventHandler(priority=Priority.HIGHEST)
public void onBotMessage(MessageEvent event) {
    if (event.getUser().getName() == "botName")
        event.setCanceled(true);
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions