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
4 geänderte Dateien mit 35 neuen und 34 gelöschten Zeilen
Nur Änderungen aus Commit 6b23f88ea0 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -31,10 +31,12 @@ import java.lang.reflect.Field;
class TraceEntity_12 extends EntityFallingBlock implements AbstractTraceEntity {
private Vector position;
private boolean tnt;
public TraceEntity_12(World world, Vector position, Player player, boolean exploded, boolean tnt) {
super(((CraftWorld) world).getHandle(), position.getX(), position.getY(), position.getZ(), tnt ? Blocks.TNT.getBlockData() : Blocks.STAINED_GLASS.getBlockData());
this.position = position;
this.tnt = tnt;
this.setNoGravity(true);
this.ticksLived = -12000;
@ -64,8 +66,10 @@ class TraceEntity_12 extends EntityFallingBlock implements AbstractTraceEntity {
PacketPlayOutEntityTeleport packetPlayOutEntityTeleport = new PacketPlayOutEntityTeleport(this);
playerConnection.sendPacket(packetPlayOutEntityTeleport);
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true);
playerConnection.sendPacket(packetPlayOutEntityMetadata);
if (tnt) {
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true);
playerConnection.sendPacket(packetPlayOutEntityMetadata);
}
return this;
}

Datei anzeigen

@ -54,8 +54,10 @@ class TraceEntity_15 extends EntityFallingBlock implements AbstractTraceEntity {
PlayerConnection playerConnection = ((CraftPlayer) player).getHandle().playerConnection;
playerConnection.sendPacket(packetPlayOutSpawnEntity);
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true);
playerConnection.sendPacket(packetPlayOutEntityMetadata);
if (tnt) {
PacketPlayOutEntityMetadata packetPlayOutEntityMetadata = new PacketPlayOutEntityMetadata(getId(), datawatcher, true);
playerConnection.sendPacket(packetPlayOutEntityMetadata);
}
return this;
}

Datei anzeigen

@ -22,8 +22,6 @@ package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.Permission;
import de.steamwar.bausystem.tracer.record.RecordStateMachine;
import de.steamwar.bausystem.tracer.record.RecordStatus;
import de.steamwar.bausystem.tracer.show.ShowMode;
import de.steamwar.bausystem.tracer.show.StoredRecords;
import de.steamwar.bausystem.tracer.show.TraceShowManager;
import de.steamwar.bausystem.tracer.show.mode.Advanced;
@ -73,29 +71,16 @@ public class CommandTrace implements CommandExecutor {
switch (args[0].toLowerCase()) {
case "start":
RecordStateMachine.commandStart();
player.sendMessage(BauSystem.PREFIX + "§aTNT-Tracer gestartet");
player.sendMessage(BauSystem.PREFIX + RecordStateMachine.getRecordStatus().getMessage());
break;
case "stop":
RecordStateMachine.commandStop();
player.sendMessage(BauSystem.PREFIX + "§cTNT-Tracer gestoppt");
player.sendMessage(BauSystem.PREFIX + RecordStateMachine.getRecordStatus().getMessage());
break;
case "toggleauto":
case "auto":
RecordStateMachine.commandAuto();
switch (RecordStateMachine.getRecordStatus()) {
case IDLE:
player.sendMessage(BauSystem.PREFIX + "§cAuto-Tracer gestoppt");
break;
case IDLE_AUTO:
player.sendMessage(BauSystem.PREFIX + "§aAuto-Tracer gestartet");
break;
case RECORD:
player.sendMessage(BauSystem.PREFIX + "§cTNT-Tracer muss gestoppt werden");
break;
case RECORD_AUTO:
player.sendMessage(BauSystem.PREFIX + "§cTNT-Tracer muss aus sein");
break;
}
player.sendMessage(BauSystem.PREFIX + RecordStateMachine.getRecordStatus().getAutoMessage());
break;
case "clear":
case "delete":
@ -103,31 +88,29 @@ public class CommandTrace implements CommandExecutor {
player.sendMessage(BauSystem.PREFIX + "§cAlle TNT-Positionen gelöscht");
break;
case "show":
ShowMode showMode;
if (args.length < 2) {
showMode = new Basic(player);
TraceShowManager.show(player, new Basic(player));
} else {
switch (args[1].toLowerCase()) {
case "nowater":
case "basic-nowater":
case "basicnowater":
showMode = new BasicNoWater(player);
TraceShowManager.show(player, new BasicNoWater(player));
break;
case "advanced":
showMode = new Advanced(player);
TraceShowManager.show(player, new Advanced(player));
break;
case "advanced-nowater":
case "advancednowater":
showMode = new AdvancedNoWater(player);
TraceShowManager.show(player, new AdvancedNoWater(player));
break;
case "basic":
case "default":
default:
showMode = new Basic(player);
TraceShowManager.show(player, new Basic(player));
break;
}
}
TraceShowManager.show(player, showMode);
player.sendMessage(BauSystem.PREFIX + "§aAlle TNT-Positionen angezeigt");
break;
case "hide":

Datei anzeigen

@ -21,17 +21,21 @@ package de.steamwar.bausystem.tracer.record;
public enum RecordStatus {
RECORD("§aan", true),
RECORD_AUTO("§aan", true),
IDLE("§caus", false),
IDLE_AUTO("§eauto", false);
RECORD("§aan", true, "§aTNT-Tracer gestartet", "§cTNT-Tracer muss gestoppt werden"),
RECORD_AUTO("§aan", true, "§cAuto-Tracer muss aus sein", "§cTNT-Tracer muss aus sein"),
IDLE("§caus", false, "§cTNT-Tracer gestoppt", "§cAuto-Tracer gestoppt"),
IDLE_AUTO("§eauto", false, "§cTNT-Tracer muss gestoppt werden", "§aAuto-Tracer gestartet");
String name;
boolean tracing;
String message;
String autoMessage;
RecordStatus(String value, boolean tracing) {
RecordStatus(String value, boolean tracing, String message, String autoMessage) {
this.name = value;
this.tracing = tracing;
this.message = message;
this.autoMessage = autoMessage;
}
public String getName() {
@ -42,4 +46,12 @@ public enum RecordStatus {
return tracing;
}
public String getMessage() {
return message;
}
public String getAutoMessage() {
return autoMessage;
}
}