SteamWar/BauSystem2.0
Archiviert
12
0

trace/trace-del-and-trace-share-fix #239

Zusammengeführt
YoyoNow hat 3 Commits von trace/trace-del-and-trace-share-fix nach master 2024-04-22 22:57:11 +02:00 zusammengeführt
3 geänderte Dateien mit 3 neuen und 15 gelöschten Zeilen
Nur Änderungen aus Commit e8eeeb729a werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -132,11 +132,6 @@ public class TraceManager implements Listener {
* @param trace the trace to be removed
*/
public boolean remove(Trace trace) {
Optional<Trace> activeTrace = TraceRecorder.instance.getActiveTraceForRegion(trace.getRegion());
if (activeTrace.isPresent() && activeTrace.get() == trace) {
TraceRecorder.instance.stopRecording(trace.getRegion());
}
Map<Integer, Trace> traces = tracesByRegion.getOrDefault(trace.getRegion(), Collections.emptyMap());
Integer traceId = traces.entrySet().stream()
.filter(entry -> entry.getValue() == trace)
@ -153,7 +148,6 @@ public class TraceManager implements Listener {
* Clears all traces
*/
public void clear(Region region) {
TraceRecorder.instance.stopRecording(region);
showDataPerRegionPerPlayer.getOrDefault(region, new HashMap<>())
.keySet()
.forEach(player -> {

Datei anzeigen

@ -104,14 +104,11 @@ public class TraceRecorder implements Listener {
*
* @param region region to be recorded
*/
public int startRecording(Region region) {
if (activeTraces.containsKey(region)) {
return -1;
}
public void startRecording(Region region) {
if (activeTraces.containsKey(region)) return;
TraceRecordingWrapper wrappedTrace = new TraceRecordingWrapper(region);
activeTraces.put(region, wrappedTrace);
return TraceManager.instance.add(wrappedTrace.getTrace());
}
/**

Datei anzeigen

@ -89,9 +89,6 @@ public class TraceRecordingWrapper {
protected void finalizeRecording() {
recordsOutputStream.flush();
recordsOutputStream.close();
if (trace.getRecords().isEmpty()) {
TraceManager.instance.remove(trace);
}
TraceManager.instance.add(trace);
}
}