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
This commit is contained in:
TomyLobo 2023-06-11 00:07:43 +02:00
parent 8cbce96a2c
commit 7ba0fd3f53
1 changed files with 1 additions and 1 deletions

View File

@ -192,7 +192,7 @@ public class YamlRegionFile implements RegionDatabase {
}
@Override
public void saveAll(Set<ProtectedRegion> regions) throws StorageException {
public synchronized void saveAll(Set<ProtectedRegion> regions) throws StorageException {
checkNotNull(regions);
File tempFile = new File(file.getParentFile(), file.getName() + ".tmp");