Dieser Commit ist enthalten in:
Ursprung
c4296a3781
Commit
39d2205b85
@ -237,6 +237,13 @@ public class Trace { // TODO: Add UUID for file saving and so on!
|
||||
entityServer.close();
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
entityServerMap.forEach((player, entityServer) -> {
|
||||
entityServer.close();
|
||||
});
|
||||
entityServerMap.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Trace{" +
|
||||
|
@ -139,7 +139,7 @@ public class TraceCommand extends SWCommand {
|
||||
|
||||
@Register(value = "delete")
|
||||
public void delete(@Validator Player player, Trace trace) {
|
||||
// TODO: Reimplement manager.remove(trace);
|
||||
manager.remove(trace);
|
||||
BauSystem.MESSAGE.send("TRACE_MESSAGE_DELETE_SPECIFIC", player);
|
||||
}
|
||||
|
||||
|
@ -86,17 +86,18 @@ public class TraceManager implements Listener {
|
||||
/**
|
||||
* Removes the trace with the given id
|
||||
*
|
||||
* @param id id of the trace to be removed
|
||||
* @param trace the trace to be removed
|
||||
*/
|
||||
public boolean remove(int id) {
|
||||
if (id >= nextOpenId) return false;
|
||||
if (traces.get(id) == null) return false;
|
||||
Trace trace = traces.remove(id);
|
||||
showDataPerRegionPerPlayer.get(trace.getRegion()).forEach((player, playerTraceShowData) -> {
|
||||
trace.hide(player);
|
||||
followerMap.getOrDefault(player, Collections.emptySet()).forEach(trace::hide);
|
||||
});
|
||||
tracesByRegion.get(trace.getRegion()).remove(id);
|
||||
public boolean remove(Trace trace) {
|
||||
Integer traceId = traces.entrySet().stream()
|
||||
.filter(entry -> entry.getValue() == trace)
|
||||
.map(Map.Entry::getKey)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (traceId == null) return false;
|
||||
traces.remove(traceId);
|
||||
tracesByRegion.getOrDefault(trace.getRegion(), Collections.emptyMap()).remove(traceId);
|
||||
trace.hide();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren