mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-22 02:35:21 +01:00
Merge pull request #2458 from BentoBoxWorld/2456_mysterious_exception
More code to clean up when an island is deleted. #2456
This commit is contained in:
commit
220fc72a21
@ -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