Prevent liquids from washing shop items away

This commit is contained in:
Eric 2016-07-01 17:09:49 +02:00
parent 582cc76c83
commit 8b736da181

View File

@ -9,13 +9,11 @@ import org.bukkit.entity.Item;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockMultiPlaceEvent;
import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.*;
import org.bukkit.event.entity.ItemDespawnEvent;
import org.bukkit.event.inventory.InventoryPickupItemEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
public class ItemProtectListener implements Listener {
@ -80,4 +78,19 @@ public class ItemProtectListener implements Listener {
}
}
@EventHandler(priority = EventPriority.HIGH)
public void onLiquidFlow(BlockFromToEvent e) {
Block b = e.getToBlock();
Block below = b.getRelative(BlockFace.DOWN);
if (ShopUtils.isShop(below.getLocation())) e.setCancelled(true);
}
@EventHandler(priority = EventPriority.HIGH)
public void onBucketEmpty(PlayerBucketEmptyEvent e) {
Block b = e.getBlockClicked();
if (ShopUtils.isShop(b.getLocation())) e.setCancelled(true);
}
}