Fixes loading and setting of spawn island.

https://github.com/BentoBoxWorld/BentoBox/issues/523

When loading islands the spawn setting was not being checked so spawn
islands were not added to the spawn island map.
This commit is contained in:
tastybento 2019-02-10 22:00:50 -08:00
parent ce0b9569ca
commit 564f60bab3

View File

@ -680,7 +680,6 @@ public class IslandsManager {
oldSpawn.setSpawn(false);
}
}
this.spawn.put(spawn.getWorld(), spawn);
spawn.setSpawn(true);
}
@ -702,17 +701,19 @@ public class IslandsManager {
// Only load non-quarantined island
// TODO: write a purge admin command to delete these records
handler.loadObjects().stream().filter(i -> !i.isDoNotLoad()).forEach(island -> {
if (!islandCache.addIsland(island)) {
// Quarantine the offending island
toQuarantine.add(island);
}
if (!islandCache.addIsland(island)) {
// Quarantine the offending island
toQuarantine.add(island);
} else if (island.isSpawn()) {
this.setSpawn(island);
}
});
if (!toQuarantine.isEmpty()) {
plugin.logError(toQuarantine.size() + " islands could not be loaded successfully; quarantining.");
toQuarantine.forEach(i -> {
i.setDoNotLoad(true);
handler.saveObject(i);
});
});
}
}