SteamWar/BauSystem2.0
Archiviert
12
0

Simplify tracer
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2023-09-23 15:45:42 +02:00
Ursprung 33e070bc43
Commit c08bb9d702
7 geänderte Dateien mit 14 neuen und 25 gelöschten Zeilen

Datei anzeigen

@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.tracer;
import de.steamwar.bausystem.features.tracer.show.Record; import de.steamwar.bausystem.features.tracer.show.Record;
import de.steamwar.bausystem.shared.Position; import de.steamwar.bausystem.shared.Position;
import lombok.Getter; import lombok.Getter;
import lombok.Setter;
import org.bukkit.entity.TNTPrimed; import org.bukkit.entity.TNTPrimed;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;

Datei anzeigen

@ -52,7 +52,7 @@ public abstract class AutoTraceRecorder implements TraceRecorder {
private Record lastRecord; private Record lastRecord;
private Record.TNTRecord getRecord(TNTPrimed tntPrimed) { private Record.TNTRecord getRecord(TNTPrimed tntPrimed) {
return recordMap.computeIfAbsent(tntPrimed, __ -> record.spawn(TPSUtils.currentRealTick.get() - startTime)); return recordMap.computeIfAbsent(tntPrimed, __ -> record.spawn());
} }
protected abstract String getInactivityMessage(); protected abstract String getInactivityMessage();

Datei anzeigen

@ -52,7 +52,7 @@ public class SimpleTraceRecorder implements TraceRecorder, ActiveTracer {
} }
private Record.TNTRecord getRecord(TNTPrimed tntPrimed) { private Record.TNTRecord getRecord(TNTPrimed tntPrimed) {
return recordMap.computeIfAbsent(tntPrimed, __ -> record.spawn(TPSUtils.currentRealTick.get() - startTime)); return recordMap.computeIfAbsent(tntPrimed, __ -> record.spawn());
} }
@Override @Override

Datei anzeigen

@ -205,12 +205,10 @@ public class EntityShowMode implements ShowMode<TNTPosition> {
entity = createEntity(position, positionType); entity = createEntity(position, positionType);
} }
count++; count++;
if (showModeParameter.isTicks()) { if (showModeParameter.isFuse()) {
entity.setDisplayName(fuseTicks + ""); entity.setDisplayName(fuseTicks + "");
} else if (showModeParameter.isCount()) { } else if (showModeParameter.isCount()) {
entity.setDisplayName(new HashSet<>(records).size() + ""); entity.setDisplayName(new HashSet<>(records).size() + "");
} else if (showModeParameter.isTicksSinceStart()) {
entity.setDisplayName((80 - fuseTicks) + tntPosition.getRecord().getOffset() + "");
} }
} }

Datei anzeigen

