mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-25 04:05:36 +01:00
More code to clean up when an island is deleted. #2456
This commit is contained in:
parent
0766f2967d
commit
c9c57e113f
@ -171,8 +171,15 @@ public class IslandCache {
|
||||
}
|
||||
|
||||
private void removeFromIslandsByUUID(Island island) {
|
||||
for (Set<String> set : islandsByUUID.values()) {
|
||||
Iterator<Map.Entry<UUID, Set<String>>> iterator = islandsByUUID.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<UUID, Set<String>> entry = iterator.next();
|
||||
Set<String> set = entry.getValue();
|
||||
set.removeIf(island.getUniqueId()::equals);
|
||||
if (set.isEmpty()) {
|
||||
// Removes the overall entry if there is nothing left in the set
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user