Repository navigation
fix: stop entities from changing road blocks without road flags - #4971
Open
TheMeinerLP wants to merge 1 commit into
Open
TheMeinerLP wants to merge 1 commit into
TheMeinerLP wants to merge 1 commit into
Conversation
A wither could destroy roads, walls and the ground of unowned plots on areas that have no road flags configured, because entity block changes outside of owned plots were only refused when road flags were present. They are now refused unless the road flags set entity-change-block to true, as plots without the flag already do.
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
On an area without any entry under
road.flags(which is what a freshly created area has:road.flags: {}), a wither destroys the road, the plot walls and the ground of unowned plots. The blocks drop as items. Claimed plots next to it stay intact.This was reproduced in game on 7.6.1 with the default configuration. With any single entry under
road.flagsthe same wither destroyed nothing.The reason is the check for entity block changes outside of owned plots. It only refused the change when the area has road flags and
entity-change-blockisfalseamong them. Without road flags the check never applied, although the default ofentity-change-blockisfalseand plots without the flag already refuse such changes. #4527 introduced this check with the default in mind; the case of no road flags at all slipped through.Related: #4049.
What changed
Entity block changes outside of owned plots are now refused unless the area's road flags set
entity-change-blocktotrue. Areas that already have road flags behave as before.The decision moved into
PlotFlagUtil.mayEntityChangeBlockOnRoadso that it can be tested; the listener calls it.Side effect
On areas without road flags, other entities no longer change blocks on roads, walls and unowned plots either: sheep eating grass, endermen, silverfish, villagers harvesting, zombies breaking doors, ravagers, turtle eggs. Servers that want this can set
entity-change-block: trueunderroad.flags. Falling blocks, players and projectiles are handled before this check and are not affected.Tests
Four cases for the decision: no road flags, road flags with the flag
false, with the flagtrue, and a storedtruewhile road flags are off. With the previous condition the two cases without road flags fail.Not part of this change
road.flagssection instead of the intended default entry.PlotAreacannot be created without a running platform.