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.shared.Position;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.util.Vector;

Datei anzeigen

@ -52,7 +52,7 @@ public abstract class AutoTraceRecorder implements TraceRecorder {
private Record lastRecord;
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();

Datei anzeigen

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

Datei anzeigen

@ -205,12 +205,10 @@ public class EntityShowMode implements ShowMode<TNTPosition> {
entity = createEntity(position, positionType);
}
count++;
if (showModeParameter.isTicks()) {
if (showModeParameter.isFuse()) {
entity.setDisplayName(fuseTicks + "");
} else if (showModeParameter.isCount()) {
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));
}
public TNTRecord spawn(long offset) {
TNTRecord record = new TNTRecord(this, offset, region);
public TNTRecord spawn() {
TNTRecord record = new TNTRecord(this, region);
tnt.add(record);
return record;
}
@ -80,9 +80,6 @@ public class Record {
private Record record;
@Getter
private final long offset;
@Getter
private final Region region;
@ -100,9 +97,8 @@ public class Record {
@Getter
private boolean hasMicroMotion = false;
public TNTRecord(Record record, long offset, Region region) {
public TNTRecord(Record record, Region region) {
this.record = record;
this.offset = offset;
this.region = region;
}

Datei anzeigen

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

Datei anzeigen

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