From b8867451136f6d2dabd131a3214bb7a571c204e0 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Mon, 6 Nov 2023 00:45:32 +0100 Subject: [PATCH] Finished data class for a tnt record --- .../bausystem/features/tracer2/Recorder.java | 12 +++++ .../bausystem/features/tracer2/TNTRecord.java | 44 +++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java index fa00cab0..520b1234 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/Recorder.java @@ -36,9 +36,21 @@ import java.util.Set; @Linked public class Recorder { + /** + * Map for all traces beeing activly recorded + */ private final Map activeTraces = new HashMap<>(); + + /** + * Map for all tnts being traced, by region + */ private final Map> trackedTNT = new HashMap<>(); + /** + * Maps a tracked tnt entity to the last record taken of it + */ + private final Map lastRecordMap = new HashMap<>(); + /** Starts a recording at the given region * * @param region region to be recorded diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java index 01b8642a..84adc3de 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/tracer2/TNTRecord.java @@ -19,5 +19,49 @@ package de.steamwar.bausystem.features.tracer2; +import lombok.Getter; +import org.bukkit.Location; +import org.bukkit.entity.TNTPrimed; +import org.bukkit.util.Vector; + +@Getter public class TNTRecord { + /** + * Whether this is a record of a tnt explosion or an entity + */ + private final boolean explosion; + + /** + * Tick offset, from this record being taken to the start of the trace + */ + private final int ticksSinceStart; + + /** + * Fuse ticks of the recorded tnt (0 if this is an explosion) + */ + private final int fuse; + + /** + * Location of the recorded tnt + */ + private final Location location; + + /** + * Velocity of the recorded tnt + */ + private final Vector velocity; + + /** + * Reference to the last record having been taken of the tnt represented by this record + */ + private final TNTRecord previous; + + public TNTRecord(TNTPrimed tnt, boolean explosion, int ticksSinceStart, TNTRecord previous){ + this.explosion = explosion; + this.ticksSinceStart = ticksSinceStart; + fuse = tnt.getFuseTicks(); + location = tnt.getLocation(); + velocity = tnt.getVelocity(); + this.previous = previous; + } }