From bd06e710f7d5b0b0364cfea8f08f4ca17a50d330 Mon Sep 17 00:00:00 2001 From: jojo Date: Sun, 27 Dec 2020 13:40:02 +0100 Subject: [PATCH] Add waterlogged check --- .../de/steamwar/bausystem/tracer/TNTTracer_15.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/BauSystem_15/src/de/steamwar/bausystem/tracer/TNTTracer_15.java b/BauSystem_15/src/de/steamwar/bausystem/tracer/TNTTracer_15.java index 4c18ae6..b6f0419 100644 --- a/BauSystem_15/src/de/steamwar/bausystem/tracer/TNTTracer_15.java +++ b/BauSystem_15/src/de/steamwar/bausystem/tracer/TNTTracer_15.java @@ -21,6 +21,9 @@ package de.steamwar.bausystem.tracer; import org.bukkit.Material; import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.block.data.BlockData; +import org.bukkit.block.data.Waterlogged; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -31,8 +34,15 @@ public class TNTTracer_15 { } public static boolean inWater(World world, Vector tntPosition) { - Material material = tntPosition.toLocation(world).getBlock().getType(); - return material == Material.WATER; + Block block = tntPosition.toLocation(world).getBlock(); + if(block.getType() == Material.WATER) + return true; + + BlockData data = block.getBlockData(); + if(!(data instanceof Waterlogged)) + return false; + + return ((Waterlogged) data).isWaterlogged(); } }