Skip to content

Improving protection check for bucket usage#4887

Open
RedstoneFuture wants to merge 3 commits into
IntellectualSites:mainfrom
RedstoneFuture:fix/bucket-usage-protection
Open

Improving protection check for bucket usage#4887
RedstoneFuture wants to merge 3 commits into
IntellectualSites:mainfrom
RedstoneFuture:fix/bucket-usage-protection

Conversation

@RedstoneFuture

@RedstoneFuture RedstoneFuture commented Jun 14, 2026

Copy link
Copy Markdown
Member

Overview

Fixes #4851

The code change adds a specific block-filter to include only blocks that contain the "use" flag result in combination with "normal" bucket interactions. No waterlogging, no flooding allowed here, if it's not a plot-owner / member.

The new restriction was tested in-game.

Description

Improving protection check

We've had a bug with bucket handling in the past. This was fixed by removing the "use" flag request. Then we get a bug report for the "use" flag and dordsor re-added a similar "use" flag check in PR 4673.

Checking the "use" flag makes sense. However, there are blocks that are interactive(!), and waterloggable, or that drop when water is placed into the hitbox(!). We need to prevent that from happening.

Example: lever

  • right click: interact, if the USE flag is set or you have build permissions
  • shift + right click: place water (lever drops), only if you have build permissions

Since this interaction only involves CAULDRON types, I don't currently see a need for a separate flag to define the blocks.

Change of requested block

    public void onBucketFill(PlayerBucketFillEvent event) {
        Block block = event.getBlock();

In addition, I've adjusted the query here to target the block that was modified, which in this event is usually the same as the block being interacted with (the clicked block). It seems more logical to me to check here which block contains the final change.

  • getClicketBLock = the interaction
  • getBlock = the block for the final block change by bucket interaction (may be different for the PlayerBucketEmptyEvent and mostly the same for the PlayerBucketFillEvent)

Submitter Checklist

  • Make sure you are opening from a topic branch (/feature/fix/docs/ branch (right side)) and not your main branch.
  • Ensure that the pull request title represents the desired changelog entry.
  • New public fields and methods are annotated with @since TODO.
  • I read and followed the contribution guidelines.

@RedstoneFuture RedstoneFuture marked this pull request as ready for review June 14, 2026 02:35
@RedstoneFuture RedstoneFuture requested a review from a team as a code owner June 14, 2026 02:35
@NotMyFault NotMyFault requested a review from Copilot June 14, 2026 19:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens PlotSquared’s bucket protection checks to prevent players from bypassing plot build restrictions by using buckets on blocks permitted by the use flag (e.g., levers), while still allowing intended bucket-based interactions for cauldrons.

Changes:

  • Restricts use-flag-based bucket allowances to cauldron interactions only (to prevent waterlogging/flooding via interactable blocks).
  • Adjusts the PlayerBucketFillEvent check to use event.getBlock() (the block considered for the protection query).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1429 to +1431
if (type == BlockTypes.CAULDRON || type == BlockTypes.WATER_CAULDRON || type == BlockTypes.LAVA_CAULDRON) {
return;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used a different spelling; see the next commit.

Comment on lines +1513 to +1515
if (type == BlockTypes.CAULDRON || type == BlockTypes.WATER_CAULDRON || type == BlockTypes.LAVA_CAULDRON) {
return;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used a different spelling; see the next commit.

@RedstoneFuture

RedstoneFuture commented Jun 14, 2026

Copy link
Copy Markdown
Member Author

In theory, we should also allow minecraft:powder_snow_bucket here, event though the PlayerBucketEmptyEvent and PlayerBucketFillEvent aren't currently triggering by snow buckets at this time.

PaperMC/Paper#12239

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.

Players can bypass plot protection by using buckets on use-allowed blocks

2 participants