Check waterlogged blocks when emptying buckets.

Fixes WORLDGUARD-4119.

(cherry picked from commit 3272759f25)
This commit is contained in:
wizjany 2019-07-17 07:45:31 -04:00
parent de2b673902
commit 6cf3c23b47

View File

@ -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