diff --git a/src/main/java/me/byteful/plugin/leveltools/api/block/impl/FileBlockDataManager.java b/src/main/java/me/byteful/plugin/leveltools/api/block/impl/FileBlockDataManager.java index 43e71c0..fd4cf42 100644 --- a/src/main/java/me/byteful/plugin/leveltools/api/block/impl/FileBlockDataManager.java +++ b/src/main/java/me/byteful/plugin/leveltools/api/block/impl/FileBlockDataManager.java @@ -24,7 +24,12 @@ public FileBlockDataManager(Path file, Scheduler scheduler) { } private void save() { - final Set lines = cache.stream().map(x -> String.format("{%s}{%s}{%s}%s", x.getX(), x.getY(), x.getZ(), x.getWorld())).collect(Collectors.toSet()); + final Set lines; + synchronized (cache) { + lines = cache.stream() + .map(x -> String.format("{%s}{%s}{%s}%s", x.getX(), x.getY(), x.getZ(), x.getWorld())) + .collect(Collectors.toSet()); + } try { Files.write(file, lines, StandardCharsets.UTF_8);