Tracer-entity #147
@ -8,11 +8,8 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class TNTEntity_12 extends EntityFallingBlock implements AbstractTNTEntity {
|
public class TNTEntity_12 extends EntityFallingBlock implements AbstractTNTEntity {
|
||||||
|
|
||||||
private TNTPosition position;
|
|
||||||
|
|
||||||
public TNTEntity_12(World world, TNTPosition position, Player player) {
|
public TNTEntity_12(World world, TNTPosition position, Player player) {
|
||||||
super(((CraftWorld) world).getHandle(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
|
super(((CraftWorld) world).getHandle(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
|
||||||
this.position = position;
|
|
||||||
|
|
||||||
this.setNoGravity(true);
|
this.setNoGravity(true);
|
||||||
this.ticksLived = -12000;
|
this.ticksLived = -12000;
|
||||||
@ -35,6 +32,9 @@ public class TNTEntity_12 extends EntityFallingBlock implements AbstractTNTEntit
|
|||||||
ReflectionUtils.setValue("h", packetPlayOutSpawnEntity, 0);
|
ReflectionUtils.setValue("h", packetPlayOutSpawnEntity, 0);
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutSpawnEntity);
|
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutSpawnEntity);
|
||||||
|
|
||||||
|
PacketPlayOutEntityTeleport packetPlayOutEntityTeleport = new PacketPlayOutEntityTeleport(this);
|
||||||
|
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityTeleport);
|
||||||
|
|
||||||
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true);
|
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true);
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityMetadata);
|
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityMetadata);
|
||||||
|
|
||||||
|
@ -8,11 +8,8 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class TNTEntity_15 extends EntityFallingBlock implements AbstractTNTEntity {
|
public class TNTEntity_15 extends EntityFallingBlock implements AbstractTNTEntity {
|
||||||
|
|
||||||
private TNTPosition position;
|
|
||||||
|
|
||||||
public TNTEntity_15(World world, TNTPosition position, Player player) {
|
public TNTEntity_15(World world, TNTPosition position, Player player) {
|
||||||
super(((CraftWorld) world).getHandle(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
|
super(((CraftWorld) world).getHandle(), position.getLocation().getX(), position.getLocation().getY(), position.getLocation().getZ(), Blocks.TNT.getBlockData());
|
||||||
this.position = position;
|
|
||||||
|
|
||||||
this.setNoGravity(true);
|
this.setNoGravity(true);
|
||||||
this.ticksLived = -12000;
|
this.ticksLived = -12000;
|
||||||
@ -29,12 +26,17 @@ public class TNTEntity_15 extends EntityFallingBlock implements AbstractTNTEntit
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractTNTEntity display(Player player) {
|
public AbstractTNTEntity display(Player player) {
|
||||||
|
System.out.println("SHOW: " + player + " " + locX() + " " + locY() + " " + locZ());
|
||||||
|
|
||||||
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(this);
|
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(this);
|
||||||
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);
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutSpawnEntity);
|
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutSpawnEntity);
|
||||||
|
|
||||||
|
PacketPlayOutEntityTeleport packetPlayOutEntityTeleport = new PacketPlayOutEntityTeleport(this);
|
||||||
|
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityTeleport);
|
||||||
|
|
||||||
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true);
|
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true);
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityMetadata);
|
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityMetadata);
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ 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.show.StoredRecords;
|
import de.steamwar.bausystem.tracer.show.StoredRecords;
|
||||||
|
import de.steamwar.bausystem.tracer.show.TraceShowManager;
|
||||||
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;
|
||||||
@ -83,8 +84,10 @@ public class CommandTrace implements CommandExecutor {
|
|||||||
player.sendMessage(BauSystem.PREFIX + "§cAlle TNT-Positionen gelöscht");
|
player.sendMessage(BauSystem.PREFIX + "§cAlle TNT-Positionen gelöscht");
|
||||||
break;
|
break;
|
||||||
case "show":
|
case "show":
|
||||||
|
TraceShowManager.show(player);
|
||||||
break;
|
break;
|
||||||
case "hide":
|
case "hide":
|
||||||
|
TraceShowManager.hide(player);
|
||||||
break;
|
break;
|
||||||
case "toggleshow":
|
case "toggleshow":
|
||||||
case "interpolate":
|
case "interpolate":
|
||||||
|
@ -20,7 +20,8 @@
|
|||||||
package de.steamwar.bausystem.tracer.record;
|
package de.steamwar.bausystem.tracer.record;
|
||||||
|
|
||||||
public class RecordStateMachine {
|
public class RecordStateMachine {
|
||||||
private RecordStateMachine(){}
|
private RecordStateMachine() {
|
||||||
|
}
|
||||||
|
|
||||||
private static final TraceAutoHandler autoHandler = new TraceAutoHandler();
|
private static final TraceAutoHandler autoHandler = new TraceAutoHandler();
|
||||||
|
|
||||||
@ -28,15 +29,15 @@ public class RecordStateMachine {
|
|||||||
private static Recorder recorder = null;
|
private static Recorder recorder = null;
|
||||||
|
|
||||||
public static void commandStart() {
|
public static void commandStart() {
|
||||||
recordStatus = RecordStatus.RECORD;
|
|
||||||
autoHandler.disable();
|
autoHandler.disable();
|
||||||
recordStart();
|
recordStart();
|
||||||
|
recordStatus = RecordStatus.RECORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void commandStop() {
|
public static void commandStop() {
|
||||||
recordStatus = RecordStatus.IDLE;
|
|
||||||
autoHandler.disable();
|
autoHandler.disable();
|
||||||
recordStop();
|
recordStop();
|
||||||
|
recordStatus = RecordStatus.IDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void commandAuto() {
|
public static void commandAuto() {
|
||||||
@ -53,26 +54,22 @@ public class RecordStateMachine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void autoRecord() {
|
static void autoRecord() {
|
||||||
recordStatus = RecordStatus.RECORD_AUTO;
|
|
||||||
recordStart();
|
recordStart();
|
||||||
|
recordStatus = RecordStatus.RECORD_AUTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void autoIdle() {
|
static void autoIdle() {
|
||||||
recordStatus = RecordStatus.IDLE_AUTO;
|
|
||||||
recordStop();
|
recordStop();
|
||||||
|
recordStatus = RecordStatus.IDLE_AUTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void recordStart() {
|
private static void recordStart() {
|
||||||
if(recordStatus.isTracing())
|
if (recordStatus.isTracing()) return;
|
||||||
return;
|
|
||||||
|
|
||||||
recorder = new Recorder();
|
recorder = new Recorder();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void recordStop() {
|
private static void recordStop() {
|
||||||
if(!recordStatus.isTracing())
|
if (!recordStatus.isTracing()) return;
|
||||||
return;
|
|
||||||
|
|
||||||
recorder.stopRecording();
|
recorder.stopRecording();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,10 +78,12 @@ public class RecordStateMachine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int size() {
|
public static int size() {
|
||||||
|
if (recorder == null) return 0;
|
||||||
return recorder.size();
|
return recorder.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getStartTime() {
|
public static long getStartTime() {
|
||||||
|
if (recorder == null) return 0;
|
||||||
return recorder.getStartTime();
|
return recorder.getStartTime();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class StoredRecords {
|
public class StoredRecords {
|
||||||
|
|
||||||
private static final List<Record> records = new ArrayList<>();
|
private static final List<Record> records = new ArrayList<>();
|
||||||
|
|
||||||
public static void add(Record record) {
|
public static void add(Record record) {
|
||||||
@ -37,4 +38,5 @@ public class StoredRecords {
|
|||||||
records.clear();
|
records.clear();
|
||||||
TraceShowManager.clear();
|
TraceShowManager.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren