From c289fd8c13d2ff94410fc52f930c73be60817eca Mon Sep 17 00:00:00 2001 From: "Lukas Rieger (Blue)" Date: Wed, 3 Aug 2022 17:35:16 +0200 Subject: [PATCH] Never overwrite existing world-ids --- .../bluemap/common/BlueMapService.java | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/BlueMapService.java b/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/BlueMapService.java index bb80320d..72b26bb6 100644 --- a/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/BlueMapService.java +++ b/BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/BlueMapService.java @@ -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);