SteamWar/BauSystem2.0
Archiviert
12
0

Commits vergleichen

...

2 Commits

Autor SHA1 Nachricht Datum
D4rkr34lm
7a9a2283a9 Merge remote-tracking branch 'origin/TracerGUI' into TracerGUI
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
2024-04-17 21:50:04 +02:00
D4rkr34lm
d5d8c52862 Fixed Ignite Flag
Fixed Formating

Signed-off-by: D4rkr34lm <darth.m.frohn@gmail.com>
2024-04-17 21:49:47 +02:00
8 geänderte Dateien mit 38 neuen und 31 gelöschten Zeilen

Datei anzeigen

@ -179,8 +179,13 @@ public class TNTPoint implements Externalizable {
@Override
public String toString() {
return "TNTRecord{" +
"explosion=" + explosion +
return "TNTPoint{" +
"tntId=" + tntId +
", explosion=" + explosion +
", inWater=" + inWater +
", afterFirstExplosion=" + afterFirstExplosion +
", destroyedBuildArea=" + destroyedBuildArea +
", destroyedTestBlock=" + destroyedTestBlock +
", ticksSinceStart=" + ticksSinceStart +
", fuse=" + fuse +
", location=" + location +

Datei anzeigen

@ -279,8 +279,6 @@ public class Trace {
records.add((TNTPoint) inputStream.readObject());
}
System.out.println("Loaded... " + records);
Map<Integer, List<TNTPoint>> histories = new HashMap<>();
for (TNTPoint record : records) {
int tntId = record.getTntId();

Datei anzeigen

@ -68,24 +68,24 @@ public class TraceCommand extends SWCommand {
@Register(value = "show", description = "TRACE_COMMAND_HELP_SHOW")
public void show(@Validator Player player, @OptionalValue("STRICT") BundleFilter bundleFilter, ViewFlag... flags) {
showInternal(player, 0, Integer.MAX_VALUE, bundleFilter, flags);
showInternal(player, bundleFilter, flags);
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW", player);
}
@Register(value = { "show", "at" }, description = "TRACE_COMMAND_HELP_SHOW_AT_WITH")
@Register(value = {"show", "at"}, description = "TRACE_COMMAND_HELP_SHOW_AT_WITH")
public void showAt(@Validator Player player, @Min(intValue = 0) int time, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) {
showInternal(player, time, time, bundleFilter, flags);
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_AT", player, time);
}
@Register(value = { "show", "from" }, description = "TRACE_COMMAND_HELP_SHOW_FROM_WITH")
@Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM_WITH")
public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("with") String with,
@OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) {
@OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) {
showInternal(player, from, Integer.MAX_VALUE, bundleFilter, flags);
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM", player, from);
}
@Register(value = { "show", "from" }, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO_WITH")
@Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO_WITH")
public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("to") String toString, int to, @StaticValue("with") String with, @OptionalValue("STRICT") BundleFilter bundleFilter, @ArrayLength(min = 1) ViewFlag... flags) {
if (to < from) {
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_TO_SMALLER", player);
@ -95,30 +95,36 @@ public class TraceCommand extends SWCommand {
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM_TO", player, from, to);
}
private void showInternal(Player player, int from, int to, BundleFilter bundleFilter, ViewFlag... flags) {
PlayerTraceShowData playerTraceShowData = new PlayerTraceShowData(bundleFilter, flags);
playerTraceShowData.addViewFlag(new AtFlag(from, to));
TraceManager.instance.show(player, playerTraceShowData);
}
@Register(value = { "show", "at" }, description = "TRACE_COMMAND_HELP_SHOW_AT")
@Register(value = {"show", "at"}, description = "TRACE_COMMAND_HELP_SHOW_AT")
public void showAt(@Validator Player player, @Min(intValue = 0) int time) {
TraceManager.instance.renderAt(player, time, time);
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_AT", player, time);
}
@Register(value = { "show", "from" }, description = "TRACE_COMMAND_HELP_SHOW_FROM")
@Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM")
public void showFrom(@Validator Player player, @Min(intValue = 0) int from) {
TraceManager.instance.renderAt(player, from, Integer.MAX_VALUE);
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM", player, from);
}
@Register(value = { "show", "from" }, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO")
@Register(value = {"show", "from"}, description = "TRACE_COMMAND_HELP_SHOW_FROM_TO")
public void showFromTo(@Validator Player player, @Min(intValue = 0) int from, @StaticValue("to") String toString, int to) {
TraceManager.instance.renderAt(player, from, to);
BauSystem.MESSAGE.send("TRACE_MESSAGE_SHOW_FROM_TO", player, from, to);
}
private void showInternal(Player player, BundleFilter bundleFilter, ViewFlag... flags) {
PlayerTraceShowData playerTraceShowData = new PlayerTraceShowData(bundleFilter, flags);
TraceManager.instance.show(player, playerTraceShowData);
}
private void showInternal(Player player, int from, int to, BundleFilter bundleFilter, ViewFlag... flags) {
PlayerTraceShowData playerTraceShowData = new PlayerTraceShowData(bundleFilter, flags);
playerTraceShowData.addViewFlag(new AtFlag(from, to));
TraceManager.instance.show(player, playerTraceShowData);
}
@Register(value = "hide", description = "TRACE_COMMAND_HELP_HIDE")
public void hide(@Validator Player player) {
TraceManager.instance.hide(player);

Datei anzeigen

@ -202,8 +202,7 @@ public class TraceManager implements Listener {
unfollow(player);
Region region = Region.getRegion(player.getLocation());
PlayerTraceShowData previous = showDataPerRegionPerPlayer.getOrDefault(region, Collections.emptyMap())
.remove(player);
PlayerTraceShowData previous = showDataPerRegionPerPlayer.getOrDefault(region, Collections.emptyMap()).remove(player);
if (previous == null) return;
tracesByRegion.getOrDefault(player, Collections.emptyMap()).forEach((integer, trace) -> {
trace.hide(player);
@ -221,9 +220,7 @@ public class TraceManager implements Listener {
showDataPerRegionPerPlayer.forEach((region, playerPlayerTraceShowDataMap) -> {
if (playerPlayerTraceShowDataMap.containsKey(follower)) {
tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> {
trace.hide(follower);
});
tracesByRegion.getOrDefault(region, Collections.emptyMap()).forEach((integer, trace) -> trace.hide(follower));
}
PlayerTraceShowData playerTraceShowData = playerPlayerTraceShowDataMap.get(following);

Datei anzeigen

@ -168,8 +168,7 @@ public class TraceRecorder implements Listener {
}
boolean afterFirstExplosion = wrappedTrace.isExplosionRecorded();
TNTPoint record = new TNTPoint(tntID, tntPrimed, isExplosion, afterFirstExplosion,
TPSUtils.currentTick.get() - wrappedTrace.getStartTick(), history, destroyedBlocks);
TNTPoint record = new TNTPoint(tntID, tntPrimed, isExplosion, afterFirstExplosion, TPSUtils.currentTick.get() - wrappedTrace.getStartTick(), history, destroyedBlocks);
history.add(record);
return record;
@ -199,8 +198,7 @@ public class TraceRecorder implements Listener {
trackedTNT.get(region).add((TNTPrimed) event.getEntity());
tntSpawnRegion.put((TNTPrimed) event.getEntity(), region);
activeTraces.get(region).addRecord(
record((TNTPrimed) event.getEntity(), activeTraces.get(region), Collections.emptyList()));
activeTraces.get(region).addRecord(record((TNTPrimed) event.getEntity(), activeTraces.get(region), Collections.emptyList()));
}
}
@ -219,7 +217,6 @@ public class TraceRecorder implements Listener {
trackedTNT.get(region).remove((TNTPrimed) event.getEntity());
tntSpawnRegion.remove((TNTPrimed) event.getEntity());
activeTraces.get(region)
.addRecord(record((TNTPrimed) event.getEntity(), activeTraces.get(region), event.blockList()));
activeTraces.get(region).addRecord(record((TNTPrimed) event.getEntity(), activeTraces.get(region), event.blockList()));
}
}

Datei anzeigen

@ -38,7 +38,7 @@ public class TraceRecordingWrapper {
private final long startTick;
private final List<TNTPoint> recordsToAdd;
private final List<TNTPoint> recordList;
private ObjectOutputStream recordsOutputStream;
private final ObjectOutputStream recordsOutputStream;
private int nextOpenRecordId = 0;
@Getter
private boolean explosionRecorded = false;

Datei anzeigen

@ -30,7 +30,7 @@ public class PlayerTraceShowData {
@Setter
private BundleFilter bundleFilter;
private Map<Class<? extends ViewFlag>, ViewFlag> viewFlags = new HashMap<>();
private final Map<Class<? extends ViewFlag>, ViewFlag> viewFlags = new HashMap<>();
public PlayerTraceShowData(BundleFilter bundleFilter, ViewFlag... viewFlags) {
this.bundleFilter = bundleFilter;
@ -49,6 +49,8 @@ public class PlayerTraceShowData {
}
}
System.out.println(flagList);
// Manage inverse flags
ViewFlag.inverseFlags.forEach(viewFlag -> {
if (!flagList.remove(viewFlag)) {
@ -56,6 +58,8 @@ public class PlayerTraceShowData {
}
});
System.out.println(flagList);
return flagList;
}

Datei anzeigen

@ -56,7 +56,7 @@ public abstract class ViewFlag {
@Override
public List<TNTPoint> filter(List<TNTPoint> records) {
return records.stream()
.filter(record -> !record.isAfterFirstExplosion())
.filter(record -> record.isAfterFirstExplosion())
.collect(Collectors.toList());
}
};