trace/trace-del-and-trace-share-fix #239
@ -132,11 +132,6 @@ public class TraceManager implements Listener {
|
|||||||
* @param trace the trace to be removed
|
* @param trace the trace to be removed
|
||||||
*/
|
*/
|
||||||
public boolean remove(Trace trace) {
|
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());
|
Map<Integer, Trace> traces = tracesByRegion.getOrDefault(trace.getRegion(), Collections.emptyMap());
|
||||||
Integer traceId = traces.entrySet().stream()
|
Integer traceId = traces.entrySet().stream()
|
||||||
.filter(entry -> entry.getValue() == trace)
|
.filter(entry -> entry.getValue() == trace)
|
||||||
@ -153,7 +148,6 @@ public class TraceManager implements Listener {
|
|||||||
* Clears all traces
|
* Clears all traces
|
||||||
*/
|
*/
|
||||||
public void clear(Region region) {
|
public void clear(Region region) {
|
||||||
TraceRecorder.instance.stopRecording(region);
|
|
||||||
showDataPerRegionPerPlayer.getOrDefault(region, new HashMap<>())
|
showDataPerRegionPerPlayer.getOrDefault(region, new HashMap<>())
|
||||||
.keySet()
|
.keySet()
|
||||||
.forEach(player -> {
|
.forEach(player -> {
|
||||||
|
@ -104,14 +104,11 @@ public class TraceRecorder implements Listener {
|
|||||||
*
|
*
|
||||||
* @param region region to be recorded
|
* @param region region to be recorded
|
||||||
*/
|
*/
|
||||||
public int startRecording(Region region) {
|
public void startRecording(Region region) {
|
||||||
if (activeTraces.containsKey(region)) {
|
if (activeTraces.containsKey(region)) return;
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
TraceRecordingWrapper wrappedTrace = new TraceRecordingWrapper(region);
|
TraceRecordingWrapper wrappedTrace = new TraceRecordingWrapper(region);
|
||||||
activeTraces.put(region, wrappedTrace);
|
activeTraces.put(region, wrappedTrace);
|
||||||
return TraceManager.instance.add(wrappedTrace.getTrace());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -89,9 +89,6 @@ public class TraceRecordingWrapper {
|
|||||||
protected void finalizeRecording() {
|
protected void finalizeRecording() {
|
||||||
recordsOutputStream.flush();
|
recordsOutputStream.flush();
|
||||||
recordsOutputStream.close();
|
recordsOutputStream.close();
|
||||||
|
TraceManager.instance.add(trace);
|
||||||
if (trace.getRecords().isEmpty()) {
|
|
||||||
TraceManager.instance.remove(trace);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren