Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE REQUEST: Rework event manager as a tree like design #875

Open
Tofaa2 opened this issue Jul 5, 2024 · 1 comment
Open

FEATURE REQUEST: Rework event manager as a tree like design #875

Tofaa2 opened this issue Jul 5, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Tofaa2
Copy link
Contributor

Tofaa2 commented Jul 5, 2024

Is your feature request related to a problem? Please describe.
Nope

Describe the solution you'd like
I think it'd be much more usable if event listener priorities were redone to just an int and compared via Integer.compareTo, and EventManager, rather than being a standalone class would be a creatable class that would have its own EventManager children and a parent, also allowing filtering certain events from a certain event node/manager in the tree.

Example structure
pe-event-manager:
my-plugin-event-manager: (priority 2)
filter: some delegate
listeners:
- listener 1 (priority 2)
- listener 2 (priority 0)
- listener 3 (priority 10)
children:
specific-feature-event-manager:
listeners:
- listener 1
grim-anticheat-event-manager: (priority 0)
filter: null
listeners:
- listener 1 (priority 2)

The my-plugin-event-manager would filter according toa delegate and has its event listeners ran exclusively if the event filter is true. Each node and listener could have their own priority, or only the nodes would have priority

@Tofaa2 Tofaa2 added the enhancement New feature or request label Jul 5, 2024
@Bram1903
Copy link
Contributor

Bram1903 commented Jul 6, 2024

I really like this suggestion. The current event manager does the job, but this would be a huge improvement. Especially since we are moving more and more towards projects unshading PacketEvents, and thus the event manager becomes more important!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
2 participants