From 3e6dd614281708d858e27a9b0d19f38b306107f1 Mon Sep 17 00:00:00 2001 From: D4rkr34lm Date: Sun, 18 Aug 2024 12:08:57 +0200 Subject: [PATCH] Readd allArgs and history place holder --- .../bausystem/features/tracer/TNTPoint.java | 69 ++----------------- .../features/tracer/TraceRepository.java | 2 +- 2 files changed, 5 insertions(+), 66 deletions(-) diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java index 182102d4..785aca63 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TNTPoint.java @@ -40,8 +40,9 @@ import java.util.Optional; /** * Recording of a tnt at a specific tick */ +@AllArgsConstructor @Getter -public class TNTPoint implements Externalizable { +public class TNTPoint{ /** * Unique number to identify records being of the same tnt */ @@ -98,33 +99,9 @@ public class TNTPoint implements Externalizable { private List history; /** - * Constructor for deserialization only !! Do not Call !! + * Constructor fo object creation in trace recording */ - protected TNTPoint(int tntId, boolean explosion, - boolean inWater, - boolean afterFirstExplosion, - boolean destroyedBuildArea, - boolean destroyedTestBlock, - long ticksSinceStart, - int fuse, - Location location, - Vector velocity) { - this.tntId = tntId; - this.explosion = explosion; - this.inWater = inWater; - this.afterFirstExplosion = afterFirstExplosion; - this.destroyedBuildArea = destroyedBuildArea; - this.destroyedTestBlock = destroyedTestBlock; - this.ticksSinceStart = ticksSinceStart; - this.fuse = fuse; - this.location = location; - this.velocity = velocity; - } - - /** - * - */ - public TNTPoint(int tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart, + protected TNTPoint(int tntId, TNTPrimed tnt, boolean explosion, boolean afterFirstExplosion, long ticksSinceStart, List history, List destroyedBlocks) { this.tntId = tntId; this.explosion = explosion; @@ -183,44 +160,6 @@ public class TNTPoint implements Externalizable { this.history = history; } - @Override - public void writeExternal(ObjectOutput objectOutput) throws IOException { - objectOutput.writeInt(tntId); - objectOutput.writeBoolean(explosion); - objectOutput.writeBoolean(inWater); - objectOutput.writeBoolean(afterFirstExplosion); - objectOutput.writeBoolean(destroyedBuildArea); - objectOutput.writeBoolean(destroyedTestBlock); - objectOutput.writeLong(ticksSinceStart); - objectOutput.writeInt(fuse); - objectOutput.writeDouble(location.getX()); - objectOutput.writeDouble(location.getY()); - objectOutput.writeDouble(location.getZ()); - objectOutput.writeDouble(velocity.getX()); - objectOutput.writeDouble(velocity.getY()); - objectOutput.writeDouble(velocity.getZ()); - } - - @Override - public void readExternal(ObjectInput objectInput) throws IOException { - tntId = objectInput.readInt(); - explosion = objectInput.readBoolean(); - inWater = objectInput.readBoolean(); - afterFirstExplosion = objectInput.readBoolean(); - destroyedBuildArea = objectInput.readBoolean(); - destroyedTestBlock = objectInput.readBoolean(); - ticksSinceStart = objectInput.readLong(); - fuse = objectInput.readInt(); - double locX = objectInput.readDouble(); - double locY = objectInput.readDouble(); - double locZ = objectInput.readDouble(); - location = new Location(Bukkit.getWorlds().get(0), locX, locY, locZ); - double velX = objectInput.readDouble(); - double velY = objectInput.readDouble(); - double velZ = objectInput.readDouble(); - velocity = new Vector(velX, velY, velZ); - } - @Override public String toString() { return "TNTPoint{" + diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRepository.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRepository.java index a1577f48..c88ab2f2 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRepository.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/tracer/TraceRepository.java @@ -109,7 +109,7 @@ public class TraceRepository { double velZ = objectInput.readDouble(); Vector velocity = new Vector(velX, velY, velZ); - return new TNTPoint(tntId, explosion, inWater, afterFirstExplosion, destroyedBuildArea, destroyedTestBlock, ticksSinceStart, fuse, location, velocity); + return new TNTPoint(tntId, explosion, inWater, afterFirstExplosion, destroyedBuildArea, destroyedTestBlock, ticksSinceStart, fuse, location, velocity, Collections.emptyList()); } @SneakyThrows