13
0
geforkt von Mirrors/Paper

Make TypedKey an actual Key (#11641)

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-11-23 20:21:24 +01:00
Ursprung 00e253fdf9
Commit 857931f5cc

Datei anzeigen

@ -337,7 +337,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */
+@ApiStatus.Experimental
+@NullMarked
+public sealed interface TypedKey<T> extends Keyed permits TypedKeyImpl {
+public sealed interface TypedKey<T> extends Key permits TypedKeyImpl {
+
+ /**
+ * Gets the key for the value in the registry.
@ -381,6 +381,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+
+@NullMarked
+record TypedKeyImpl<T>(Key key, RegistryKey<T> registryKey) implements TypedKey<T> {
+ // Wrap key methods to make this easier to use
+ @Override
+ public String namespace() {
+ return this.key.namespace();
+ }
+
+ @Override
+ public String value() {
+ return this.key.value();
+ }
+
+ @Override
+ public String asString() {
+ return this.key.asString();
+ }
+}
diff --git a/src/main/java/org/bukkit/MinecraftExperimental.java b/src/main/java/org/bukkit/MinecraftExperimental.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644