From 7ba0fd3f5360a179d375cc315fa1f8c3e41d2ae7 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Sun, 11 Jun 2023 00:07:43 +0200 Subject: [PATCH] Synchronize YamlRegionFile#saveAll This prevents multiple invocations of the method from intersecting, which could potentially cause the .tmp file to be overwritten before being renamed, thus corrupting the region storage --- .../protection/managers/storage/file/YamlRegionFile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldguard-core/src/main/java/com/sk89q/worldguard/protection/managers/storage/file/YamlRegionFile.java b/worldguard-core/src/main/java/com/sk89q/worldguard/protection/managers/storage/file/YamlRegionFile.java index cd1d26e7..4c38a32b 100644 --- a/worldguard-core/src/main/java/com/sk89q/worldguard/protection/managers/storage/file/YamlRegionFile.java +++ b/worldguard-core/src/main/java/com/sk89q/worldguard/protection/managers/storage/file/YamlRegionFile.java @@ -192,7 +192,7 @@ public Set loadAll(FlagRegistry flagRegistry) throws StorageExc } @Override - public void saveAll(Set regions) throws StorageException { + public synchronized void saveAll(Set regions) throws StorageException { checkNotNull(regions); File tempFile = new File(file.getParentFile(), file.getName() + ".tmp");