Never overwrite existing world-ids

This commit is contained in:
Lukas Rieger (Blue) 2022-08-03 17:35:16 +02:00
parent dafabac5bb
commit c289fd8c13
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2

View File

@ -105,20 +105,10 @@ public synchronized String getWorldId(Path worldFolder) throws IOException {
// now we can be sure it wasn't loaded yet .. load
Path idFile = worldFolder.resolve("bluemap.id");
id = this.serverInterface.getWorld(worldFolder)
.flatMap(ServerWorld::getId)
.orElse(null);
if (id != null) {
// create/update id-file in worldfolder
Files.writeString(idFile, id, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
worldIds.put(worldFolder, id);
return id;
}
if (!Files.exists(idFile)) {
id = UUID.randomUUID().toString();
id = this.serverInterface.getWorld(worldFolder)
.flatMap(ServerWorld::getId)
.orElse(UUID.randomUUID().toString());
Files.writeString(idFile, id, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
worldIds.put(worldFolder, id);