Skip to content

Commit 35cbdf6

Browse files
committed
Use sponge world UUIDs instead of the formatted resource-key to ensure uniqueness
1 parent c289fd8 commit 35cbdf6

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

implementations/sponge-8.0.0/src/main/java/de/bluecolored/bluemap/sponge/SpongePlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ public Optional<ServerWorld> getWorld(Object world) {
234234

235235
if (world instanceof String) {
236236
ResourceKey resourceKey = ResourceKey.resolve((String) world);
237-
if (resourceKey != null) world = resourceKey;
237+
var serverWorld = Sponge.server().worldManager().world(resourceKey).orElse(null);
238+
if (serverWorld != null) world = serverWorld;
238239
}
239240

240241
if (world instanceof ResourceKey) {

implementations/sponge-8.0.0/src/main/java/de/bluecolored/bluemap/sponge/SpongeWorld.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public Dimension getDimension() {
6363
public Optional<String> getId() {
6464
var world = delegate.get();
6565
if (world != null) {
66-
return Optional.of(world.key().formatted());
66+
return Optional.of(world.uniqueId().toString());
6767
}
6868
return Optional.empty();
6969
}

implementations/sponge-9.0.0/src/main/java/de/bluecolored/bluemap/sponge/SpongePlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ public Optional<ServerWorld> getWorld(Object world) {
234234

235235
if (world instanceof String) {
236236
ResourceKey resourceKey = ResourceKey.resolve((String) world);
237-
if (resourceKey != null) world = resourceKey;
237+
var serverWorld = Sponge.server().worldManager().world(resourceKey).orElse(null);
238+
if (serverWorld != null) world = serverWorld;
238239
}
239240

240241
if (world instanceof ResourceKey) {

implementations/sponge-9.0.0/src/main/java/de/bluecolored/bluemap/sponge/SpongeWorld.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public Dimension getDimension() {
6363
public Optional<String> getId() {
6464
var world = delegate.get();
6565
if (world != null) {
66-
return Optional.of(world.key().formatted());
66+
return Optional.of(world.uniqueId().toString());
6767
}
6868
return Optional.empty();
6969
}

0 commit comments

Comments
 (0)