mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Deprecate several Keyed#getKey methods (#10357)
- Structure (can already be defined inline in datapacks - PatternType (can be defined inline in 1.20.5 data components) - MusicInstrument (same as above)
This commit is contained in:
parent
b56970d394
commit
7263a87e9c
1 changed files with 57 additions and 0 deletions
|
@ -9,6 +9,27 @@ items need to exist without having a key and so
|
|||
getKey() methods on Keyed objects that have a registry
|
||||
are marked as Deprecated or Obsolete.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/MusicInstrument.java b/src/main/java/org/bukkit/MusicInstrument.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/MusicInstrument.java
|
||||
+++ b/src/main/java/org/bukkit/MusicInstrument.java
|
||||
@@ -0,0 +0,0 @@ public abstract class MusicInstrument implements Keyed, net.kyori.adventure.tran
|
||||
return instrument;
|
||||
}
|
||||
|
||||
+ // Paper start - deprecate getKey
|
||||
+ /**
|
||||
+ * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#INSTRUMENT}. MusicInstruments
|
||||
+ * can exist without a key.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ @Override
|
||||
+ public abstract @NotNull NamespacedKey getKey();
|
||||
+ // Paper end - deprecate getKey
|
||||
+
|
||||
// Paper start - translation key
|
||||
@Override
|
||||
public @NotNull String translationKey() {
|
||||
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/Registry.java
|
||||
|
@ -76,6 +97,42 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ // Paper end - improve Registry
|
||||
}
|
||||
}
|
||||
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
|
||||
--- a/src/main/java/org/bukkit/block/banner/PatternType.java
|
||||
+++ b/src/main/java/org/bukkit/block/banner/PatternType.java
|
||||
@@ -0,0 +0,0 @@ public enum PatternType implements Keyed {
|
||||
this.key = NamespacedKey.minecraft(key);
|
||||
}
|
||||
|
||||
+ // Paper start - deprecate getKey
|
||||
+ /**
|
||||
+ * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#BANNER_PATTERN}. PatternTypes
|
||||
+ * can exist without a key.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ // 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/generator/structure/Structure.java
|
||||
+++ b/src/main/java/org/bukkit/generator/structure/Structure.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Structure implements Keyed {
|
||||
*/
|
||||
@NotNull
|
||||
public abstract StructureType getStructureType();
|
||||
+ // Paper start - deprecate getKey
|
||||
+ /**
|
||||
+ * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#STRUCTURE}. Structures
|
||||
+ * can exist without a key.
|
||||
+ */
|
||||
+ @Override
|
||||
+ @Deprecated
|
||||
+ public abstract @NotNull NamespacedKey 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
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/meta/trim/TrimMaterial.java
|
||||
|
|
Loading…
Reference in a new issue