Skip to content

Fix: Players cannot eat food due to incorrect InteractionResultHolder comparison#2

Merged
Rico040 merged 1 commit intoRico040:masterfrom
SajmonOriginal:master
Apr 22, 2026
Merged

Fix: Players cannot eat food due to incorrect InteractionResultHolder comparison#2
Rico040 merged 1 commit intoRico040:masterfrom
SajmonOriginal:master

Conversation

@SajmonOriginal
Copy link
Copy Markdown
Contributor

@SajmonOriginal SajmonOriginal commented Apr 21, 2026

Bug Description

Players are unable to eat food because the onUseItem event always cancels item usage, regardless of authentication status.

Root Cause

Using != to compare InteractionResultHolder objects does not work because InteractionResultHolder.pass() creates a new instance every time it is called. This causes the comparison to always return true, resulting in the event being permanently cancelled.

Fix

Changed the comparison to use .getResult() != InteractionResult.PASS instead of comparing the holder objects directly.

Testing

  • Verified that authenticated players can now eat food normally
  • Verified that unauthenticated players still cannot use items (when allow-item-using: false)

Using != on InteractionResultHolder objects always returns true because
each call to InteractionResultHolder.pass() creates a new instance.
This caused the onUseItem event to always cancel item usage, preventing
players from eating food even when authenticated.

Changed to compare getResult() with InteractionResult.PASS instead.
@Rico040 Rico040 merged commit c1cc786 into Rico040:master Apr 22, 2026
1 check failed
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.

2 participants