Trace Refactor #233
@ -131,14 +131,13 @@ public class TraceCommand extends SWCommand {
|
||||
BauSystem.MESSAGE.send("TRACE_MESSAGE_HIDE", player);
|
||||
}
|
||||
|
||||
@Register(value = "delete", description = "TRACE_COMMAND_HELP_DELETE")
|
||||
@Register(value = "clear")
|
||||
public void delete(@Validator Player player) {
|
||||
TraceManager.instance.clear();
|
||||
BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE", player);
|
||||
public void clear(@Validator Player player) {
|
||||
TraceManager.instance.clear(Region.getRegion(player.getLocation()));
|
||||
BauSystem.MESSAGE.send("TRACE_MESSAGE_CLEAR", player);
|
||||
}
|
||||
|
||||
@Register(value = "delete")
|
||||
@Register(value = "delete", description = "TRACE_MESSAGE_DELETE")
|
||||
public void delete(@Validator Player player, Trace trace) {
|
||||
TraceManager.instance.remove(trace);
|
||||
BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE_SPECIFIC", player);
|
||||
|
@ -131,11 +131,9 @@ public class TraceManager implements Listener {
|
||||
/**
|
||||
* Clears all traces
|
||||
*/
|
||||
public void clear() {
|
||||
showDataPerRegionPerPlayer.values()
|
||||
.stream()
|
||||
.flatMap(map -> map.entrySet().stream())
|
||||
.map(Map.Entry::getKey)
|
||||
public void clear(Region region) {
|
||||
showDataPerRegionPerPlayer.getOrDefault(region, new HashMap<>())
|
||||
.keySet()
|
||||
.forEach(player -> {
|
||||
Set<Player> players = followerMap.getOrDefault(player, Collections.emptySet());
|
||||
traces.values().forEach(trace -> {
|
||||
@ -143,13 +141,14 @@ public class TraceManager implements Listener {
|
||||
players.forEach(trace::hide);
|
||||
});
|
||||
});
|
||||
traces.forEach((i, trace) -> {
|
||||
tracesByRegion.getOrDefault(region, new HashMap<>())
|
||||
.forEach((i, trace) -> {
|
||||
if (trace.getRegion() != region) return;
|
||||
traces.remove(i);
|
||||
trace.getMetadataSaveFile().delete();
|
||||
trace.getRecordsSaveFile().delete();
|
||||
});
|
||||
traces.clear();
|
||||
tracesByRegion.clear();
|
||||
nextOpenId = 0;
|
||||
tracesByRegion.getOrDefault(region, new HashMap<>()).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren