Should fix CHM error in asyncSaveAll

https://github.com/BentoBoxWorld/BentoBox/issues/982
This commit is contained in:
tastybento 2019-10-11 08:36:23 -07:00
parent e9e10eed75
commit 7d8539b4cd

View File

@ -985,14 +985,14 @@ public class IslandsManager {
public void asyncSaveAll() {
if (!toSave.isEmpty()) return;
// Get a list of ID's to save
toSave = islandCache.getAllIslandIds();
toSave = new HashSet<>(islandCache.getAllIslandIds());
it = toSave.iterator();
task = Bukkit.getScheduler().runTaskTimer(plugin, () -> {
if (plugin.isEnabled() && it.hasNext()) {
getIslandById(it.next()).ifPresent(this::save);
} else {
toSave.clear();
task.cancel();
toSave.clear();
task.cancel();
}
}, 0L, 1L);
}