mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-06 10:49:40 +01:00
9cfc0d5a60
This reverts commit 24b7da65ee
.
Patch was updated incorrectly and needs a closer look.
52 lines
2.7 KiB
Diff
52 lines
2.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Wed, 6 Jan 2021 00:34:04 -0800
|
|
Subject: [PATCH] Implement Keyed on World
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
index 989b6b91dc046e20332f0cef35105b290fdb2e43..fb18b1f0bbc5b87f6895086f6d6a749543caf11f 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
|
@@ -1154,7 +1154,7 @@ public final class CraftServer implements Server {
|
|
} else if (name.equals(levelName + "_the_end")) {
|
|
worldKey = net.minecraft.world.level.Level.END;
|
|
} else {
|
|
- worldKey = ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(name.toLowerCase(java.util.Locale.ENGLISH)));
|
|
+ worldKey = ResourceKey.create(Registry.DIMENSION_REGISTRY, new net.minecraft.resources.ResourceLocation(creator.key().getNamespace().toLowerCase(java.util.Locale.ENGLISH), creator.key().getKey().toLowerCase(java.util.Locale.ENGLISH))); // Paper
|
|
}
|
|
|
|
ServerLevel internal = (ServerLevel) new ServerLevel(this.console, console.executor, worldSession, worlddata, worldKey, dimensionmanager, this.getServer().progressListenerFactory.create(11),
|
|
@@ -1245,6 +1245,15 @@ public final class CraftServer implements Server {
|
|
return null;
|
|
}
|
|
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public World getWorld(NamespacedKey worldKey) {
|
|
+ ServerLevel worldServer = console.getLevel(ResourceKey.create(Registry.DIMENSION_REGISTRY, CraftNamespacedKey.toMinecraft(worldKey)));
|
|
+ if (worldServer == null) return null;
|
|
+ return worldServer.getWorld();
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
public void addWorld(World world) {
|
|
// Check if a World already exists with the UID.
|
|
if (this.getWorld(world.getUID()) != null) {
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
index fd01fc9708a62df9483c88ffeec6a0304f3708ca..7519154bbd42245bddc6653349aba294890462a3 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
@@ -2580,6 +2580,11 @@ public class CraftWorld implements World {
|
|
return java.util.concurrent.CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk());
|
|
}, net.minecraft.server.MinecraftServer.getServer());
|
|
}
|
|
+
|
|
+ @Override
|
|
+ public org.bukkit.NamespacedKey getKey() {
|
|
+ return org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(world.dimension().location());
|
|
+ }
|
|
// Paper end
|
|
|
|
// Spigot start
|