Skip to content

Correctly handle interactions with items on cooldown#8008

Merged
kennytv merged 1 commit into
PaperMC:masterfrom
Machine-Maker:fix/cooldown-blocking-interactions
Oct 7, 2022
Merged

Correctly handle interactions with items on cooldown#8008
kennytv merged 1 commit into
PaperMC:masterfrom
Machine-Maker:fix/cooldown-blocking-interactions

Conversation

@Machine-Maker
Copy link
Copy Markdown
Member

This is a potential minefield, I tested the following situations:

  • No PlayerInteractEvent changes: items on cooldown no longer prevent block interactions (can open a door)
  • PlayerInteractEvent.setUseItemInHand(DENY): block interactions don't happen when using the item and pressing shift

Fixes #8005

@electronicboy
Copy link
Copy Markdown
Member

This is somewhat of a behavioral change in regards to the API, so this is bleh all around, but, I can't really think of any sane alternatives here, so, approved (Also, note that I ci-skip'd the dupe patch numbers)

@Machine-Maker
Copy link
Copy Markdown
Member Author

Well it was a significant behavioral break from vanilla. You couldn't open a door with an item that was on cooldown, which works totally fine in vanilla. Firing a PlayerInteractEvent with useClickedBlock set to DENY isn't new, it just shouldn't happen when the item in hand is on cooldown. The interaction isn't cancelled just cause an item is on cooldown, the useItemInHand is

@electronicboy
Copy link
Copy Markdown
Member

Yea, that was my sthinking, the way that the event was being fired is just wrong, hence the fix; biggest minefield to me is at least the API side, but, I mean, I can't see any plugin expecting this to be the case, and there's no real other fix for this, so, it's got my vote

@Machine-Maker Machine-Maker mentioned this pull request Oct 2, 2022
@Machine-Maker Machine-Maker force-pushed the fix/cooldown-blocking-interactions branch from bb50b04 to 8e47afa Compare October 7, 2022 00:36
@Machine-Maker Machine-Maker requested a review from a team as a code owner October 7, 2022 00:36
@Machine-Maker
Copy link
Copy Markdown
Member Author

Rebased for 1.19.2

@kennytv kennytv merged commit bcb4220 into PaperMC:master Oct 7, 2022
@Machine-Maker Machine-Maker deleted the fix/cooldown-blocking-interactions branch October 7, 2022 18:05
LeonTG pushed a commit to LeonTG/Paper that referenced this pull request May 17, 2026
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.

Can't open doors while goat horn is cooling down

3 participants