@ -47,8 +47,8 @@ public class Record {
tnt.forEach(tntRecord -> tntRecord.getPositions().forEach(traceShowMode::show)); tnt.forEach(tntRecord -> tntRecord.getPositions().forEach(traceShowMode::show));
} }
public TNTRecord spawn(long offset) { public TNTRecord spawn() {
TNTRecord record = new TNTRecord(this, offset, region); TNTRecord record = new TNTRecord(this, region);
tnt.add(record); tnt.add(record);
return record; return record;
} }
@ -80,9 +80,6 @@ public class Record {
private Record record; private Record record;
@Getter
private final long offset;
@Getter @Getter
private final Region region; private final Region region;
@ -100,9 +97,8 @@ public class Record {
@Getter @Getter
private boolean hasMicroMotion = false; private boolean hasMicroMotion = false;
public TNTRecord(Record record, long offset, Region region) { public TNTRecord(Record record, Region region) {
this.record = record; this.record = record;
this.offset = offset;
this.region = region; this.region = region;
} }

Datei anzeigen

@ -28,11 +28,10 @@ public class ShowModeParameter {
private boolean interpolateXZ = false; private boolean interpolateXZ = false;
private boolean sourceOnly = false; private boolean sourceOnly = false;
private boolean explodeOnly = false; private boolean explodeOnly = false;
private boolean ticks = false; private boolean fuse = false;
private boolean count = false; private boolean count = false;
private boolean buildDestroyOnly = false; private boolean buildDestroyOnly = false;
private boolean testblockDestroyOnly = false; private boolean testblockDestroyOnly = false;
private boolean ticksSinceStart = false;
private boolean microMotion = false; private boolean microMotion = false;
public void enableWater() { public void enableWater() {
@ -55,8 +54,8 @@ public class ShowModeParameter {
this.explodeOnly = true; this.explodeOnly = true;
} }
public void enableTicks() { public void enableFuse() {
this.ticks = true; this.fuse = true;
} }
public void enableCount() { public void enableCount() {
@ -71,10 +70,6 @@ public class ShowModeParameter {
this.testblockDestroyOnly = true; this.testblockDestroyOnly = true;
} }
public void enableTicksSinceStart() {
this.ticksSinceStart = true;
}
public void enableMicroMotion() { public void enableMicroMotion() {
this.microMotion = true; this.microMotion = true;
} }

Datei anzeigen

@ -36,13 +36,12 @@ public enum ShowModeParameterType {
showModeParameter.enableInterpolateY(); showModeParameter.enableInterpolateY();
showModeParameter.enableInterpolateXZ(); showModeParameter.enableInterpolateXZ();
}, Arrays.asList("-advanced", "-a"), "INTERPOLATE_Y", "INTERPOLATE_XZ"), }, Arrays.asList("-advanced", "-a"), "INTERPOLATE_Y", "INTERPOLATE_XZ"),
SOURCE(ShowModeParameter::enableSourceOnly, Arrays.asList("-source", "-sourceonly", "-ignite"), "TICKS", "ADVANCED", "INTERPOLATE_Y", "INTERPOLATE_XZ", "WATER"), SOURCE(ShowModeParameter::enableSourceOnly, Arrays.asList("-source", "-sourceonly", "-ignite"), "FUSE", "ADVANCED", "INTERPOLATE_Y", "INTERPOLATE_XZ", "WATER"),
EXPLODE(ShowModeParameter::enableExplodeOnly, Arrays.asList("-explode", "-explodeonly"), "TICKS", "ADVANCED", "INTERPOLATE_Y", "INTERPOLATE_XZ", "WATER"), EXPLODE(ShowModeParameter::enableExplodeOnly, Arrays.asList("-explode", "-explodeonly"), "FUSE", "ADVANCED", "INTERPOLATE_Y", "INTERPOLATE_XZ", "WATER"),
TICKS(ShowModeParameter::enableTicks, Arrays.asList("-ticks", "-t"), "EXPLODE", "SOURCE", "COUNT", "TICKS_SINCE_START"), FUSE(ShowModeParameter::enableFuse, Arrays.asList("-fuse", "-f"), "EXPLODE", "SOURCE", "COUNT"),
COUNT(ShowModeParameter::enableCount, Arrays.asList("-count", "-c"), "TICKS", "TICKS_SINCE_START"), COUNT(ShowModeParameter::enableCount, Arrays.asList("-count", "-c"), "FUSE"),
BUILD_DESTROY_ONLY(ShowModeParameter::enableBuildDestroyOnly, Arrays.asList("-builddestroy", "-builddestoryonly"), "WATER", "TESTBLOCK_DESTROY_ONLY"), BUILD_DESTROY_ONLY(ShowModeParameter::enableBuildDestroyOnly, Arrays.asList("-builddestroy", "-builddestoryonly"), "WATER", "TESTBLOCK_DESTROY_ONLY"),
TESTBLOCK_DESTROY_ONLY(ShowModeParameter::enableTestblockDestroyOnly, Arrays.asList("-testblockdestroy", "-testblockdestroyonly"), "WATER", "BUILD_DESTROY_ONLY"), TESTBLOCK_DESTROY_ONLY(ShowModeParameter::enableTestblockDestroyOnly, Arrays.asList("-testblockdestroy", "-testblockdestroyonly"), "WATER", "BUILD_DESTROY_ONLY"),
TICKS_SINCE_START(ShowModeParameter::enableTicksSinceStart, Arrays.asList("-tickssincestart", "-tss"), "TICKS", "COUNT"),
MICROMOTION(ShowModeParameter::enableMicroMotion, Arrays.asList("-micromotion", "-micro", "-m")), MICROMOTION(ShowModeParameter::enableMicroMotion, Arrays.asList("-micromotion", "-micro", "-m")),
; ;