From ca730f7b8fd411d3b4fff8d46df68bceb8562ad2 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 15 Mar 2023 20:59:34 +0100 Subject: [PATCH] Fix NPE of KillcheckerVisualizer.hide Signed-off-by: yoyosource --- .../features/killchecker/KillcheckerCommand.java | 2 +- .../killchecker/KillcheckerVisualizer.java | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerCommand.java index 7148b0f9..74fc72c3 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerCommand.java @@ -78,7 +78,7 @@ public class KillcheckerCommand extends SWCommand implements Listener { Player player = event.getPlayer(); Set regions = new HashSet<>(); visualizers.forEach((region, visualizer) -> { - if (visualizer.hide(player)) { + if (visualizer.disconnect(player)) { regions.add(region); } }); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerVisualizer.java b/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerVisualizer.java index d83f4b64..ff21d13b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerVisualizer.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/killchecker/KillcheckerVisualizer.java @@ -97,6 +97,7 @@ public class KillcheckerVisualizer { if (block.getType().isAir()) continue; String name = block.getType().name(); if (!name.endsWith("_WOOL") && !name.endsWith("_STAINED_GLASS") && !name.endsWith("_CONCRETE") && !name.endsWith("_TERRACOTTA")) continue; + if (name.equals("_GLAZED_TERRACOTTA")) continue; Cuboid cuboid = create(block.getType(), x, y, z); cuboids.add(cuboid); for (int dx = (int) cuboid.getX(); dx <= cuboid.getDx(); dx++) { @@ -378,6 +379,19 @@ public class KillcheckerVisualizer { bossBarService.remove(player, region, "killchecker"); if (players.isEmpty()) { outline.close(); + inner.close(); + return true; + } + return false; + } + + public boolean disconnect(Player player) { + players.remove(player); + areaPlayers.remove(player); + bossBarService.remove(player, region, "killchecker"); + if (players.isEmpty()) { + outline.close(); + inner.close(); return true; } return false;