Simplify TNTPosition
Dieser Commit ist enthalten in:
Ursprung
5a881be746
Commit
62d223b470
@ -25,18 +25,18 @@ import org.bukkit.util.Vector;
|
|||||||
public class TNTPosition {
|
public class TNTPosition {
|
||||||
|
|
||||||
private Vector location;
|
private Vector location;
|
||||||
private TNTPosition previous;
|
private Vector velocity;
|
||||||
private boolean exploded;
|
private boolean exploded;
|
||||||
|
|
||||||
public TNTPosition(Entity entity, TNTPosition previous, boolean exploded) {
|
public TNTPosition(Entity entity, boolean exploded) {
|
||||||
location = entity.getLocation().toVector();
|
location = entity.getLocation().toVector();
|
||||||
this.previous = previous;
|
velocity = entity.getVelocity();
|
||||||
this.exploded = exploded;
|
this.exploded = exploded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TNTPosition(Vector vector) {
|
public TNTPosition(Vector vector) {
|
||||||
location = vector;
|
location = vector;
|
||||||
this.previous = null;
|
this.velocity = null;
|
||||||
this.exploded = false;
|
this.exploded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,8 +44,8 @@ public class TNTPosition {
|
|||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TNTPosition getPrevious() {
|
public Vector getVelocity() {
|
||||||
return previous;
|
return velocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isExploded() {
|
public boolean isExploded() {
|
||||||
|
@ -24,6 +24,10 @@ import de.steamwar.bausystem.Permission;
|
|||||||
import de.steamwar.bausystem.tracer.record.RecordStateMachine;
|
import de.steamwar.bausystem.tracer.record.RecordStateMachine;
|
||||||
import de.steamwar.bausystem.tracer.show.StoredRecords;
|
import de.steamwar.bausystem.tracer.show.StoredRecords;
|
||||||
import de.steamwar.bausystem.tracer.show.TraceShowManager;
|
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 de.steamwar.bausystem.world.Welt;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
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 start §8- §7Startet die Aufnahme aller TNT-Positionen");
|
||||||
player.sendMessage("§8/§etrace stop §8- §7Stoppt den TNT-Tracer");
|
player.sendMessage("§8/§etrace stop §8- §7Stoppt den TNT-Tracer");
|
||||||
player.sendMessage("§8/§etrace toggleauto §8- §7Automatischer Aufnahmenstart");
|
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 show §8<§enowater§8|§eadvanced§8|§eadvanced-nowater§8> §8- §7Zeigt alle TNT-Positionen");
|
||||||
player.sendMessage("§8/§etrace hide §8<§7TNT-ID§8> §8- §7Versteckt alle TNT-Positionen");
|
player.sendMessage("§8/§etrace hide §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- §7Löscht alle TNT-Positionen");
|
||||||
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 list §8<§7FRAME-ID§8> §8- §7Listet alle TNT auf");
|
// 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("§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) {
|
private boolean permissionCheck(Player player) {
|
||||||
|
@ -66,12 +66,7 @@ public class Record {
|
|||||||
|
|
||||||
/* The following methods should only be called by a recorder */
|
/* The following methods should only be called by a recorder */
|
||||||
public void add(TNTPrimed tntPrimed) {
|
public void add(TNTPrimed tntPrimed) {
|
||||||
TNTPosition position;
|
TNTPosition position = new TNTPosition(tntPrimed, exploded);
|
||||||
if (positions.isEmpty()) {
|
|
||||||
position = new TNTPosition(tntPrimed, null, exploded);
|
|
||||||
} else {
|
|
||||||
position = new TNTPosition(tntPrimed, positions.get(positions.size() - 1), exploded);
|
|
||||||
}
|
|
||||||
positions.add(position);
|
positions.add(position);
|
||||||
TraceShowManager.show(position);
|
TraceShowManager.show(position);
|
||||||
}
|
}
|
||||||
|
@ -44,12 +44,12 @@ public class Advanced extends Basic {
|
|||||||
public void show(TNTPosition position) {
|
public void show(TNTPosition position) {
|
||||||
super.show(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 = previousLocation.clone().setY(position.getLocation().getY());
|
||||||
Vector updatePointY = position.getPrevious().getLocation().clone().setY(position.getLocation().getY());
|
|
||||||
Vector updatePointXZ;
|
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());
|
updatePointXZ = updatePointY.clone().setX(position.getLocation().getX());
|
||||||
} else {
|
} else {
|
||||||
updatePointXZ = updatePointY.clone().setZ(position.getLocation().getZ());
|
updatePointXZ = updatePointY.clone().setZ(position.getLocation().getZ());
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren