mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Fix duplicate world keys via createWorld (#7614)
This commit is contained in:
parent
d119830727
commit
75a1da666c
1 changed files with 18 additions and 0 deletions
|
@ -8,6 +8,24 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/ja
|
|||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
File folder = new File(this.getWorldContainer(), name);
|
||||
World world = this.getWorld(name);
|
||||
|
||||
- if (world != null) {
|
||||
- return world;
|
||||
+ // Paper start
|
||||
+ World worldByKey = this.getWorld(creator.key());
|
||||
+ if (world != null || worldByKey != null) {
|
||||
+ if (world == worldByKey) {
|
||||
+ return world;
|
||||
+ }
|
||||
+ throw new IllegalArgumentException("Cannot create a world with key " + creator.key() + " and name " + name + " one (or both) already match a world that exists");
|
||||
}
|
||||
+ // Paper end
|
||||
|
||||
if ((folder.exists()) && (!folder.isDirectory())) {
|
||||
throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder");
|
||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||
} else if (name.equals(levelName + "_the_end")) {
|
||||
worldKey = net.minecraft.world.level.Level.END;
|
||||
|
|
Loading…
Reference in a new issue