Fix UUID not being updated when changing world of MapView

By: Phoenix616 <max@themoep.de>
This commit is contained in:
CraftBukkit/Spigot 2023-04-04 19:36:37 +01:00
parent 7b627056c1
commit 48dd61052b
2 changed files with 10 additions and 2 deletions

View File

@ -24,7 +24,7 @@
+ // CraftBukkit start
+ public final CraftMapView mapView;
+ private CraftServer server;
+ private UUID uniqueId = null;
+ public UUID uniqueId = null;
+ public String id;
+ // CraftBukkit end
+

View File

@ -64,12 +64,20 @@ public final class CraftMapView implements MapView {
ResourceKey<net.minecraft.world.level.World> dimension = worldMap.dimension;
WorldServer world = MinecraftServer.getServer().getLevel(dimension);
return (world == null) ? null : world.getWorld();
if (world != null) {
return world.getWorld();
}
if (worldMap.uniqueId != null) {
return Bukkit.getServer().getWorld(worldMap.uniqueId);
}
return null;
}
@Override
public void setWorld(World world) {
worldMap.dimension = ((CraftWorld) world).getHandle().dimension();
worldMap.uniqueId = world.getUID();
}
@Override