diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java index cbc6c444..116da2e7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/Recorder.java @@ -68,6 +68,11 @@ public class Recorder implements Listener { */ private final Map> historyMap = new HashMap<>(); + /** + * Maps Traces to their next open unique TNTRecord id + */ + private final Map nextOpenTNTRecordIdMap = new HashMap<>(); + /** * Regions where auto-trace is enabled */ @@ -111,6 +116,7 @@ public class Recorder implements Listener { Trace trace = new Trace(region); noExplosionRecorded.add(trace); activeTraces.put(region, trace); + nextOpenTNTRecordIdMap.put(trace, 0); return manager.add(trace); } @@ -152,11 +158,12 @@ public class Recorder implements Listener { */ private void record(TNTPrimed tntPrimed, Trace trace, List destroyedBlocks){ List history = historyMap.getOrDefault(tntPrimed, new ArrayList<>()); - UUID tntID; + int tntID; if(history.size() == 0){ historyMap.put(tntPrimed, history); - tntID = UUID.randomUUID(); + tntID = nextOpenTNTRecordIdMap.get(trace); + nextOpenTNTRecordIdMap.put(trace, tntID + 1); } else tntID = history.get(0).getTntId(); diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java index a7278e26..a6065aaf 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTRecord.java @@ -38,7 +38,7 @@ public class TNTRecord { /** * Unique number to identify records being of the same tnt */ - private final UUID tntId; + private final int tntId; /** * Whether this is a record of a tnt explosion or an entity @@ -90,7 +90,7 @@ public class TNTRecord { */ private final List history; - public TNTRecord(UUID tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart, List history, List destroyedBlocks){ + public TNTRecord(int tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart, List history, List destroyedBlocks){ this.tntId = tntId; this.explosion = explosion; this.inWater = tnt.isInWater();