Skip to content

Commit 7ba0fd3

Browse files
committed
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
1 parent 8cbce96 commit 7ba0fd3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • worldguard-core/src/main/java/com/sk89q/worldguard/protection/managers/storage/file

worldguard-core/src/main/java/com/sk89q/worldguard/protection/managers/storage/file/YamlRegionFile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public Set<ProtectedRegion> loadAll(FlagRegistry flagRegistry) throws StorageExc
192192
}
193193

194194
@Override
195-
public void saveAll(Set<ProtectedRegion> regions) throws StorageException {
195+
public synchronized void saveAll(Set<ProtectedRegion> regions) throws StorageException {
196196
checkNotNull(regions);
197197

198198
File tempFile = new File(file.getParentFile(), file.getName() + ".tmp");

0 commit comments

Comments
 (0)