Skip to content

Add quota for player arrows that don't auto-despawn - #14146

Open
samrussell wants to merge 2 commits into
PaperMC:mainfrom
samrussell:player-arrow-quota
Open

Add quota for player arrows that don't auto-despawn#14146
samrussell wants to merge 2 commits into
PaperMC:mainfrom
samrussell:player-arrow-quota

Conversation

@samrussell

Copy link
Copy Markdown
Contributor

Addresses #14142

Workaround for #13452 that breaks warden switches. This allows admins to have a quota of arrows for players to use for fair use while still protecting them from mass arrow spam.

Tested locally and confirmed it keeps the first 5 arrows persistent with pistons while the rest despawn.

2026-08-05_22 22 56 2026-08-05_22 23 05

I'm open to taking different approaches with this, I ended up doing a simple counter on ServerPlayer but it gets reset at the start of the entity tick loop in ServerLevel which I don't love. I had tried resetting this when the ServerPlayer gets ticked but the pistons can be put in different orders to change which arrows are in the quota so I couldn't guarantee that it couldn't be abused.

Happy to make changes and re-test locally if you have any requests

Addresses PaperMC#14142

Workaround for PaperMC#13452 that breaks warden switches. This allows admins to have a quota of arrows for players to use for fair use while still protecting them from mass arrow spam.
@samrussell
samrussell requested a review from a team as a code owner August 5, 2026 20:49
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Aug 5, 2026
@samrussell

Copy link
Copy Markdown
Contributor Author

I was thinking about this this morning, I can probably just add something on ServerPlayer that tracks the tick when numArrows was last updated and reset when it changes inside AbstractArrow.tick(), then we don't need the extra ugly bit inside ServerLevel

@samrussell

Copy link
Copy Markdown
Contributor Author

Confirmed still working, now we're only modifying ServerPlayer (to add the fields) and then the logic is all in AbstractArrow

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.

1 participant