-
Notifications
You must be signed in to change notification settings - Fork 544
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
✨ feat(api): Introduce SlimefunItemRegistryFinalizedEvent #4099
Conversation
This Event is provided so that plugins that have integrations with each other aren't stuck in a state in which some SlimefunItems may not be available to one plugin or the other. I will use this event to provide a cleaner integration between Dynatech and other plugins. Currently InfinityXpansion, ExoticGarden, and Gastronomicon.
Pro Tip!
If your changes do not fall into any of these categories, don't worry. You can just ignore this message in that case! 👀 |
Can we get unit tests? |
Slimefun preview buildA Slimefun preview build is available for testing! https://preview-builds.walshy.dev/download/Slimefun/4099/a25a4e43
|
src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunRegistryFinalizedEvent.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/PostSetup.java
Outdated
Show resolved
Hide resolved
src/main/java/io/github/thebusybiscuit/slimefun4/api/events/SlimefunRegistryFinalizedEvent.java
Outdated
Show resolved
Hide resolved
…FinalizedEvent. Moved call to event upward to make it more readable. Remove `before auto loading` as it was inrelevant to code after a second read.
Fixed up according to suggestions |
I'm not sure about the use case of this tbch, for example: if one addon waits for this event to then register its items to integrate with another addon, but then another addon waits for this event to integrate with that addon, then you would still have the same problem. Currently if you soft depend on any addon you can utilize its items without any problem, in my experience anyways. I guess it depends on the addon but I've never experienced that not working. The use case you have also provided encourages registering items, after load items is called, which feels wrong. Idk this could just be me but I don't think this is the right solution. |
src/main/java/io/github/thebusybiscuit/slimefun4/implementation/setup/PostSetup.java
Outdated
Show resolved
Hide resolved
...t/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunRegistryFinalizedEvent.java
Show resolved
Hide resolved
...t/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunRegistryFinalizedEvent.java
Show resolved
Hide resolved
...t/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunRegistryFinalizedEvent.java
Outdated
Show resolved
Hide resolved
This probably isn't the right solution, but I'm currently in the situation when I want to integrate items into another project. Which I can't load after because its |
Co-authored-by: JustAHuman-xD <[email protected]>
Ah so you're in a circular dependency problem. Which is similar to the issue I showed with this. One solution I can think of is you PR to gastro and make gastro add it to the seed plucker but yeah I get the problem. I think what you may be able to do is something kinda like slimefun, slimefun adds a lot of recipes to machines on post register. So if all you want to do is add machine recipes, then this event is actually a good solution. In which case I misunderstood what this was meant for. I thought you meant registering items dependent on addons items 😅 |
Yeah Im sorry i know my explanation was kinda confusing |
Co-authored-by: JustAHuman-xD <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, apologizes for the confusion 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(You double removed the empty line here, not a big deal I'll re add it lol)
...t/java/io/github/thebusybiscuit/slimefun4/api/events/TestSlimefunRegistryFinalizedEvent.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
This Event is provided so that plugins that have integrations with each other aren't stuck in a state in which some SlimefunItems may not be available to one plugin or the other.
I will use this event to provide a cleaner integration between Dynatech and other plugins. Currently InfinityXpansion, ExoticGarden, and Gastronomicon.
Proposed changes
Make an event to be able to listen to Slimefun's Registry finalizing all static items.
Checklist
Nonnull
andNullable
annotations to my methods to indicate their behaviour for null values