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

Add a New and Improved Lidded API #11379

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

456dev
Copy link
Contributor

@456dev 456dev commented Sep 9, 2024

Featuring

  • 5 LidModes, 3 of which were not possible before
  • The ability to get if the lid actually should be open, if a player is in the container
  • The ability to get if the is open, from api or the player itself

This also deprecates Bukkits api because of the confusing and outright incorrect javadocs (so those now accurately represent the behaviour)

Testable with the included testplugin commands.

Im not 100% sure if the PaperLidded interface is the best way of doing this, but it is working
Also, let me know if the naming needs to change.

Tasks

@456dev 456dev requested a review from a team as a code owner September 9, 2024 00:56
@Machine-Maker
Copy link
Member

I'm wondering if an event is better suited for more control over what happens. I feel like some event in the correct spot would enable even more than just these 5 options. I'm not sure how that would look just now, I just had this idea. Maybe some event for when the open count changes? You could then query if it was open or not before, and decide whether to allow it to open, or to close or something.

@456dev
Copy link
Contributor Author

456dev commented Sep 9, 2024

just an event wouldn't allow forcing the lid open I believe.
Additionally, once the event completes, I can't see an easy way to undo whatever changes that were made.
for example, this could be used to flip the lid up and down, no matter if a player is viewing it or not.

@dawon
Copy link
Contributor

dawon commented Sep 9, 2024

I could imagine an event here (PlayerContainerOpenEvent - maybe someone would come up with a better name ideally not confusable with InventoryOpenEvent) that would allow to prevent opening the lid for a specific player, container and/or situation. I would add that along with the api you already implemented. I think that would handle most possible use cases...

Featuring
- 5 LidModes, 3 of which were not possible before
- The ability to get if the lid actually should be open, if a player is in the container
- The ability to get if the is open, from api or the player itself

This also deprecates Bukkits api because of the confusing and outright incorrect javadocs (so those now accurately represent the behaviour)
@456dev
Copy link
Contributor Author

456dev commented Sep 13, 2024

@dawon @Machine-Maker I've now added PlayerLiddedOpenEvent, which triggers on open, and allows players to be removed from consideration at that stage. I've done it as a separate patch, as its not fully linked to the new Lidded api.

(its easier to merge those patches than re-separate them).

@Jakush
Copy link

Jakush commented Sep 16, 2024

Looks great to me, I'm glad you did this well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Awaiting review
Development

Successfully merging this pull request may close these issues.

4 participants