Skip to content
Permalink
Browse files

Check waterlogged blocks when emptying buckets.

Fixes WORLDGUARD-4119.

(cherry picked from commit 3272759)
  • Loading branch information...
wizjany committed Jul 17, 2019
1 parent de2b673 commit 6cf3c23b475267c35824225fee3a1f1e273a3ae6
@@ -64,6 +64,7 @@
import org.bukkit.block.Dropper;
import org.bukkit.block.Hopper;
import org.bukkit.block.PistonMoveReaction;
import org.bukkit.block.data.Waterlogged;
import org.bukkit.block.data.type.Dispenser;
import org.bukkit.entity.AreaEffectCloud;
import org.bukkit.entity.Entity;
@@ -530,7 +531,15 @@ public void onBedEnter(PlayerBedEnterEvent event) {
@EventHandler(ignoreCancelled = true)
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {
Player player = event.getPlayer();
Block blockAffected = event.getBlockClicked().getRelative(event.getBlockFace());
Block blockClicked = event.getBlockClicked();
Block blockAffected;

if (blockClicked.getBlockData() instanceof Waterlogged) {
blockAffected = blockClicked;
} else {
blockAffected = blockClicked.getRelative(event.getBlockFace());
}

boolean allowed = false;

// Milk buckets can't be emptied as of writing

0 comments on commit 6cf3c23

Please sign in to comment.
You can’t perform that action at this time.