Simplify TNTTracer_12 and TNTTracer_15
Simplify TraceEntity_12 and TraceEntity_15 Simplify UpdateEntity_12 and UpdateEntity_15 Add TNTPosition.previousLocation Fix CommandTrace messages for argument 'auto' Remove Experimental
Dieser Commit ist enthalten in:
Ursprung
2a796d710f
Commit
8f35724d72
@ -22,14 +22,15 @@ package de.steamwar.bausystem.tracer;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class TNTTracer_12 {
|
public class TNTTracer_12 {
|
||||||
|
|
||||||
public static AbstractTraceEntity createTNT(World world, TNTPosition tntPosition, Player player) {
|
public static AbstractTraceEntity createTNT(World world, Vector tntPosition, Player player, boolean exploded) {
|
||||||
return new TraceEntity_12(world, tntPosition, player);
|
return new TraceEntity_12(world, tntPosition, player, exploded);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AbstractTraceEntity createUpdatePoint(World world, TNTPosition tntPosition, Player player) {
|
public static AbstractTraceEntity createUpdatePoint(World world, Vector tntPosition, Player player) {
|
||||||
return new UpdateEntity_12(world, tntPosition, player);
|
return new UpdateEntity_12(world, tntPosition, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,21 +24,22 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
|
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
class TraceEntity_12 extends EntityFallingBlock implements AbstractTraceEntity {
|
class TraceEntity_12 extends EntityFallingBlock implements AbstractTraceEntity {
|
||||||
|
|
||||||
private TNTPosition position;
|
private Vector position;
|
||||||
|
|
||||||
public TraceEntity_12(World world, TNTPosition position, Player player) {
|
public TraceEntity_12(World world, Vector position, Player player, boolean exploded) {
|
||||||
super(((CraftWorld) world).getHandle(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
|
super(((CraftWorld) world).getHandle(), position.getX(), position.getY(), position.getZ(), Blocks.TNT.getBlockData());
|
||||||
this.position = position;
|
this.position = position;
|
||||||
|
|
||||||
this.setNoGravity(true);
|
this.setNoGravity(true);
|
||||||
this.ticksLived = -12000;
|
this.ticksLived = -12000;
|
||||||
this.dropItem = false;
|
this.dropItem = false;
|
||||||
this.setCustomNameVisible(true);
|
this.setCustomNameVisible(true);
|
||||||
if (position.isExploded()) {
|
if (exploded) {
|
||||||
this.setCustomName("Exploded");
|
this.setCustomName("Bum");
|
||||||
}
|
}
|
||||||
|
|
||||||
display(player);
|
display(player);
|
||||||
@ -52,9 +53,9 @@ class TraceEntity_12 extends EntityFallingBlock implements AbstractTraceEntity {
|
|||||||
@Override
|
@Override
|
||||||
public AbstractTraceEntity display(Player player) {
|
public AbstractTraceEntity display(Player player) {
|
||||||
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(this, 0);
|
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(this, 0);
|
||||||
ReflectionUtils.setValue("c", packetPlayOutSpawnEntity, position.getLocation().getX());
|
ReflectionUtils.setValue("c", packetPlayOutSpawnEntity, position.getX());
|
||||||
ReflectionUtils.setValue("d", packetPlayOutSpawnEntity, position.getLocation().getY());
|
ReflectionUtils.setValue("d", packetPlayOutSpawnEntity, position.getY());
|
||||||
ReflectionUtils.setValue("e", packetPlayOutSpawnEntity, position.getLocation().getZ());
|
ReflectionUtils.setValue("e", packetPlayOutSpawnEntity, position.getZ());
|
||||||
ReflectionUtils.setValue("f", packetPlayOutSpawnEntity, 0);
|
ReflectionUtils.setValue("f", packetPlayOutSpawnEntity, 0);
|
||||||
ReflectionUtils.setValue("g", packetPlayOutSpawnEntity, 0);
|
ReflectionUtils.setValue("g", packetPlayOutSpawnEntity, 0);
|
||||||
ReflectionUtils.setValue("h", packetPlayOutSpawnEntity, 0);
|
ReflectionUtils.setValue("h", packetPlayOutSpawnEntity, 0);
|
||||||
|
@ -26,13 +26,14 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
|
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
class UpdateEntity_12 extends EntityFallingBlock implements AbstractTraceEntity {
|
class UpdateEntity_12 extends EntityFallingBlock implements AbstractTraceEntity {
|
||||||
|
|
||||||
private TNTPosition position;
|
private Vector position;
|
||||||
|
|
||||||
public UpdateEntity_12(World world, TNTPosition position, Player player) {
|
public UpdateEntity_12(World world, Vector position, Player player) {
|
||||||
super(((CraftWorld) world).getHandle(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.STAINED_GLASS.getBlockData());
|
super(((CraftWorld) world).getHandle(), position.getX(), position.getY(), position.getZ(), Blocks.STAINED_GLASS.getBlockData());
|
||||||
this.position = position;
|
this.position = position;
|
||||||
|
|
||||||
this.setNoGravity(true);
|
this.setNoGravity(true);
|
||||||
@ -51,9 +52,9 @@ class UpdateEntity_12 extends EntityFallingBlock implements AbstractTraceEntity
|
|||||||
@Override
|
@Override
|
||||||
public AbstractTraceEntity display(Player player) {
|
public AbstractTraceEntity display(Player player) {
|
||||||
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(this, 0);
|
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(this, 0);
|
||||||
ReflectionUtils.setValue("c", packetPlayOutSpawnEntity, position.getLocation().getX());
|
ReflectionUtils.setValue("c", packetPlayOutSpawnEntity, position.getX());
|
||||||
ReflectionUtils.setValue("d", packetPlayOutSpawnEntity, position.getLocation().getY());
|
ReflectionUtils.setValue("d", packetPlayOutSpawnEntity, position.getY());
|
||||||
ReflectionUtils.setValue("e", packetPlayOutSpawnEntity, position.getLocation().getZ());
|
ReflectionUtils.setValue("e", packetPlayOutSpawnEntity, position.getZ());
|
||||||
ReflectionUtils.setValue("f", packetPlayOutSpawnEntity, 0);
|
ReflectionUtils.setValue("f", packetPlayOutSpawnEntity, 0);
|
||||||
ReflectionUtils.setValue("g", packetPlayOutSpawnEntity, 0);
|
ReflectionUtils.setValue("g", packetPlayOutSpawnEntity, 0);
|
||||||
ReflectionUtils.setValue("h", packetPlayOutSpawnEntity, 0);
|
ReflectionUtils.setValue("h", packetPlayOutSpawnEntity, 0);
|
||||||
|
@ -22,14 +22,15 @@ package de.steamwar.bausystem.tracer;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class TNTTracer_15 {
|
public class TNTTracer_15 {
|
||||||
|
|
||||||
public static AbstractTraceEntity createTNT(World world, TNTPosition tntPosition, Player player) {
|
public static AbstractTraceEntity createTNT(World world, Vector tntPosition, Player player, boolean exploded) {
|
||||||
return new TraceEntity_15(world, tntPosition, player);
|
return new TraceEntity_15(world, tntPosition, player, exploded);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AbstractTraceEntity createUpdatePoint(World world, TNTPosition tntPosition, Player player) {
|
public static AbstractTraceEntity createUpdatePoint(World world, Vector tntPosition, Player player) {
|
||||||
return new UpdateEntity_15(world, tntPosition, player);
|
return new UpdateEntity_15(world, tntPosition, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,22 +24,23 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
class TraceEntity_15 extends EntityFallingBlock implements AbstractTraceEntity {
|
class TraceEntity_15 extends EntityFallingBlock implements AbstractTraceEntity {
|
||||||
|
|
||||||
private static final Vec3D ZERO = new Vec3D(0, 0, 0);
|
private static final Vec3D ZERO = new Vec3D(0, 0, 0);
|
||||||
private TNTPosition position;
|
private Vector position;
|
||||||
|
|
||||||
public TraceEntity_15(World world, TNTPosition position, Player player) {
|
public TraceEntity_15(World world, Vector position, Player player, boolean exploded) {
|
||||||
super(((CraftWorld) world).getHandle(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
|
super(((CraftWorld) world).getHandle(), position.getX(), position.getY(), position.getZ(), Blocks.TNT.getBlockData());
|
||||||
this.position = position;
|
this.position = position;
|
||||||
|
|
||||||
this.setNoGravity(true);
|
this.setNoGravity(true);
|
||||||
this.ticksLived = -12000;
|
this.ticksLived = -12000;
|
||||||
this.dropItem = false;
|
this.dropItem = false;
|
||||||
this.setCustomNameVisible(true);
|
this.setCustomNameVisible(true);
|
||||||
if (position.isExploded()) {
|
if (exploded) {
|
||||||
this.setCustomName(new ChatComponentText("Exploded"));
|
this.setCustomName(new ChatComponentText("Bum"));
|
||||||
}
|
}
|
||||||
|
|
||||||
display(player);
|
display(player);
|
||||||
@ -52,7 +53,7 @@ class TraceEntity_15 extends EntityFallingBlock implements AbstractTraceEntity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractTraceEntity display(Player player) {
|
public AbstractTraceEntity display(Player player) {
|
||||||
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(getId(), getUniqueID(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), 0, 0, EntityTypes.FALLING_BLOCK, Block.getCombinedId(Blocks.TNT.getBlockData()), ZERO);
|
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(getId(), getUniqueID(), position.getX(), position.getY(), position.getZ(), 0, 0, EntityTypes.FALLING_BLOCK, Block.getCombinedId(Blocks.TNT.getBlockData()), ZERO);
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutSpawnEntity);
|
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutSpawnEntity);
|
||||||
|
|
||||||
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true);
|
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true);
|
||||||
|
@ -26,14 +26,15 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
class UpdateEntity_15 extends EntityFallingBlock implements AbstractTraceEntity {
|
class UpdateEntity_15 extends EntityFallingBlock implements AbstractTraceEntity {
|
||||||
|
|
||||||
private static final Vec3D ZERO = new Vec3D(0, 0, 0);
|
private static final Vec3D ZERO = new Vec3D(0, 0, 0);
|
||||||
private TNTPosition position;
|
private Vector position;
|
||||||
|
|
||||||
public UpdateEntity_15(World world, TNTPosition position, Player player) {
|
public UpdateEntity_15(World world, Vector position, Player player) {
|
||||||
super(((CraftWorld) world).getHandle(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
|
super(((CraftWorld) world).getHandle(), position.getX(), position.getY(), position.getZ(), Blocks.TNT.getBlockData());
|
||||||
this.position = position;
|
this.position = position;
|
||||||
|
|
||||||
this.setNoGravity(true);
|
this.setNoGravity(true);
|
||||||
@ -51,7 +52,7 @@ class UpdateEntity_15 extends EntityFallingBlock implements AbstractTraceEntity
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractTraceEntity display(Player player) {
|
public AbstractTraceEntity display(Player player) {
|
||||||
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(getId(), getUniqueID(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), 0, 0, EntityTypes.FALLING_BLOCK, Block.getCombinedId(Blocks.WHITE_STAINED_GLASS.getBlockData()), ZERO);
|
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(getId(), getUniqueID(), position.getX(), position.getY(), position.getZ(), 0, 0, EntityTypes.FALLING_BLOCK, Block.getCombinedId(Blocks.WHITE_STAINED_GLASS.getBlockData()), ZERO);
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutSpawnEntity);
|
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutSpawnEntity);
|
||||||
|
|
||||||
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true);
|
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true);
|
||||||
|
@ -25,18 +25,17 @@ import org.bukkit.util.Vector;
|
|||||||
public class TNTPosition {
|
public class TNTPosition {
|
||||||
|
|
||||||
private Vector location;
|
private Vector location;
|
||||||
private Vector velocity;
|
private Vector previousLocation = null;
|
||||||
private boolean exploded;
|
private boolean exploded;
|
||||||
|
|
||||||
public TNTPosition(Entity entity, boolean exploded) {
|
public TNTPosition(Entity entity, Vector previousLocation, boolean exploded) {
|
||||||
location = entity.getLocation().toVector();
|
location = entity.getLocation().toVector();
|
||||||
velocity = entity.getVelocity();
|
this.previousLocation = previousLocation;
|
||||||
this.exploded = exploded;
|
this.exploded = exploded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TNTPosition(Vector vector) {
|
public TNTPosition(Vector vector) {
|
||||||
location = vector;
|
location = vector;
|
||||||
this.velocity = null;
|
|
||||||
this.exploded = false;
|
this.exploded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,8 +43,8 @@ public class TNTPosition {
|
|||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector getVelocity() {
|
public Vector getPreviousLocation() {
|
||||||
return velocity;
|
return previousLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isExploded() {
|
public boolean isExploded() {
|
||||||
|
@ -22,6 +22,7 @@ package de.steamwar.bausystem.commands;
|
|||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.Permission;
|
import de.steamwar.bausystem.Permission;
|
||||||
import de.steamwar.bausystem.tracer.record.RecordStateMachine;
|
import de.steamwar.bausystem.tracer.record.RecordStateMachine;
|
||||||
|
import de.steamwar.bausystem.tracer.record.RecordStatus;
|
||||||
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.world.Welt;
|
import de.steamwar.bausystem.world.Welt;
|
||||||
@ -76,7 +77,17 @@ public class CommandTrace implements CommandExecutor {
|
|||||||
case "toggleauto":
|
case "toggleauto":
|
||||||
case "auto":
|
case "auto":
|
||||||
RecordStateMachine.commandAuto();
|
RecordStateMachine.commandAuto();
|
||||||
player.sendMessage(BauSystem.PREFIX + "§eTNT-Tracer auf Auto gestellt");
|
switch (RecordStateMachine.getRecordStatus()) {
|
||||||
|
case RECORD_AUTO:
|
||||||
|
player.sendMessage(BauSystem.PREFIX + "§aAuto-Tracer gestartet");
|
||||||
|
break;
|
||||||
|
case IDLE_AUTO:
|
||||||
|
player.sendMessage(BauSystem.PREFIX + "§cAuto-Tracer gestoppt");
|
||||||
|
break;
|
||||||
|
case RECORD:
|
||||||
|
player.sendMessage(BauSystem.PREFIX + "§cTNT-Tracer muss gestoppt werden");
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "clear":
|
case "clear":
|
||||||
case "delete":
|
case "delete":
|
||||||
|
@ -57,7 +57,6 @@ public class Record {
|
|||||||
|
|
||||||
public static class TNTRecord {
|
public static class TNTRecord {
|
||||||
private final List<TNTPosition> positions = new ArrayList<>(41);
|
private final List<TNTPosition> positions = new ArrayList<>(41);
|
||||||
private boolean exploded = false;
|
|
||||||
|
|
||||||
public void showAll(ShowMode mode) {
|
public void showAll(ShowMode mode) {
|
||||||
for (TNTPosition position : positions)
|
for (TNTPosition position : positions)
|
||||||
@ -66,14 +65,22 @@ 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 = new TNTPosition(tntPrimed, exploded);
|
add(tntPrimed, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void add(TNTPrimed tntPrimed, boolean exploded) {
|
||||||
|
TNTPosition position;
|
||||||
|
if (positions.isEmpty()) {
|
||||||
|
position = new TNTPosition(tntPrimed, null, exploded);
|
||||||
|
} else {
|
||||||
|
position = new TNTPosition(tntPrimed, positions.get(positions.size() - 1).getLocation(), exploded);
|
||||||
|
}
|
||||||
positions.add(position);
|
positions.add(position);
|
||||||
TraceShowManager.show(position);
|
TraceShowManager.show(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void explode(TNTPrimed tntPrimed) {
|
public void explode(TNTPrimed tntPrimed) {
|
||||||
exploded = true;
|
add(tntPrimed, true);
|
||||||
add(tntPrimed);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,9 +37,6 @@ public class TraceShowManager implements Listener {
|
|||||||
case "advancednowater":
|
case "advancednowater":
|
||||||
showMode = new AdvancedNoWater(player);
|
showMode = new AdvancedNoWater(player);
|
||||||
break;
|
break;
|
||||||
case "experimental":
|
|
||||||
showMode = new Experimental(player);
|
|
||||||
break;
|
|
||||||
case "basic":
|
case "basic":
|
||||||
case "default":
|
case "default":
|
||||||
default:
|
default:
|
||||||
|
@ -44,16 +44,15 @@ public class Advanced extends Basic {
|
|||||||
public void show(TNTPosition position) {
|
public void show(TNTPosition position) {
|
||||||
super.show(position);
|
super.show(position);
|
||||||
|
|
||||||
if (position.isExploded()) return;
|
if (position.getPreviousLocation() == null) return;
|
||||||
if (position.getVelocity() == null) return;
|
Vector previousLocation = position.getLocation().clone().subtract(position.getPreviousLocation());
|
||||||
Vector nextLocation = position.getLocation().clone().add(position.getVelocity());
|
|
||||||
|
|
||||||
Vector updatePointY = position.getLocation().clone().setY(nextLocation.getY());
|
Vector updatePointY = previousLocation.clone().setY(position.getLocation().getY());
|
||||||
Vector updatePointXZ;
|
Vector updatePointXZ;
|
||||||
if (Math.abs(position.getVelocity().getX()) > Math.abs(position.getVelocity().getZ())) {
|
if (Math.abs(position.getPreviousLocation().getX()) > Math.abs(position.getPreviousLocation().getZ())) {
|
||||||
updatePointXZ = updatePointY.clone().setX(nextLocation.getX());
|
updatePointXZ = updatePointY.clone().setX(position.getLocation().getX());
|
||||||
} else {
|
} else {
|
||||||
updatePointXZ = updatePointY.clone().setZ(nextLocation.getZ());
|
updatePointXZ = updatePointY.clone().setZ(position.getLocation().getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!position.getLocation().equals(updatePointY)) {
|
if (!position.getLocation().equals(updatePointY)) {
|
||||||
@ -64,10 +63,10 @@ public class Advanced extends Basic {
|
|||||||
|
|
||||||
switch (Core.getVersion()) {
|
switch (Core.getVersion()) {
|
||||||
case 12:
|
case 12:
|
||||||
updateEntityMap.put(updatePointPosition, TNTTracer_12.createUpdatePoint(player.getWorld(), new TNTPosition(updatePointY), player));
|
updateEntityMap.put(updatePointPosition, TNTTracer_12.createUpdatePoint(player.getWorld(), new TNTPosition(updatePointY).getLocation(), player));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
updateEntityMap.put(updatePointPosition, TNTTracer_15.createUpdatePoint(player.getWorld(), new TNTPosition(updatePointY), player));
|
updateEntityMap.put(updatePointPosition, TNTTracer_15.createUpdatePoint(player.getWorld(), new TNTPosition(updatePointY).getLocation(), player));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -79,10 +78,10 @@ public class Advanced extends Basic {
|
|||||||
|
|
||||||
switch (Core.getVersion()) {
|
switch (Core.getVersion()) {
|
||||||
case 12:
|
case 12:
|
||||||
updateEntityMap.put(updatePointPosition, TNTTracer_12.createUpdatePoint(player.getWorld(), new TNTPosition(updatePointXZ), player));
|
updateEntityMap.put(updatePointPosition, TNTTracer_12.createUpdatePoint(player.getWorld(), new TNTPosition(updatePointXZ).getLocation(), player));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
updateEntityMap.put(updatePointPosition, TNTTracer_15.createUpdatePoint(player.getWorld(), new TNTPosition(updatePointXZ), player));
|
updateEntityMap.put(updatePointPosition, TNTTracer_15.createUpdatePoint(player.getWorld(), new TNTPosition(updatePointXZ).getLocation(), player));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,10 +27,10 @@ public class Basic implements ShowMode {
|
|||||||
|
|
||||||
switch (Core.getVersion()) {
|
switch (Core.getVersion()) {
|
||||||
case 12:
|
case 12:
|
||||||
tntEntityMap.put(roundedTNTPosition, TNTTracer_12.createTNT(player.getWorld(), position, player));
|
tntEntityMap.put(roundedTNTPosition, TNTTracer_12.createTNT(player.getWorld(), position.getLocation(), player, position.isExploded()));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
tntEntityMap.put(roundedTNTPosition, TNTTracer_15.createTNT(player.getWorld(), position, player));
|
tntEntityMap.put(roundedTNTPosition, TNTTracer_15.createTNT(player.getWorld(), position.getLocation(), player, position.isExploded()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,80 +0,0 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
* This file is a part of the SteamWar software.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2020 SteamWar.de-Serverteam
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
* /
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.tracer.show.mode;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.tracer.*;
|
|
||||||
import de.steamwar.bausystem.tracer.show.ShowMode;
|
|
||||||
import de.steamwar.core.Core;
|
|
||||||
import net.minecraft.server.v1_15_R1.EntityTNTPrimed;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class Experimental implements ShowMode {
|
|
||||||
|
|
||||||
private final Player player;
|
|
||||||
|
|
||||||
private Map<RoundedTNTPosition, AbstractTraceEntity> tntEntityMap = new HashMap<>();
|
|
||||||
|
|
||||||
public Experimental(Player player) {
|
|
||||||
this.player = player;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void show(TNTPosition position) {
|
|
||||||
RoundedTNTPosition roundedTNTPosition = new RoundedTNTPosition(position);
|
|
||||||
if (tntEntityMap.containsKey(roundedTNTPosition)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (Core.getVersion()) {
|
|
||||||
case 12:
|
|
||||||
tntEntityMap.put(roundedTNTPosition, TNTTracer_12.createTNT(player.getWorld(), position, player));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
tntEntityMap.put(roundedTNTPosition, TNTTracer_15.createTNT(player.getWorld(), position, player));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
position = new TNTPosition(position.getLocation().clone().subtract(position.getVelocity().clone().multiply(0.98D / 20)));
|
|
||||||
|
|
||||||
switch (Core.getVersion()) {
|
|
||||||
case 12:
|
|
||||||
tntEntityMap.put(roundedTNTPosition, TNTTracer_12.createUpdatePoint(player.getWorld(), position, player));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
tntEntityMap.put(roundedTNTPosition, TNTTracer_15.createUpdatePoint(player.getWorld(), position, player));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void hide() {
|
|
||||||
tntEntityMap.forEach((roundedTNTPosition, abstractTraceEntity) -> {
|
|
||||||
abstractTraceEntity.hide(player);
|
|
||||||
abstractTraceEntity.remove();
|
|
||||||
});
|
|
||||||
tntEntityMap.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
In neuem Issue referenzieren
Einen Benutzer sperren