Dieser Commit ist enthalten in:
Ursprung
2ed6008aea
Commit
f1b3b27c14
@ -132,6 +132,11 @@ 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)
|
||||||
@ -148,6 +153,7 @@ 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 -> {
|
||||||
|
@ -185,6 +185,22 @@ public class TraceRecorder implements Listener {
|
|||||||
return activeTraces.containsKey(region);
|
return activeTraces.containsKey(region);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the trace that is currently recorded in the given region
|
||||||
|
*
|
||||||
|
* @param region the region to get the trace for
|
||||||
|
* @return the trace recorded in region or empty if no trace is recorded in region
|
||||||
|
*/
|
||||||
|
public Optional<Trace> getActiveTraceForRegion(Region region) {
|
||||||
|
TraceRecordingWrapper traceWrapper = activeTraces.get(region);
|
||||||
|
|
||||||
|
if (traceWrapper == null) {
|
||||||
|
return Optional.empty();
|
||||||
|
} else {
|
||||||
|
return Optional.of(traceWrapper.getTrace());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public long getStartTimeOfTraceInRegion(Region region) {
|
public long getStartTimeOfTraceInRegion(Region region) {
|
||||||
TraceRecordingWrapper wrapper = activeTraces.get(region);
|
TraceRecordingWrapper wrapper = activeTraces.get(region);
|
||||||
if (wrapper == null) return 0;
|
if (wrapper == null) return 0;
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren