Skip to content

Commit c289fd8

Browse files
committed
Never overwrite existing world-ids
1 parent dafabac commit c289fd8

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/BlueMapService.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,20 +105,10 @@ public synchronized String getWorldId(Path worldFolder) throws IOException {
105105
// now we can be sure it wasn't loaded yet .. load
106106

107107
Path idFile = worldFolder.resolve("bluemap.id");
108-
id = this.serverInterface.getWorld(worldFolder)
109-
.flatMap(ServerWorld::getId)
110-
.orElse(null);
111-
112-
if (id != null) {
113-
// create/update id-file in worldfolder
114-
Files.writeString(idFile, id, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
115-
116-
worldIds.put(worldFolder, id);
117-
return id;
118-
}
119-
120108
if (!Files.exists(idFile)) {
121-
id = UUID.randomUUID().toString();
109+
id = this.serverInterface.getWorld(worldFolder)
110+
.flatMap(ServerWorld::getId)
111+
.orElse(UUID.randomUUID().toString());
122112
Files.writeString(idFile, id, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
123113

124114
worldIds.put(worldFolder, id);

0 commit comments

Comments
 (0)