Skip to content

Fix replaceable interaction with matchers#244

Closed
rymiel wants to merge 1 commit intopop4959:masterfrom
rymiel:replace-matcher
Closed

Fix replaceable interaction with matchers#244
rymiel wants to merge 1 commit intopop4959:masterfrom
rymiel:replace-matcher

Conversation

@rymiel
Copy link
Collaborator

@rymiel rymiel commented Dec 2, 2025

Bolt checks if a block is replaceable based on the replaced block state, but runs matchers based on the new block state. This can cause situations where Bolt matches a chest protection, assuming the replaced block is a chest, while also thinking its a replaceable block, thus cancelling the place.

This patch checks that the replaced block is of the same type as the protection. This is because replaceable blocks, if protected, would only match themselves, and they cannot support other blocks.

Bolt checks if a block is replaceable based on the replaced block state,
but runs matchers based on the new block state. This can cause
situations where Bolt matches a chest protection, assuming the replaced
block is a chest, while also thinking its a replaceable block, thus
cancelling the place.

This patch checks that the replaced block is of the same type as the
protection. This is because replaceable blocks, if protected, would only
match themselves, and they cannot support other blocks.
@rymiel rymiel requested a review from pop4959 December 2, 2025 22:31
@pop4959
Copy link
Owner

pop4959 commented Jan 27, 2026

Implemented this fix in an alternative way in 080cfa7 by checking for the destroy permission instead - since it's totally fine for the owner of a protection to replace their own protection (or anyone that is allowed to destroy the original protection, in any case).

@pop4959 pop4959 closed this Jan 27, 2026
@rymiel
Copy link
Collaborator Author

rymiel commented Jan 27, 2026

That works for the issue that was being fixed because it was event order jank, but technically if the block itself was protected and you replace it, won't it create a new protection without removing the old one, leaving two protections for the same block, one of which is desynced?

@pop4959
Copy link
Owner

pop4959 commented Jan 27, 2026

That works for the issue that was being fixed because it was event order jank, but technically if the block itself was protected and you replace it, won't it create a new protection without removing the old one, leaving two protections for the same block, one of which is desynced?

Maybe, I just wasn't sure how to test that. If there's a bug with it there might be a bit more code that needs to be added here (to unregister the old protection and add the new one, if it's in the same location as the clicked block).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants