Archiviert
13
0

deprecate adventure key() methods where applicable

Dieser Commit ist enthalten in:
Jake Potrebic 2024-11-28 13:51:48 -08:00
Ursprung cb2ab7d225
Commit 5f6a79668c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 27CC63F7CBC866C7
3 geänderte Dateien mit 121 neuen und 24 gelöschten Zeilen

Datei anzeigen

@ -10,10 +10,10 @@ getKey() methods on Keyed objects that have a registry
are marked as Deprecated or Obsolete.
diff --git a/src/main/java/org/bukkit/Art.java b/src/main/java/org/bukkit/Art.java
index d24bf449f58fd7c1b8ffab8dbc42f9f1fef8c4ef..00a290f1bf58cdc2238c13fd5a6048a26b7871da 100644
index d24bf449f58fd7c1b8ffab8dbc42f9f1fef8c4ef..a53e59e030aea65a99806d5b0375cbb4b7457319 100644
--- a/src/main/java/org/bukkit/Art.java
+++ b/src/main/java/org/bukkit/Art.java
@@ -97,6 +97,16 @@ public interface Art extends OldEnum<Art>, Keyed {
@@ -97,6 +97,26 @@ public interface Art extends OldEnum<Art>, Keyed {
@Deprecated(since = "1.6.2")
int getId();
@ -22,19 +22,29 @@ index d24bf449f58fd7c1b8ffab8dbc42f9f1fef8c4ef..00a290f1bf58cdc2238c13fd5a6048a2
+ * @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")
+ @Deprecated(since = "1.21", forRemoval = true)
+ @Override
+ @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
+
/**
* Get a painting by its numeric ID
*
diff --git a/src/main/java/org/bukkit/MusicInstrument.java b/src/main/java/org/bukkit/MusicInstrument.java
index f87364de1bf24ee78e0d823d9081a5f352934405..84edda17692eca0f21eeb01a9eb94eba81c356ab 100644
index f87364de1bf24ee78e0d823d9081a5f352934405..36de4124e977bc8f3cefb2650cdf47f83d5b0d73 100644
--- a/src/main/java/org/bukkit/MusicInstrument.java
+++ b/src/main/java/org/bukkit/MusicInstrument.java
@@ -47,6 +47,16 @@ public abstract class MusicInstrument implements Keyed, net.kyori.adventure.tran
@@ -47,6 +47,27 @@ public abstract class MusicInstrument implements Keyed, net.kyori.adventure.tran
return Registry.INSTRUMENT.getOrThrow(NamespacedKey.minecraft(key));
}
@ -46,13 +56,24 @@ index f87364de1bf24ee78e0d823d9081a5f352934405..84edda17692eca0f21eeb01a9eb94eba
+ @Deprecated(forRemoval = true, since = "1.20.5")
+ @Override
+ 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 start - mark translation key as deprecated
/**
* @deprecated this method assumes that the instrument description
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index ae76b0d2b84dda5eefb9ffd9d76383408f67fbe3..67b9ab322baecf5b2453df4795106514cb073108 100644
index b2bd12736d08fe72128142af4ca2022da8309f6d..c3d49f9c640eb390f507f9521a389cb7c172983a 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -385,6 +385,79 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
@ -149,7 +170,7 @@ index ae76b0d2b84dda5eefb9ffd9d76383408f67fbe3..67b9ab322baecf5b2453df4795106514
}
}
diff --git a/src/main/java/org/bukkit/Sound.java b/src/main/java/org/bukkit/Sound.java
index 04e890be72b18259f1af2833879b4d9af51b1f02..97c4fc9615e28c7268cd8340b50029c8f7de56b7 100644
index 04e890be72b18259f1af2833879b4d9af51b1f02..fd9bd4b0bca5a5b10ae38de79b7121fd4de7298c 100644
--- a/src/main/java/org/bukkit/Sound.java
+++ b/src/main/java/org/bukkit/Sound.java
@@ -1689,6 +1689,16 @@ public interface Sound extends OldEnum<Sound>, Keyed, net.kyori.adventure.sound.
@ -161,7 +182,7 @@ index 04e890be72b18259f1af2833879b4d9af51b1f02..97c4fc9615e28c7268cd8340b50029c8
+ * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#SOUNDS}. Sounds
+ * can exist without a key.
+ */
+ @Deprecated(since = "1.20.5")
+ @Deprecated(since = "1.20.5", forRemoval = true)
+ @Override
+ @NotNull NamespacedKey getKey();
+ // Paper end - deprecate getKey
@ -169,11 +190,23 @@ index 04e890be72b18259f1af2833879b4d9af51b1f02..97c4fc9615e28c7268cd8340b50029c8
/**
* @return an array of all known sounds.
* @deprecated use {@link Registry#iterator()}.
@@ -1700,6 +1710,11 @@ 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
index eaf6cd758344eeba29f00f822a50c93704af8bda..eb192030832e1741850871bec9bf999f014b6fc1 100644
index eaf6cd758344eeba29f00f822a50c93704af8bda..ae05025f39283a8dddd5703473322d75157de713 100644
--- a/src/main/java/org/bukkit/block/banner/PatternType.java
+++ b/src/main/java/org/bukkit/block/banner/PatternType.java
@@ -56,6 +56,13 @@ public interface PatternType extends OldEnum<PatternType>, Keyed {
@@ -56,6 +56,23 @@ public interface PatternType extends OldEnum<PatternType>, Keyed {
PatternType FLOW = getType("flow");
PatternType GUSTER = getType("guster");
@ -182,16 +215,26 @@ index eaf6cd758344eeba29f00f822a50c93704af8bda..eb192030832e1741850871bec9bf999f
+ * @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")
+ @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
@Override
@NotNull
public NamespacedKey getKey();
diff --git a/src/main/java/org/bukkit/generator/structure/Structure.java b/src/main/java/org/bukkit/generator/structure/Structure.java
index 20a7fd27ba3a029d58dd18ad9b470ffaed8c9578..542e3e32e77c0b8dfa707193787516f83b884780 100644
index 20a7fd27ba3a029d58dd18ad9b470ffaed8c9578..b6920f834f8f5992214734abd093af54fc01991c 100644
--- a/src/main/java/org/bukkit/generator/structure/Structure.java
+++ b/src/main/java/org/bukkit/generator/structure/Structure.java
@@ -61,4 +61,13 @@ public abstract class Structure implements Keyed {
@@ -61,4 +61,24 @@ public abstract class Structure implements Keyed {
*/
@NotNull
public abstract StructureType getStructureType();
@ -201,15 +244,26 @@ index 20a7fd27ba3a029d58dd18ad9b470ffaed8c9578..542e3e32e77c0b8dfa707193787516f8
+ * and {@link io.papermc.paper.registry.RegistryKey#STRUCTURE}. Structures can exist without a key.
+ */
+ @Override
+ @Deprecated(since = "1.20.4")
+ @Deprecated(since = "1.20.4", forRemoval = true)
+ 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
}
diff --git a/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java b/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java
index 804cb7162b34225d5dd84aada283de568d7d6592..2a7bedf850896e358213c2a201ca3d611cb9ea67 100644
index 804cb7162b34225d5dd84aada283de568d7d6592..9e6fc714c494ebf98da75d030a2dc75746c37138 100644
--- a/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java
+++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java
@@ -74,4 +74,14 @@ public interface TrimMaterial extends Keyed, Translatable {
@@ -74,4 +74,25 @@ public interface TrimMaterial extends Keyed, Translatable {
@Deprecated(forRemoval = true)
@org.jetbrains.annotations.NotNull String getTranslationKey();
// Paper end - adventure
@ -222,13 +276,24 @@ index 804cb7162b34225d5dd84aada283de568d7d6592..2a7bedf850896e358213c2a201ca3d61
+ @Deprecated(forRemoval = true, since = "1.20.4")
+ @Override
+ 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
}
diff --git a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java
index 56cfe665daba1754e41f633d7c18172bebf87028..db657206c158e755227e8ef8e102a2ee2cc3bf0a 100644
index 56cfe665daba1754e41f633d7c18172bebf87028..b2fa0d565b2492aa812b0ac036ecd74889f67f76 100644
--- a/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java
+++ b/src/main/java/org/bukkit/inventory/meta/trim/TrimPattern.java
@@ -106,4 +106,14 @@ public interface TrimPattern extends Keyed, Translatable {
@@ -106,4 +106,24 @@ public interface TrimPattern extends Keyed, Translatable {
@Deprecated(forRemoval = true)
@org.jetbrains.annotations.NotNull String getTranslationKey();
// Paper end - adventure
@ -241,5 +306,15 @@ index 56cfe665daba1754e41f633d7c18172bebf87028..db657206c158e755227e8ef8e102a2ee
+ @Deprecated(forRemoval = true, since = "1.20.4")
+ @Override
+ 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
}

Datei anzeigen

@ -4,6 +4,28 @@ Date: Sat, 7 Sep 2024 11:14:31 -0700
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 a53e59e030aea65a99806d5b0375cbb4b7457319..47eaec38253136f8335dc40519ff25b81c4006d9 100644
--- a/src/main/java/org/bukkit/Art.java
+++ b/src/main/java/org/bukkit/Art.java
@@ -159,7 +159,7 @@ 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);
@@ -171,7 +171,7 @@ 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
index dff295a4ca877b172f04c60de734c1551afdb5a7..a3ff4fefaf50f3e99a69ba68cbe8e30c95dac5df 100644
--- a/src/main/java/org/bukkit/Fluid.java
@ -80,10 +102,10 @@ index b352886e697a1c9869226b583da5240592575064..464f8f81ba907a61588e4ab869e4f826
return Lists.newArrayList(Registry.BIOME).toArray(new Biome[0]);
}
diff --git a/src/main/java/org/bukkit/block/banner/PatternType.java b/src/main/java/org/bukkit/block/banner/PatternType.java
index eb192030832e1741850871bec9bf999f014b6fc1..70904d6c43b93cb7b9d74d20666fac93a6b4996c 100644
index ae05025f39283a8dddd5703473322d75157de713..390f831f00c530a3d0a6f07f3e75aad0ec9a30db 100644
--- a/src/main/java/org/bukkit/block/banner/PatternType.java
+++ b/src/main/java/org/bukkit/block/banner/PatternType.java
@@ -116,7 +116,7 @@ public interface PatternType extends OldEnum<PatternType>, Keyed {
@@ -126,7 +126,7 @@ public interface PatternType extends OldEnum<PatternType>, Keyed {
* @deprecated only for backwards compatibility, use {@link Registry#get(NamespacedKey)} instead.
*/
@NotNull
@ -92,7 +114,7 @@ index eb192030832e1741850871bec9bf999f014b6fc1..70904d6c43b93cb7b9d74d20666fac93
static PatternType valueOf(@NotNull String name) {
PatternType type = Registry.BANNER_PATTERN.get(NamespacedKey.fromString(name.toLowerCase(Locale.ROOT)));
Preconditions.checkArgument(type != null, "No pattern type found with the name %s", name);
@@ -128,7 +128,7 @@ public interface PatternType extends OldEnum<PatternType>, Keyed {
@@ -138,7 +138,7 @@ public interface PatternType extends OldEnum<PatternType>, Keyed {
* @deprecated use {@link Registry#iterator()}.
*/
@NotNull

Datei anzeigen

@ -5,11 +5,11 @@ Subject: [PATCH] Expanded Art API
diff --git a/src/main/java/org/bukkit/Art.java b/src/main/java/org/bukkit/Art.java
index 00a290f1bf58cdc2238c13fd5a6048a26b7871da..ed2263450e98460250e431d2ee6debd03204c175 100644
index 47eaec38253136f8335dc40519ff25b81c4006d9..5d3fb60a212ee5609d5edc1d8030310521d8343e 100644
--- a/src/main/java/org/bukkit/Art.java
+++ b/src/main/java/org/bukkit/Art.java
@@ -107,6 +107,29 @@ public interface Art extends OldEnum<Art>, Keyed {
@NotNull NamespacedKey getKey();
@@ -117,6 +117,29 @@ public interface Art extends OldEnum<Art>, Keyed {
}
// Paper end - deprecate getKey
+ // Paper start - name and author components, assetId key