mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
deprecate adventure key() methods where applicable
This commit is contained in:
parent
57ab68f4ee
commit
b207266c7d
3 changed files with 102 additions and 5 deletions
|
@ -4,6 +4,28 @@ Date: Sat, 7 Sep 2024 11:14:31 -0700
|
||||||
Subject: [PATCH] Deprecate for removal all OldEnum-related methods
|
Subject: [PATCH] Deprecate for removal all OldEnum-related methods
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/Art.java b/src/main/java/org/bukkit/Art.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/org/bukkit/Art.java
|
||||||
|
+++ b/src/main/java/org/bukkit/Art.java
|
||||||
|
@@ -0,0 +0,0 @@ public interface Art extends OldEnum<Art>, Keyed {
|
||||||
|
* @deprecated only for backwards compatibility, use {@link Registry#get(NamespacedKey)} instead.
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
- @Deprecated(since = "1.21.3")
|
||||||
|
+ @Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
|
||||||
|
static Art valueOf(@NotNull String name) {
|
||||||
|
Art art = Bukkit.getUnsafe().get(Registry.ART, NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
|
||||||
|
Preconditions.checkArgument(art != null, "No art found with the name %s", name);
|
||||||
|
@@ -0,0 +0,0 @@ public interface Art extends OldEnum<Art>, Keyed {
|
||||||
|
* @deprecated use {@link Registry#iterator()}.
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
- @Deprecated(since = "1.21.3")
|
||||||
|
+ @Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils
|
||||||
|
static Art[] values() {
|
||||||
|
return Lists.newArrayList(Registry.ART).toArray(new Art[0]);
|
||||||
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/Fluid.java b/src/main/java/org/bukkit/Fluid.java
|
diff --git a/src/main/java/org/bukkit/Fluid.java b/src/main/java/org/bukkit/Fluid.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/Fluid.java
|
--- a/src/main/java/org/bukkit/Fluid.java
|
||||||
|
|
|
@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/org/bukkit/Art.java
|
--- a/src/main/java/org/bukkit/Art.java
|
||||||
+++ b/src/main/java/org/bukkit/Art.java
|
+++ b/src/main/java/org/bukkit/Art.java
|
||||||
@@ -0,0 +0,0 @@ public interface Art extends OldEnum<Art>, Keyed {
|
@@ -0,0 +0,0 @@ public interface Art extends OldEnum<Art>, Keyed {
|
||||||
@NotNull NamespacedKey getKey();
|
}
|
||||||
// Paper end - deprecate getKey
|
// Paper end - deprecate getKey
|
||||||
|
|
||||||
+ // Paper start - name and author components, assetId key
|
+ // Paper start - name and author components, assetId key
|
||||||
|
|
|
@ -22,9 +22,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)},
|
+ * @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)},
|
||||||
+ * and {@link io.papermc.paper.registry.RegistryKey#PAINTING_VARIANT}. Painting variants can exist without a key.
|
+ * and {@link io.papermc.paper.registry.RegistryKey#PAINTING_VARIANT}. Painting variants can exist without a key.
|
||||||
+ */
|
+ */
|
||||||
+ @Deprecated(since = "1.21")
|
+ @Deprecated(since = "1.21", forRemoval = true)
|
||||||
+ @Override
|
+ @Override
|
||||||
+ @NotNull NamespacedKey getKey();
|
+ @NotNull NamespacedKey getKey();
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)},
|
||||||
|
+ * and {@link io.papermc.paper.registry.RegistryKey#PAINTING_VARIANT}. Painting variants can exist without a key.
|
||||||
|
+ */
|
||||||
|
+ @Deprecated(since = "1.21", forRemoval = true)
|
||||||
|
+ @Override
|
||||||
|
+ default net.kyori.adventure.key.@org.jetbrains.annotations.NotNull Key key() {
|
||||||
|
+ return Keyed.super.key();
|
||||||
|
+ }
|
||||||
+ // Paper end - deprecate getKey
|
+ // Paper end - deprecate getKey
|
||||||
+
|
+
|
||||||
/**
|
/**
|
||||||
|
@ -46,6 +56,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ @Deprecated(forRemoval = true, since = "1.20.5")
|
+ @Deprecated(forRemoval = true, since = "1.20.5")
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public abstract @NotNull NamespacedKey getKey();
|
+ public abstract @NotNull NamespacedKey getKey();
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)},
|
||||||
|
+ * and {@link io.papermc.paper.registry.RegistryKey#INSTRUMENT}. MusicInstruments can exist without a key.
|
||||||
|
+ */
|
||||||
|
+ @Deprecated(forRemoval = true, since = "1.20.5")
|
||||||
|
+ @Override
|
||||||
|
+ public net.kyori.adventure.key.@org.jetbrains.annotations.NotNull Key key() {
|
||||||
|
+ return Keyed.super.key();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ // Paper end - deprecate getKey
|
+ // Paper end - deprecate getKey
|
||||||
+
|
+
|
||||||
// Paper start - mark translation key as deprecated
|
// Paper start - mark translation key as deprecated
|
||||||
|
@ -161,7 +182,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#SOUNDS}. Sounds
|
+ * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#SOUNDS}. Sounds
|
||||||
+ * can exist without a key.
|
+ * can exist without a key.
|
||||||
+ */
|
+ */
|
||||||
+ @Deprecated(since = "1.20.5")
|
+ @Deprecated(since = "1.20.5", forRemoval = true)
|
||||||
+ @Override
|
+ @Override
|
||||||
+ @NotNull NamespacedKey getKey();
|
+ @NotNull NamespacedKey getKey();
|
||||||
+ // Paper end - deprecate getKey
|
+ // Paper end - deprecate getKey
|
||||||
|
@ -169,6 +190,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
/**
|
/**
|
||||||
* @return an array of all known sounds.
|
* @return an array of all known sounds.
|
||||||
* @deprecated use {@link Registry#iterator()}.
|
* @deprecated use {@link Registry#iterator()}.
|
||||||
|
@@ -0,0 +0,0 @@ public interface Sound extends OldEnum<Sound>, Keyed, net.kyori.adventure.sound.
|
||||||
|
}
|
||||||
|
|
||||||
|
// Paper start
|
||||||
|
+ /**
|
||||||
|
+ * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#SOUNDS}. Sounds
|
||||||
|
+ * can exist without a key.
|
||||||
|
+ */
|
||||||
|
+ @Deprecated(since = "1.20.5", forRemoval = true)
|
||||||
|
@Override
|
||||||
|
default net.kyori.adventure.key.@NotNull Key key() {
|
||||||
|
return this.getKey();
|
||||||
diff --git a/src/main/java/org/bukkit/block/banner/PatternType.java b/src/main/java/org/bukkit/block/banner/PatternType.java
|
diff --git a/src/main/java/org/bukkit/block/banner/PatternType.java b/src/main/java/org/bukkit/block/banner/PatternType.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/block/banner/PatternType.java
|
--- a/src/main/java/org/bukkit/block/banner/PatternType.java
|
||||||
|
@ -182,7 +215,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)},
|
+ * @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)},
|
||||||
+ * and {@link io.papermc.paper.registry.RegistryKey#BANNER_PATTERN}. PatternTypes can exist without a key.
|
+ * and {@link io.papermc.paper.registry.RegistryKey#BANNER_PATTERN}. PatternTypes can exist without a key.
|
||||||
+ */
|
+ */
|
||||||
+ @Deprecated(since = "1.20.5")
|
+ @Deprecated(since = "1.20.5", forRemoval = true)
|
||||||
|
+ @Override
|
||||||
|
+ default net.kyori.adventure.key.@org.jetbrains.annotations.NotNull Key key() {
|
||||||
|
+ return org.bukkit.Keyed.super.key();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)},
|
||||||
|
+ * and {@link io.papermc.paper.registry.RegistryKey#BANNER_PATTERN}. PatternTypes can exist without a key.
|
||||||
|
+ */
|
||||||
|
+ @Deprecated(since = "1.20.5", forRemoval = true)
|
||||||
+ // Paper end - deprecate getKey
|
+ // Paper end - deprecate getKey
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
|
@ -201,8 +244,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * and {@link io.papermc.paper.registry.RegistryKey#STRUCTURE}. Structures can exist without a key.
|
+ * and {@link io.papermc.paper.registry.RegistryKey#STRUCTURE}. Structures can exist without a key.
|
||||||
+ */
|
+ */
|
||||||
+ @Override
|
+ @Override
|
||||||
+ @Deprecated(since = "1.20.4")
|
+ @Deprecated(since = "1.20.4", forRemoval = true)
|
||||||
+ public abstract @NotNull NamespacedKey getKey();
|
+ public abstract @NotNull NamespacedKey getKey();
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)},
|
||||||
|
+ * and {@link io.papermc.paper.registry.RegistryKey#STRUCTURE}. Structures can exist without a key.
|
||||||
|
+ */
|
||||||
|
+ @Override
|
||||||
|
+ @Deprecated(since = "1.20.4", forRemoval = true)
|
||||||
|
+ public net.kyori.adventure.key.@org.jetbrains.annotations.NotNull Key key() {
|
||||||
|
+ return org.bukkit.Keyed.super.key();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ // Paper end - deprecate getKey
|
+ // Paper end - deprecate getKey
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java b/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java
|
diff --git a/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java b/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java
|
||||||
|
@ -222,6 +276,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ @Deprecated(forRemoval = true, since = "1.20.4")
|
+ @Deprecated(forRemoval = true, since = "1.20.4")
|
||||||
+ @Override
|
+ @Override
|
||||||
+ org.bukkit.@org.jetbrains.annotations.NotNull NamespacedKey getKey();
|
+ org.bukkit.@org.jetbrains.annotations.NotNull NamespacedKey getKey();
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)},
|
||||||
|
+ * and {@link io.papermc.paper.registry.RegistryKey#TRIM_MATERIAL}. TrimMaterials can exist without a key.
|
||||||
|
+ */
|
||||||
|
+ @Deprecated(forRemoval = true, since = "1.20.4")
|
||||||
|
+ @Override
|
||||||
|
+ default net.kyori.adventure.key.@org.jetbrains.annotations.NotNull Key key() {
|
||||||
|
+ return org.bukkit.Keyed.super.key();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ // Paper end - Registry#getKey
|
+ // Paper end - Registry#getKey
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java
|
diff --git a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java
|
||||||
|
@ -241,5 +306,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ @Deprecated(forRemoval = true, since = "1.20.4")
|
+ @Deprecated(forRemoval = true, since = "1.20.4")
|
||||||
+ @Override
|
+ @Override
|
||||||
+ org.bukkit.@org.jetbrains.annotations.NotNull NamespacedKey getKey();
|
+ org.bukkit.@org.jetbrains.annotations.NotNull NamespacedKey getKey();
|
||||||
|
+
|
||||||
|
+ /**
|
||||||
|
+ * @deprecated use {@link Registry#getKey(Keyed)}, {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)},
|
||||||
|
+ * and {@link io.papermc.paper.registry.RegistryKey#TRIM_PATTERN}. TrimPatterns can exist without a key.
|
||||||
|
+ */
|
||||||
|
+ @Deprecated(forRemoval = true, since = "1.20.4")
|
||||||
|
+ @Override
|
||||||
|
+ default net.kyori.adventure.key.@org.jetbrains.annotations.NotNull Key key() {
|
||||||
|
+ return org.bukkit.Keyed.super.key();
|
||||||
|
+ }
|
||||||
+ // Paper end - Registry#getKey
|
+ // Paper end - Registry#getKey
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue