From 29cb90f128b8258896a2e531db5842f860ed1db5 Mon Sep 17 00:00:00 2001 From: jojo Date: Sun, 19 Jul 2020 07:39:17 +0200 Subject: [PATCH] Fix "/trace delete [TRACE-ID]" --- .../src/de/steamwar/bausystem/commands/CommandTrace.java | 1 + .../src/de/steamwar/bausystem/tracer/TNTTracer15.java | 7 +++++++ .../src/de/steamwar/bausystem/tracer/trace/TNTFrame.java | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java index 61d62c6..22eb928 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java @@ -189,6 +189,7 @@ public class CommandTrace implements CommandExecutor { try { int tntID = Integer.parseInt(args[1]); ShowManager.removeTrace(tntID); + TNTTracer15.remove(tntID); player.sendMessage(BauSystem.PREFIX + "§cTNT-Positionen mit ID " + tntID + " gelöscht"); } catch (NumberFormatException e) { help15(player); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/TNTTracer15.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/TNTTracer15.java index 25ea48c..2d49dba 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/TNTTracer15.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/TNTTracer15.java @@ -284,6 +284,13 @@ public class TNTTracer15 { ShowManager.removeAllTraces(); } + public static void remove(int tntID) { + Iterator frameIterator = tntFrames.iterator(); + while (frameIterator.hasNext()) { + frameIterator.next().remove(tntID); + } + } + public static void hideBlockTraces(Player p) { TNTTracer_15.hide(p); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/trace/TNTFrame.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/trace/TNTFrame.java index 5ac1abd..ca9364b 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/trace/TNTFrame.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/trace/TNTFrame.java @@ -59,6 +59,10 @@ public class TNTFrame { } } + public void remove(int tntID) { + positions.remove(tntID); + } + public LinkedList getTraces(LinkedList selection) { LinkedList traces = new LinkedList<>(); Iterator iterator = selection.iterator();