From 43b4fc89ef52714fd69c1e6fa57adcd91f6a37ba Mon Sep 17 00:00:00 2001 From: super Date: Fri, 29 Nov 2019 11:35:03 -0500 Subject: [PATCH] unwaterlog blocks on water ro (#160) bruh --- .../totalfreedommod/command/Command_ro.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ro.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ro.java index a3d9b1df..bec9c301 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ro.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_ro.java @@ -11,6 +11,8 @@ import org.bukkit.Location; 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.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -141,11 +143,19 @@ public class Command_ro extends FreedomCommand for (int zOffset = -radius; zOffset <= radius; zOffset++) { Block block = centerBlock.getRelative(xOffset, yOffset, zOffset); - - if (block.getType().equals(fromMaterial)) + BlockData data = block.getBlockData(); + if (block.getType().equals(fromMaterial) || data instanceof Waterlogged) { + Waterlogged waterloggedData = (Waterlogged) data; if (block.getLocation().distanceSquared(center) < (radius * radius)) { + if (fromMaterial.equals(Material.WATER)) + { + waterloggedData.setWaterlogged(false); + block.setBlockData(waterloggedData); + affected++; + continue; + } block.setType(toMaterial); affected++; }