From 67a34ee5ca41c92b677cc659c7eee3da230b032a Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 18 Apr 2024 17:54:20 +0200 Subject: [PATCH] Fix bundle counting entity twice --- BauSystem_Main/src/BauSystem.properties | 4 ++-- BauSystem_Main/src/BauSystem_de.properties | 2 +- .../bausystem/features/tracer/Trace.java | 23 ++++++------------- .../features/tracer/TraceCommand.java | 4 ++-- 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index bc211929..af866f4a 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -483,8 +483,8 @@ TRACE_IDLE_SINGLE=§esingle TRACE_IDLE_AUTO_IGNITE=§eauto TRACE_MESSAGE_START = §aTNT-Tracer started TRACE_MESSAGE_STOP = §cTNT-Tracer stopped -TRACE_MESSAGE_DELETE = §cAll TNT-positions deleted -TRACE_MESSAGE_DELETE_SPECIFIC=§cTrace TNT-positions deleted +TRACE_MESSAGE_CLEAR=§cAll TNT-positions deleted +TRACE_MESSAGE_DELETE=§cTrace TNT-positions deleted TRACE_MESSAGE_SHOW = §aAll TNT-positions shown TRACE_MESSAGE_HIDE = §cAll TNT-positions hidden TRACE_MESSAGE_SHOW_AT=§aTNT-positions shown at {0} diff --git a/BauSystem_Main/src/BauSystem_de.properties b/BauSystem_Main/src/BauSystem_de.properties index 466f26c6..d73906be 100644 --- a/BauSystem_Main/src/BauSystem_de.properties +++ b/BauSystem_Main/src/BauSystem_de.properties @@ -462,7 +462,7 @@ TRACE_MESSAGE_AUTO_DELETE_TESTBLOCK_DESTROY = §7Der letzte Schuss wird gelösch TRACE_MESSAGE_START = §aTNT-Tracer gestartet TRACE_MESSAGE_SINGLE = §aSingle-Tracer gestartet TRACE_MESSAGE_STOP = §cTNT-Tracer gestoppt -TRACE_MESSAGE_DELETE = §cAlle TNT-Positionen gelöscht +TRACE_MESSAGE_CLEAR=§cAlle TNT-Positionen gelöscht TRACE_MESSAGE_SHOW = §aAlle TNT-Positionen angezeigt TRACE_MESSAGE_HIDE = §cAlle TNT-Positionen ausgeblendet TRACE_MESSAGE_DISALLOWED = §cDu darfst hier nicht den TNT-Tracer nutzen diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java index b0313b8e..655cab4c 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Trace.java @@ -154,6 +154,12 @@ public class Trace { } else { entityServer = new REntityServer(); entityServer.addPlayer(player); + entityServer.setCallback((p, rEntity, entityAction) -> { + if (entityAction != REntityServer.EntityAction.INTERACT) return; + if (rEntity instanceof TraceEntity) { + ((TraceEntity) rEntity).printIntoChat(p); + } + }); entityServerMap.put(player, entityServer); } render(getRecords(), entityServer, playerTraceShowData); @@ -190,22 +196,13 @@ public class Trace { List entities = new LinkedList<>(); for (List bundle : bundles) { - entities.add( - new TraceEntity(entityServer, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle)); + entities.add(new TraceEntity(entityServer, bundle.get(0).getLocation(), bundle.get(0).isExplosion(), bundle)); } // Apply modifiers for (ViewFlag flag : flagList) { flag.modify(entityServer, entities); } - entityServer.setCallback((player, rEntity, entityAction) -> { - for (TraceEntity entity : entities) { - if (rEntity.equals(entity)) { - entity.printIntoChat(player); - return; - } - } - }); } /** @@ -224,12 +221,6 @@ public class Trace { recordsLoop: for (TNTPoint record : records) { - if (bundles.isEmpty()) { - List firstBundle = new ArrayList<>(); - firstBundle.add(record); - bundles.add(firstBundle); - } - for (int i = bundles.size() - 1; i >= 0; i--) { List bundle = bundles.get(i); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java index 52525e4e..afd10cc7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceCommand.java @@ -133,13 +133,13 @@ public class TraceCommand extends SWCommand { @Register(value = "clear") public void clear(@Validator Player player) { TraceManager.instance.clear(Region.getRegion(player.getLocation())); - BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE", player); + BauSystem.MESSAGE.send("TRACE_MESSAGE_CLEAR", player); } @Register(value = "delete", description = "TRACE_COMMAND_HELP_DELETE") public void delete(@Validator Player player, Trace trace) { TraceManager.instance.remove(trace); - BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE_SPECIFIC", player); + BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE", player); } @Register(value = "isolate", description = "TRACE_COMMAND_HELP_ISOLATE")