Skip to content

Commit

Permalink
Check waterlogged blocks when emptying buckets.
Browse files Browse the repository at this point in the history
Fixes WORLDGUARD-4119.
  • Loading branch information
wizjany committed Jul 17, 2019
1 parent 456a165 commit 3272759
Showing 1 changed file with 10 additions and 1 deletion.
Expand Up @@ -63,6 +63,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;
Expand Down Expand Up @@ -523,7 +524,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
Expand Down

0 comments on commit 3272759

Please sign in to comment.