Skip to content

Commit 44516ba

Browse files
authored
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 c0cbe27 commit 44516ba

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
@@ -190,7 +190,7 @@ public Set<ProtectedRegion> loadAll(FlagRegistry flagRegistry) throws StorageExc
190190
}
191191

192192
@Override
193-
public void saveAll(Set<ProtectedRegion> regions) throws StorageException {
193+
public synchronized void saveAll(Set<ProtectedRegion> regions) throws StorageException {
194194
checkNotNull(regions);
195195

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

0 commit comments

Comments
 (0)