Add getWorld method that uses adventure Key (#11199)
This commit is contained in:
parent
8fd3a67138
commit
dae906ba45
11 changed files with 75 additions and 52 deletions
|
@ -5,10 +5,10 @@ Subject: [PATCH] Expand world key API
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index fbe14c327ee9c1ac07893853ca7c699e81225281..a2ced20efd2c6be2fe63d80f444c8cb608c37eef 100644
|
||||
index fbe14c327ee9c1ac07893853ca7c699e81225281..b558fa73dbcf3747690933e6aadf7061a0de2630 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -865,6 +865,18 @@ public final class Bukkit {
|
||||
@@ -865,6 +865,29 @@ public final class Bukkit {
|
||||
public static World getWorld(@NotNull UUID uid) {
|
||||
return server.getWorld(uid);
|
||||
}
|
||||
|
@ -23,6 +23,17 @@ index fbe14c327ee9c1ac07893853ca7c699e81225281..a2ced20efd2c6be2fe63d80f444c8cb6
|
|||
+ public static World getWorld(@NotNull NamespacedKey worldKey) {
|
||||
+ return server.getWorld(worldKey);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the world from the given Key
|
||||
+ *
|
||||
+ * @param worldKey the Key of the world to retrieve
|
||||
+ * @return a world with the given Key, or null if none exists
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public static World getWorld(@NotNull net.kyori.adventure.key.Key worldKey) {
|
||||
+ return server.getWorld(worldKey);
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
/**
|
||||
|
@ -56,10 +67,10 @@ index 27eff0826d5b5b48697fefd9571886e7bbce74b1..d8b1fa79dc24138dc71e32c14bda71c1
|
|||
// Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 943f8881ea23481ea5d5125b6ec7c9c6f763f0b0..8b52e9a41ea9ba38117d42224811ff28663ef980 100644
|
||||
index 943f8881ea23481ea5d5125b6ec7c9c6f763f0b0..42930006b6425b5d82233e4ffe7025ce5397b277 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -726,6 +726,17 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -726,6 +726,28 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@Nullable
|
||||
public World getWorld(@NotNull UUID uid);
|
||||
|
||||
|
@ -71,7 +82,18 @@ index 943f8881ea23481ea5d5125b6ec7c9c6f763f0b0..8b52e9a41ea9ba38117d42224811ff28
|
|||
+ * @return a world with the given NamespacedKey, or null if none exists
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public World getWorld(@NotNull NamespacedKey worldKey);
|
||||
+ default World getWorld(@NotNull NamespacedKey worldKey) {
|
||||
+ return getWorld((net.kyori.adventure.key.Key) worldKey);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the world from the given Key
|
||||
+ *
|
||||
+ * @param worldKey the Key of the world to retrieve
|
||||
+ * @return a world with the given Key, or null if none exists
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ World getWorld(@NotNull net.kyori.adventure.key.Key worldKey);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue