Add getWorld method that uses adventure Key (#11199)

This commit is contained in:
kokiriglade
2024-08-19 10:41:55 +01:00
parent 5703e6c6d8
commit 9921a197e7
4 changed files with 31 additions and 8 deletions

View File

@@ -56,8 +56,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ @Override
+ public World getWorld(NamespacedKey worldKey) {
+ ServerLevel worldServer = console.getLevel(ResourceKey.create(net.minecraft.core.registries.Registries.DIMENSION, CraftNamespacedKey.toMinecraft(worldKey)));
+ public World getWorld(net.kyori.adventure.key.Key worldKey) {
+ ServerLevel worldServer = console.getLevel(ResourceKey.create(net.minecraft.core.registries.Registries.DIMENSION, io.papermc.paper.adventure.PaperAdventure.asVanilla(worldKey)));
+ if (worldServer == null) return null;
+ return worldServer.getWorld();
+ }