Repository navigation
fix: block edits on a plot while a plot operation is running - #4973
Open
TheMeinerLP wants to merge 1 commit into
Open
TheMeinerLP wants to merge 1 commit into
TheMeinerLP wants to merge 1 commit into
Conversation
Merging marks the road as part of the plot before the queue has replaced it, so the owner could break road blocks and keep them. The plots are now marked as running until the queue has finished, for /plot merge and for the merge of a multi-plot /plot auto, and block break and place are refused on a plot with a running operation. Explosions destroy no blocks and pistons move no blocks on such a plot either, as both could take road and wall blocks in the same window.
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.
Overview
Fixes #3056.
When two plots are merged, PlotSquared marks the road between them as part of the plot first and replaces the road blocks afterwards, in the queue. For a few ticks the owner may build on the old road. With a fast enough pickaxe they break the road and wall blocks in that window and keep the drops.
This was reproduced in game on 7.6.1, both with WorldEdit and with FAWE, through
/plot mergeand through/plot auto 2,2: with Efficiency IV or higher, Efficiency III with Haste II, or theinstabreakflag (which needs no enchantment and is part of the basic flag permissions). Pistons and TNT pulled or blew road and wall blocks out of the same window.What changed
While a plot operation runs on a plot, the plot is marked as running until the queue has finished: for
/plot merge, for the merge part of a multi-plot/plot auto, and for the existing operations that already used the marker. During that time:The marker is released when the queue completes, or right away if the queue does not start or starting it throws. In the test runs the plot was free again 6 to 12 ticks after the command.
The decisions are in small helpers on
PlotModificationManagerso they can be tested without a running server; the listeners call them.Side effect
/plot clearand/plot setnow also lock the plot for the few ticks their queue runs: pistons stop and TNT destroys nothing during that time. Redstone builds can fall out of step for those ticks.Tests
19 unit tests for the marking, the release after completion and when the queue does not start, and the edit decision with and without the bypass permission.
In game, after the change, on 7.6.1 with WorldEdit and FAWE: no road or wall block came out of the merge window with Efficiency V, with
instabreak, with pistons or with TNT. After release, building, pistons and TNT worked normally, and after unlinking the road was protected again.Not part of this change
entity-change-block = true, falling blocks, liquids and dispensers during the window.auto_mergeon claim, and a server stop while the plot is locked.This replaces my earlier attempt in #4038.