use of com.bergerkiller.bukkit.common.map.binding.MapDisplayInfo in project BKCommonLib by bergerhealer.
the class CommonMapController method cleanupUnusedUUIDs.
protected synchronized void cleanupUnusedUUIDs(Set<MapUUID> existingMapUUIDs) {
HashSet<MapUUID> idsToRemove = new HashSet<MapUUID>(mapIdByUUID.keySet());
idsToRemove.removeAll(existingMapUUIDs);
for (MapUUID toRemove : idsToRemove) {
// Clean up the map display information first
MapDisplayInfo displayInfo = maps.get(toRemove.getUUID());
if (displayInfo != null) {
if (displayInfo.getSessions().isEmpty()) {
MapDisplayInfo removed = maps.remove(toRemove.getUUID());
if (removed != null) {
mapsValues.remove(removed);
removed.onRemoved();
}
} else {
// still has an active session; cannot remove
continue;
}
}
// Clean up from bi-directional mapping
Integer mapId = mapIdByUUID.remove(toRemove);
if (mapId != null) {
mapUUIDById.remove(mapId.intValue());
}
// Clean up from 'dirty' set (probably never needed)
dirtyMapUUIDSet.removeAll(toRemove.getUUID());
}
}
Aggregations