Skip to content

Fix incorrect block logging for FAWE replaceBlocks (#624)#909

Open
TWME-TW wants to merge 1 commit into
PlayPro:masterfrom
TWME-TW:fix-fawe-replace
Open

Fix incorrect block logging for FAWE replaceBlocks (#624)#909
TWME-TW wants to merge 1 commit into
PlayPro:masterfrom
TWME-TW:fix-fawe-replace

Conversation

@TWME-TW
Copy link
Copy Markdown
Contributor

@TWME-TW TWME-TW commented May 22, 2026

Summary

Fixes #624 — When using //replace with FAWE, CoreProtect was logging block changes
for every block in the selected region, including blocks that did not match the mask
(e.g. air blocks being logged as having stone placed in them).

Root Cause

replaceBlocks(Region, Mask, Pattern) called processPatternToBlocks without
passing the Mask parameter:

// Before (incorrect)
processPatternToBlocks(world, region, pattern); // mask ignored
return eventExtent.replaceBlocks(region, mask, pattern);

This caused processPatternToBlocks to iterate over every position in the region
and log a block change regardless of whether that position matched the mask.
Meanwhile, eventExtent.replaceBlocks correctly applied the mask, so the actual
world changes were accurate — only the CoreProtect log was wrong.

Fix

Added a processPatternToBlocks(World, Region, Mask, Pattern) overload that skips
positions where mask.test(position) returns false, and updated replaceBlocks
to use it:

// After (correct)
processPatternToBlocks(world, region, mask, pattern);
return eventExtent.replaceBlocks(region, mask, pattern);

Changes

CoreProtectLogger.java

  • Updated replaceBlocks to pass mask to processPatternToBlocks
  • Added processPatternToBlocks(World, Region, Mask, Pattern) private overload
    with a mask.test(position) guard to skip non-matching blocks

Pass the Mask into processPatternToBlocks and add a masked overload that skips positions where mask.test(...) is false. The new method collects old block state, material, location, base block info, and container contents (skipped for FAWE), then calls WorldEditLogger.postProcess for each affected position. This ensures WorldEdit replaceBlocks respects the provided mask when logging changes.
@Intelli
Copy link
Copy Markdown
Contributor

Intelli commented May 27, 2026

Awaiting conflict resolution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect FAWE replaceBlocks logging

2 participants