Add quota for player arrows that don't auto-despawn - #14146
Open
samrussell wants to merge 2 commits into
Open
Conversation
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.
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 |
Contributor
Author
|
Confirmed still working, now we're only modifying ServerPlayer (to add the fields) and then the logic is all in AbstractArrow |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
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