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

Backend: Custom event bus #2008

Merged
merged 12 commits into from
Jun 8, 2024

Conversation

ThatGravyBoat
Copy link
Contributor

@ThatGravyBoat ThatGravyBoat commented Jun 5, 2024

Dependencies

What

This adds a fully custom loader independent event bus, this includes several optimizations for SkyHanni specifically such as to early escape the invoker loop if no other invokers can receive cancel, this also includes things such as proper generic events, checks for if on skyblock or a skyblock island, custom event priority using a number instead of an enum with optional constants matching the forge event priorities.

It also provides a way for the repo to remotely disable a specific event and method an event is handled on.

In addition to the additions above unlike forges event bus the cancellable events use a interface as to not put people under the wrong assumption of a cancel being allowed on an event even though its not cancellable.

Important

For performance benefits this only supports events on a single class
ie. if EventA extends EventB but EventA is posted EventB wont also be posted.

Note

As of right now I have just changed 1 single event to the new event bus to show off its capabilities, all future events should be switched to this event bus and following PR(s) will switch the existing ones.

Changelog Technical Details

  • Added custom event bus. - ThatGravyBoat
    • Added live plugin to show when an event method is missing its annotation.

@CalMWolfs CalMWolfs added Soon This Pull Request will be merged within the next couple of betas Backend A backend pull request that will be merged soon labels Jun 5, 2024
@CalMWolfs CalMWolfs added this to the Version 0.26 milestone Jun 5, 2024
@Thunderblade73
Copy link
Contributor

Important

For performance benefits this only supports events on a single class ie. if EventA extends EventB but EventA is posted EventB wont also be posted.

Can we get this as a explicit functionally since we have some events that need that behavior. Eg: GuiRenderEvent, MobEvent, WorldClickEvent

@Thunderblade73
Copy link
Contributor

Important
For performance benefits this only supports events on a single class ie. if EventA extends EventB but EventA is posted EventB wont also be posted.

Can we get this as a explicit functionally since we have some events that need that behavior. Eg: GuiRenderEvent, MobEvent, WorldClickEvent

Never mind, we can just get similar behavior with generics and type aliases

@ThatGravyBoat
Copy link
Contributor Author

Important
For performance benefits this only supports events on a single class ie. if EventA extends EventB but EventA is posted EventB wont also be posted.

Can we get this as a explicit functionally since we have some events that need that behavior. Eg: GuiRenderEvent, MobEvent, WorldClickEvent

The explicit way is to subscribe to the events individually, I dont think its beneficial in anyway to let it try to post its super types.
If a class needs it they can subscribe to the other events.

  • GuiRenderEvent most of them dont actually use the supertype.
  • MobEvent the super type is only used once and the same class subscribes to ALL of the sub events so it can easily be delegating them.
  • WorldClickEvent's super type is only ever used once

@ThatGravyBoat
Copy link
Contributor Author

Important
For performance benefits this only supports events on a single class ie. if EventA extends EventB but EventA is posted EventB wont also be posted.

Can we get this as a explicit functionally since we have some events that need that behavior. Eg: GuiRenderEvent, MobEvent, WorldClickEvent

Never mind, we can just get similar behavior with generics and type aliases

And yes you can also do that

@github-actions github-actions bot added the Merge Conflicts There are open merge conflicts with the beta branch. label Jun 5, 2024
Copy link

github-actions bot commented Jun 5, 2024

This pull request has conflicts with the base branch "beta". Please resolve those so we can test out your changes.

CalMWolfs added 2 commits June 6, 2024 09:55
# Conflicts:
#	src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
Copy link

github-actions bot commented Jun 5, 2024

Conflicts have been resolved! 🎉

@github-actions github-actions bot added Merge Conflicts There are open merge conflicts with the beta branch. and removed Merge Conflicts There are open merge conflicts with the beta branch. labels Jun 5, 2024
Copy link

github-actions bot commented Jun 6, 2024

This pull request has conflicts with the base branch "beta". Please resolve those so we can test out your changes.

CalMWolfs added 2 commits June 6, 2024 11:55
# Conflicts:
#	src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
#	src/main/java/at/hannibal2/skyhanni/features/fishing/FishingHookDisplay.kt
Copy link

github-actions bot commented Jun 6, 2024

Conflicts have been resolved! 🎉

@github-actions github-actions bot removed the Merge Conflicts There are open merge conflicts with the beta branch. label Jun 6, 2024
@hannibal002 hannibal002 merged commit 376404a into hannibal002:beta Jun 8, 2024
3 checks passed
@github-actions github-actions bot removed Soon This Pull Request will be merged within the next couple of betas Backend A backend pull request that will be merged soon labels Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants