chore: cleanup annotations in api adventure patch

This commit is contained in:
Riley Park 2023-03-23 09:49:24 -07:00
parent c4351787c6
commit 39255145b6
64 changed files with 1308 additions and 1246 deletions

View file

@ -110,10 +110,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public WorldCreator(@NotNull String name) {
- if (name == null) {
- throw new IllegalArgumentException("World name cannot be null");
- }
-
- this.name = name;
- this.seed = (new Random()).nextLong();
+ // Paper start
+ this(name, getWorldKey(name));
+ }
+
}
+ private static NamespacedKey getWorldKey(String name) {
+ final String mainLevelName = Bukkit.getUnsafe().getMainLevelName();
+ if (name.equals(mainLevelName)) {
@ -124,10 +128,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return NamespacedKey.minecraft("the_end");
+ } else {
+ return NamespacedKey.minecraft(name.toLowerCase(java.util.Locale.ENGLISH).replace(" ", "_"));
}
+ }
+ }
- this.name = name;
+
+ /**
+ * Creates an empty WorldCreator for the given world name and key
+ *
@ -139,7 +142,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ throw new IllegalArgumentException("World name and key cannot be null");
+ }
+ this.name = levelName;
this.seed = (new Random()).nextLong();
+ this.seed = (new Random()).nextLong();
+ this.key = worldKey;
+ }
+
@ -183,8 +186,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @NotNull
+ public static WorldCreator ofKey(@NotNull NamespacedKey worldKey) {
+ return new WorldCreator(worldKey);
}
+ }
+ // Paper end
+
/**
* Copies the options from the specified world
*