Trace Refactor #233
@ -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();
|
||||
|
@ -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 {
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren