From 6e50d3d8d165e00a568a44cf061fc5a79cad2d20 Mon Sep 17 00:00:00 2001 From: mathias Date: Fri, 21 Dec 2018 11:27:50 +0200 Subject: [PATCH] Liquid optimizations --- src/main/java/pw/kaboom/extras/Events.java | 11 +++++++++++ src/main/java/pw/kaboom/extras/Main.java | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/main/java/pw/kaboom/extras/Events.java b/src/main/java/pw/kaboom/extras/Events.java index d0bf182..48cf590 100644 --- a/src/main/java/pw/kaboom/extras/Events.java +++ b/src/main/java/pw/kaboom/extras/Events.java @@ -211,6 +211,17 @@ class Events implements Listener { } } else if (block.getType() == Material.SOIL) { event.setCancelled(true); + } else if (block.getType() == Material.STATIONARY_WATER || + block.getType() == Material.STATIONARY_LAVA) { + if (block.getRelative(BlockFace.UP).getType() == block.getType()) { + if (block.getRelative(BlockFace.DOWN).getType() != Material.AIR && + block.getRelative(BlockFace.NORTH).getType() != Material.AIR && + block.getRelative(BlockFace.SOUTH).getType() != Material.AIR && + block.getRelative(BlockFace.WEST).getType() != Material.AIR && + block.getRelative(BlockFace.EAST).getType() != Material.AIR) { + event.setCancelled(true); + } + } } else if (main.nonSolidWallMountedBlockList.contains(block.getType())) { World world = event.getBlock().getWorld(); int radius = 5; diff --git a/src/main/java/pw/kaboom/extras/Main.java b/src/main/java/pw/kaboom/extras/Main.java index f1520ed..a5ac0ce 100644 --- a/src/main/java/pw/kaboom/extras/Main.java +++ b/src/main/java/pw/kaboom/extras/Main.java @@ -19,6 +19,8 @@ import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.Material; +import org.bukkit.block.BlockFace; + import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin;