Fix disable-tripwire-updates option not cancelling tripwire hook updates#12129
Conversation
lynxplay
left a comment
There was a problem hiding this comment.
Welcome to paper 🎉
Thank you for the PR!
I am a bit unsure on cancelling the entire method here.
We are only preventing updates to tripwires, not to the hooks.
Additionally, if something else ever happens in this method in the future, this change would make it very difficult for us to spot that during a version update.
Does moving this check down to the actual update of the tripwire also solve the issue correctly? (I'd imagine so)
|
Thanks for the review @lynxplay I moved the check down to the part of code that updates the block, and ensured it only runs for tripwire and not tripwire hooks. It still does function correctly like that and the tripwire doesn't get updated (all fields are false). Though the hook now sets |
lynxplay
left a comment
There was a problem hiding this comment.
Thanks for the quick response!
I think that is fine, the tripwire hooks are not part of the cancelled update, even if the resulting state looks fine.
Complete nitpick on my end, but can you just move the if statement directly infront of the setBlock line.
E.g.
if (!config.disableUpdatesTripWire) level.setBlock(blockPos1,....) // Paper - rest of commentThat way, in future updates, the patch fails to apply if the setBlock line there changes and we can correct it.
Beyond that, LGTM
|
Done that @lynxplay Thank you again for the feedback & swift responses ❤️ |
139af2a to
27f3a6f
Compare
|
yay 🎉🎉🎉🎉🎉 |
Fixes #12127
Currently the
disable-tripwire-updateshas a bug, it does NOT cancel updates from tripwire hook blocks, which change the attached state property of the tripwire.This PR fixes this by blocking the
calculateStatemethod insideTripWireHookBlockfrom running.This is justified as the methods only functionality is:
attachedappropriatelydisable-tripwire-updatesis on as the tripwires never getpowered)TLDR it only does block updates and nothing else, half of which are already not being ran with
disable-tripwire-updates, hence I think the best solution is to just cancel the entire method.