Repository navigation
Include polygon regions whose max edge lies on a chunk's first row - #2340
Open
intersecato wants to merge 1 commit into
Open
intersecato wants to merge 1 commit into
intersecato wants to merge 1 commit into
Conversation
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.
Problem
Polygonal regions are missing from
getApplicableRegionson their max X/Z edge when that edge falls exactly on the first block row of a chunk (coordinate divisible by 16), even thoughProtectedRegion#containsreturns true for those blocks. Flag queries on that row only see the parent/global regions.Example: a poly region with points spanning z -861..-848. Block (-445, 92, -848):
region.contains(...)→ trueregionManager.getApplicableRegions(...)→ region missingCause
ChunkHashTable.EnumerateRegionscollects a chunk's regions viaapplyIntersectingwith a cuboid covering the chunk, which ends up comparing AWTArea.ProtectedCuboidRegion#toAreaadds +1 to width/height so the area covers whole blocks, butProtectedPolygonalRegion#toAreauses the raw vertices, so the polygon's area ends on its max edge line. When that line equals the chunk's min coordinate the two areas only touch, the intersection is empty, and the region is never cached for that chunk.Fix
Extend the chunk lookup cuboid by one block on the min side. This only widens the candidate list for the chunk cache,
applyContainingstill filters every candidate withregion.contains(position), so results stay exact. Cuboid regions are unaffected.Testing
Built
worldguard-bukkit. Verified the reported behavior on a live server: before the fix, the edge block on the chunk boundary was missing from the applicable regions.