SteamWar/BauSystem
Archiviert
13
0

Tracer-entity #147

Manuell gemergt
YoyoNow hat 47 Commits von Tracer-entity nach master 2020-12-27 22:16:04 +01:00 zusammengeführt
8 geänderte Dateien mit 51 neuen und 45 gelöschten Zeilen
Nur Änderungen aus Commit de9c79240a werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -8,11 +8,8 @@ import org.bukkit.entity.Player;
public class TNTEntity_12 extends EntityFallingBlock implements AbstractTNTEntity {
private TNTPosition position;
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());
this.position = position;
this.setNoGravity(true);
this.ticksLived = -12000;
@ -35,6 +32,9 @@ public class TNTEntity_12 extends EntityFallingBlock implements AbstractTNTEntit
ReflectionUtils.setValue("h", packetPlayOutSpawnEntity, 0);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutSpawnEntity);
PacketPlayOutEntityTeleport packetPlayOutEntityTeleport = new PacketPlayOutEntityTeleport(this);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityTeleport);
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityMetadata);

Datei anzeigen

@ -8,11 +8,8 @@ import org.bukkit.entity.Player;
public class TNTEntity_15 extends EntityFallingBlock implements AbstractTNTEntity {
private TNTPosition position;
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());
this.position = position;
this.setNoGravity(true);
this.ticksLived = -12000;
@ -29,12 +26,17 @@ public class TNTEntity_15 extends EntityFallingBlock implements AbstractTNTEntit
@Override
public AbstractTNTEntity display(Player player) {
System.out.println("SHOW: " + player + " " + locX() + " " + locY() + " " + locZ());
PacketPlayOutSpawnEntity packetPlayOutSpawnEntity = new PacketPlayOutSpawnEntity(this);
ReflectionUtils.setValue("f", packetPlayOutSpawnEntity, 0);
ReflectionUtils.setValue("g", packetPlayOutSpawnEntity, 0);
ReflectionUtils.setValue("h", packetPlayOutSpawnEntity, 0);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutSpawnEntity);
PacketPlayOutEntityTeleport packetPlayOutEntityTeleport = new PacketPlayOutEntityTeleport(this);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityTeleport);
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packetPlayOutEntityMetadata);

Datei anzeigen

@ -23,6 +23,7 @@ import de.steamwar.bausystem.BauSystem;
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.world.Welt;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@ -83,8 +84,10 @@ public class CommandTrace implements CommandExecutor {
player.sendMessage(BauSystem.PREFIX + "§cAlle TNT-Positionen gelöscht");
break;
case "show":
TraceShowManager.show(player);
break;
case "hide":
TraceShowManager.hide(player);
break;
case "toggleshow":
case "interpolate":

Datei anzeigen

@ -20,7 +20,8 @@
package de.steamwar.bausystem.tracer.record;
public class RecordStateMachine {
private RecordStateMachine(){}
private RecordStateMachine() {
}
private static final TraceAutoHandler autoHandler = new TraceAutoHandler();
@ -28,15 +29,15 @@ public class RecordStateMachine {
private static Recorder recorder = null;
public static void commandStart() {
recordStatus = RecordStatus.RECORD;
autoHandler.disable();
recordStart();
recordStatus = RecordStatus.RECORD;
}
public static void commandStop() {
recordStatus = RecordStatus.IDLE;
autoHandler.disable();
recordStop();
recordStatus = RecordStatus.IDLE;
}
public static void commandAuto() {
@ -53,26 +54,22 @@ public class RecordStateMachine {
}
static void autoRecord() {
recordStatus = RecordStatus.RECORD_AUTO;
recordStart();
recordStatus = RecordStatus.RECORD_AUTO;
}
static void autoIdle() {
recordStatus = RecordStatus.IDLE_AUTO;
recordStop();
recordStatus = RecordStatus.IDLE_AUTO;
}
private static void recordStart() {
if(recordStatus.isTracing())
return;
if (recordStatus.isTracing()) return;
recorder = new Recorder();
}
private static void recordStop() {
if(!recordStatus.isTracing())
return;
if (!recordStatus.isTracing()) return;
recorder.stopRecording();
}
@ -81,10 +78,12 @@ public class RecordStateMachine {
}
public static int size() {
if (recorder == null) return 0;
return recorder.size();
}
public static long getStartTime() {
if (recorder == null) return 0;
return recorder.getStartTime();
}
}

Datei anzeigen

@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.List;
public class StoredRecords {
private static final List<Record> records = new ArrayList<>();
public static void add(Record record) {
@ -37,4 +38,5 @@ public class StoredRecords {
records.clear();
TraceShowManager.clear();
}
}