Skip to content

Conversation

@AnnotationVisitor
Copy link

@AnnotationVisitor AnnotationVisitor commented Nov 12, 2025

item stack swap technique is risky, what if openItemGui threw an exception? what if the author (stupidly) called openbook() async, assuming it would just send a packet (which it should), the result would be sometimes the players hand item is deleted and replaced with a book item they shouldn't have.

The only argument in favour of itemstack swap technique is that its less maintenance work than sending packet, but we are already sending packet in a virtually identical method.

#12582

PR untested ATM (Can someone test? 😄)

item stack swap technique is dumb af and outright dangerous
Copy link
Member

@Owen1212055 Owen1212055 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thread safety is never a promise for these methods, potentially an async catcher would be useful. The current method cannot ever be made async due to the resolve logic.

This causes a behavior change, as the book item is no longer resolved, which currently openItemGui does.

@github-project-automation github-project-automation bot moved this from Awaiting review to Changes required in Paper PR Queue Nov 12, 2025
@AnnotationVisitor
Copy link
Author

Thread safety is never a promise for these methods, potentially an async catcher would be useful. The current method cannot ever be made async due to the resolve logic.

This causes a behavior change, as the book item is no longer resolved, which currently openItemGui does.

Should we be resolving the book in both methods?

@Owen1212055
Copy link
Member

No, only the method you are changing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Changes required

Development

Successfully merging this pull request may close these issues.

2 participants