diff --git a/BauSystem_API/src/de/steamwar/bausystem/tracer/TNTPosition.java b/BauSystem_API/src/de/steamwar/bausystem/tracer/TNTPosition.java index 5c47ed6..8922696 100644 --- a/BauSystem_API/src/de/steamwar/bausystem/tracer/TNTPosition.java +++ b/BauSystem_API/src/de/steamwar/bausystem/tracer/TNTPosition.java @@ -25,18 +25,18 @@ import org.bukkit.util.Vector; public class TNTPosition { private Vector location; - private TNTPosition previous; + private Vector velocity; private boolean exploded; - public TNTPosition(Entity entity, TNTPosition previous, boolean exploded) { + public TNTPosition(Entity entity, boolean exploded) { location = entity.getLocation().toVector(); - this.previous = previous; + velocity = entity.getVelocity(); this.exploded = exploded; } public TNTPosition(Vector vector) { location = vector; - this.previous = null; + this.velocity = null; this.exploded = false; } @@ -44,8 +44,8 @@ public class TNTPosition { return location; } - public TNTPosition getPrevious() { - return previous; + public Vector getVelocity() { + return velocity; } public boolean isExploded() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java index 5267cce..7245237 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/commands/CommandTrace.java @@ -24,6 +24,10 @@ import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.tracer.record.RecordStateMachine; import de.steamwar.bausystem.tracer.show.StoredRecords; import de.steamwar.bausystem.tracer.show.TraceShowManager; +import de.steamwar.bausystem.tracer.show.mode.Advanced; +import de.steamwar.bausystem.tracer.show.mode.AdvancedNoWater; +import de.steamwar.bausystem.tracer.show.mode.Basic; +import de.steamwar.bausystem.tracer.show.mode.BasicNoWater; import de.steamwar.bausystem.world.Welt; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; @@ -36,15 +40,12 @@ public class CommandTrace implements CommandExecutor { player.sendMessage("§8/§etrace start §8- §7Startet die Aufnahme aller TNT-Positionen"); player.sendMessage("§8/§etrace stop §8- §7Stoppt den TNT-Tracer"); player.sendMessage("§8/§etrace toggleauto §8- §7Automatischer Aufnahmenstart"); - player.sendMessage("§8/§etrace show §8<§eblock§8|§eparticle§8|§7TNT-ID§8> §8- §7Zeigt alle TNT-Positionen"); - player.sendMessage("§8/§etrace hide §8<§7TNT-ID§8> §8- §7Versteckt alle TNT-Positionen"); - player.sendMessage("§8/§etrace toggleshow §8<§7TNT-ID§8> §8- §7Zeigt/Versteckt ein TNT"); - player.sendMessage("§8/§etrace delete §8<§7TNT-ID§8> §8- §7Löscht alle TNT-Positionen"); - player.sendMessage("§8/§etrace interpolate §8[§eall§8|§eyaxis§8|§enone§8] §8- §7Interpolationsoptionen"); - player.sendMessage("§8/§etrace distance §8[§7distanz§8] §8- §7Distanzoptionen"); + player.sendMessage("§8/§etrace show §8<§enowater§8|§eadvanced§8|§eadvanced-nowater§8> §8- §7Zeigt alle TNT-Positionen"); + player.sendMessage("§8/§etrace hide §8- §7Versteckt alle TNT-Positionen"); + player.sendMessage("§8/§etrace delete §8- §7Löscht alle TNT-Positionen"); // player.sendMessage("§8/§etrace list §8<§7FRAME-ID§8> §8- §7Listet alle TNT auf"); // player.sendMessage("§8/§etrace gui §8- §7Zeigt die Trace Oberfläche an"); - player.sendMessage("§7Optionale Parameter mit §8<>§7, Benötigte Parameter mit §8[]"); + // player.sendMessage("§7Optionale Parameter mit §8<>§7, Benötigte Parameter mit §8[]"); } private boolean permissionCheck(Player player) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/Record.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/Record.java index 9b4a93c..8f72dcd 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/Record.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/Record.java @@ -66,12 +66,7 @@ public class Record { /* The following methods should only be called by a recorder */ public void add(TNTPrimed tntPrimed) { - TNTPosition position; - if (positions.isEmpty()) { - position = new TNTPosition(tntPrimed, null, exploded); - } else { - position = new TNTPosition(tntPrimed, positions.get(positions.size() - 1), exploded); - } + TNTPosition position = new TNTPosition(tntPrimed, exploded); positions.add(position); TraceShowManager.show(position); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Advanced.java b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Advanced.java index 84dd2de..9c913e7 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Advanced.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/tracer/show/mode/Advanced.java @@ -44,12 +44,12 @@ public class Advanced extends Basic { public void show(TNTPosition position) { super.show(position); - if (position.getPrevious() == null) return; + if (position.getVelocity() == null) return; + Vector previousLocation = position.getLocation().clone().subtract(position.getVelocity()); - Vector vector = position.getLocation().clone().subtract(position.getPrevious().getLocation()); - Vector updatePointY = position.getPrevious().getLocation().clone().setY(position.getLocation().getY()); + Vector updatePointY = previousLocation.clone().setY(position.getLocation().getY()); Vector updatePointXZ; - if (Math.abs(vector.getX()) > Math.abs(vector.getZ())) { + if (Math.abs(position.getVelocity().getX()) > Math.abs(position.getVelocity().getZ())) { updatePointXZ = updatePointY.clone().setX(position.getLocation().getX()); } else { updatePointXZ = updatePointY.clone().setZ(position.getLocation().getZ());