SteamWar/BauSystem2.0
Archiviert
12
0

Fix some stuff
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2024-04-18 15:52:30 +02:00
Ursprung 7a9a2283a9
Commit 356b14d49c
2 geänderte Dateien mit 18 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -84,13 +84,28 @@ public class TraceManager implements Listener {
* @return id of the created trace * @return id of the created trace
*/ */
protected int add(Trace trace) { protected int add(Trace trace) {
showDataPerRegionPerPlayer.getOrDefault(trace.getRegion(), Collections.emptyMap()).forEach(trace::render); showDataPerRegionPerPlayer.getOrDefault(trace.getRegion(), Collections.emptyMap()).forEach((player, playerTraceShowData) -> {
trace.render(player, playerTraceShowData);
followerMap.getOrDefault(player, Collections.emptySet()).forEach(follower -> {
trace.render(follower, playerTraceShowData);
});
});
traces.put(nextOpenId, trace); traces.put(nextOpenId, trace);
tracesByRegion.computeIfAbsent(trace.getRegion(), region -> new HashMap<>()).put(nextOpenId, trace); tracesByRegion.computeIfAbsent(trace.getRegion(), region -> new HashMap<>()).put(nextOpenId, trace);
nextOpenId++; nextOpenId++;
return nextOpenId; return nextOpenId;
} }
protected void showPartial(Trace trace, List<TNTPoint> recordsToAdd) {
showDataPerRegionPerPlayer.getOrDefault(trace.getRegion(), Collections.emptyMap()).forEach((player, playerTraceShowData) -> {
trace.render(recordsToAdd, player, playerTraceShowData);
followerMap.getOrDefault(player, Collections.emptySet()).forEach(follower -> {
trace.render(recordsToAdd, follower, playerTraceShowData);
});
});
}
protected Map<Player, PlayerTraceShowData> getTraceShowDataPlayerMapping(Region region) { protected Map<Player, PlayerTraceShowData> getTraceShowDataPlayerMapping(Region region) {
return showDataPerRegionPerPlayer.getOrDefault(region, new HashMap<>()); return showDataPerRegionPerPlayer.getOrDefault(region, new HashMap<>());
} }
@ -106,8 +121,7 @@ public class TraceManager implements Listener {
.map(Map.Entry::getKey) .map(Map.Entry::getKey)
.findFirst() .findFirst()
.orElse(null); .orElse(null);
if (traceId == null) if (traceId == null) return false;
return false;
traces.remove(traceId); traces.remove(traceId);
tracesByRegion.getOrDefault(trace.getRegion(), Collections.emptyMap()).remove(traceId); tracesByRegion.getOrDefault(trace.getRegion(), Collections.emptyMap()).remove(traceId);
trace.hide(); trace.hide();

Datei anzeigen

@ -72,7 +72,7 @@ public class TraceRecordingWrapper {
} }
public void commitRecorded() { public void commitRecorded() {
TraceManager.instance.getTraceShowDataPlayerMapping(region).forEach((key, value) -> trace.render(recordsToAdd, key, value)); TraceManager.instance.showPartial(trace, recordsToAdd);
recordsToAdd.forEach(record -> { recordsToAdd.forEach(record -> {
try { try {