diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/depthcounter/Depth.java b/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/depthcounter/Depth.java index 761f4e4a..67d7f3f2 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/depthcounter/Depth.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/depthcounter/Depth.java @@ -33,6 +33,7 @@ import java.util.Set; public class Depth { + private int tntCount = 1; private Vector minVector = null; private Vector maxVector = null; @@ -53,7 +54,7 @@ public class Depth { }); bukkitTask = Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), () -> { - if (TPSUtils.currentTick.get() - lastUpdate > 10) { + if (TPSUtils.currentTick.get() - lastUpdate > 20) { bukkitTask.cancel(); Vector dimensions = maxVector.subtract(minVector); @@ -62,7 +63,7 @@ public class Depth { dimensions.setZ(Math.abs(dimensions.getZ())); if (dimensions.getX() != 0 && dimensions.getY() != 0 && dimensions.getZ() != 0) { - RegionUtils.message(region, player -> DepthCounter.getMessage(player, dimensions.getBlockX(), dimensions.getBlockY(), dimensions.getBlockZ())); + RegionUtils.message(region, player -> DepthCounter.getMessage(player, dimensions.getBlockX(), dimensions.getBlockY(), dimensions.getBlockZ(), tntCount)); } Set depthSet = DepthCounter.depthMap.get(region); @@ -74,11 +75,11 @@ public class Depth { DepthCounter.depthMap.remove(region); } } - }, 2, 2); + }, 5, 5); } public boolean update(List blocks) { - boolean expand = blocks.stream().anyMatch(block -> { + long overlappingBlocks = blocks.stream().filter(block -> { Vector vector = DepthCounter.blockVector(block.getLocation().toVector()); return vector.getX() >= minVector.getX() && vector.getY() >= minVector.getY() @@ -86,12 +87,13 @@ public class Depth { && vector.getX() <= maxVector.getX() && vector.getY() <= maxVector.getY() && vector.getZ() <= maxVector.getZ(); - }); - if (!expand) { + }).count(); + if (overlappingBlocks < 4) { return false; } lastUpdate = TPSUtils.currentTick.get(); blocks.forEach(this::internalUpdate); + tntCount++; return true; } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/depthcounter/DepthCounter.java b/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/depthcounter/DepthCounter.java index 03cd8df0..4402bbca 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/depthcounter/DepthCounter.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/testblock/depthcounter/DepthCounter.java @@ -97,7 +97,7 @@ public class DepthCounter { return values.stream().max(Integer::compare).orElse(0); } - public String getMessage(Player player, int x, int y, int z) { + public String getMessage(Player player, int x, int y, int z, int tntCount) { final boolean xActive = DepthCounter.isActive(player, CountMode.X); final boolean yActive = DepthCounter.isActive(player, CountMode.Y); final boolean zActive = DepthCounter.isActive(player, CountMode.Z); @@ -106,7 +106,7 @@ public class DepthCounter { return null; } - final StringBuilder result = new StringBuilder(BauSystem.PREFIX).append("Schadensdimensionen ").append(ColorConfig.OTHER).append("> ").append(ColorConfig.BASE); + final StringBuilder result = new StringBuilder(BauSystem.PREFIX).append("Schaden ").append(ColorConfig.OTHER).append("> ").append(ColorConfig.BASE); final Set dimensions = new HashSet<>(); if (xActive) { @@ -145,6 +145,7 @@ public class DepthCounter { } } + result.append(ColorConfig.BASE).append("TNT").append(ColorConfig.OTHER).append(": ").append(ColorConfig.HIGHLIGHT).append(tntCount); return result.toString(); } } \ No newline at end of file