SteamWar/BauSystem2.0
Archiviert
12
0

Trace Refactor #233

Zusammengeführt
YoyoNow hat 121 Commits von TracerGUI nach master 2024-04-21 16:03:26 +02:00 zusammengeführt
2 geänderte Dateien mit 18 neuen und 4 gelöschten Zeilen
Nur Änderungen aus Commit 356b14d49c werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -84,13 +84,28 @@ public class TraceManager implements Listener {
* @return id of the created 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);
tracesByRegion.computeIfAbsent(trace.getRegion(), region -> new HashMap<>()).put(nextOpenId, trace);
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) {
return showDataPerRegionPerPlayer.getOrDefault(region, new HashMap<>());
}
@ -106,8 +121,7 @@ public class TraceManager implements Listener {
.map(Map.Entry::getKey)
.findFirst()
.orElse(null);
if (traceId == null)
return false;
if (traceId == null) return false;
traces.remove(traceId);
tracesByRegion.getOrDefault(trace.getRegion(), Collections.emptyMap()).remove(traceId);
trace.hide();

Datei anzeigen

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