mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-18 12:48:53 +01:00
Update getKey impls for inlineable types
This commit is contained in:
parent
5403894bd4
commit
71a367ec84
1 changed files with 60 additions and 0 deletions
|
@ -4,6 +4,30 @@ Date: Wed, 20 Dec 2023 02:03:05 -0800
|
|||
Subject: [PATCH] Improve Registry
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftArt.java b/src/main/java/org/bukkit/craftbukkit/CraftArt.java
|
||||
index 40af940193d0df66bbcdcf5f46132e304016a4d7..a32874e415264fe5516c951984862657a1422586 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftArt.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftArt.java
|
||||
@@ -83,6 +83,7 @@ public class CraftArt implements Art, Handleable<PaintingVariant> {
|
||||
@NotNull
|
||||
@Override
|
||||
public NamespacedKey getKey() {
|
||||
+ if (true) return java.util.Objects.requireNonNull(org.bukkit.Registry.ART.getKey(this), () -> this + " doesn't have a key"); // Paper
|
||||
return this.key;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftMusicInstrument.java b/src/main/java/org/bukkit/craftbukkit/CraftMusicInstrument.java
|
||||
index fb8f68f1aedfb26e4d95fe5bad87f0f2cc91c287..2838ef9d89ec8d7bd8981eff4a2ffe2c11ee9271 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftMusicInstrument.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftMusicInstrument.java
|
||||
@@ -65,6 +65,7 @@ public class CraftMusicInstrument extends MusicInstrument implements Handleable<
|
||||
@NotNull
|
||||
@Override
|
||||
public NamespacedKey getKey() {
|
||||
+ if (true) return java.util.Objects.requireNonNull(org.bukkit.Registry.INSTRUMENT.getKey(this), () -> this + " doesn't have a key"); // Paper
|
||||
return this.key;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
|
||||
index 249f0dcad04a35244da6dab837a461bb42aad00a..273844c9071b8d5cf6009c6c94a6c47a9d0cc700 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
|
||||
|
@ -36,6 +60,42 @@ index 249f0dcad04a35244da6dab837a461bb42aad00a..273844c9071b8d5cf6009c6c94a6c47a
|
|||
+ }
|
||||
+ // Paper end - improve Registry
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
|
||||
index 5b6e6902db19b078bb8598014a87c06f1267acc4..e24d784674f99bbcd0d9c21bc2629a9a97f5ea9b 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
|
||||
@@ -64,6 +64,7 @@ public class CraftSound implements Sound, Handleable<SoundEvent> {
|
||||
@NotNull
|
||||
@Override
|
||||
public NamespacedKey getKey() {
|
||||
+ if (true) return java.util.Objects.requireNonNull(org.bukkit.Registry.SOUNDS.getKey(this), () -> this + " doesn't have a key"); // Paper
|
||||
return this.key;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/banner/CraftPatternType.java b/src/main/java/org/bukkit/craftbukkit/block/banner/CraftPatternType.java
|
||||
index 456a7b45c2ce577b334a1c1be7a690e4c59ee1b2..3addb382d00434bab9151c9edddc8999b986653c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/banner/CraftPatternType.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/banner/CraftPatternType.java
|
||||
@@ -67,6 +67,7 @@ public class CraftPatternType implements PatternType, Handleable<BannerPattern>
|
||||
|
||||
@Override
|
||||
public NamespacedKey getKey() {
|
||||
+ if (true) return java.util.Objects.requireNonNull(org.bukkit.Registry.BANNER_PATTERN.getKey(this), () -> this + " doesn't have a key"); // Paper
|
||||
return this.key;
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/generator/structure/CraftStructure.java b/src/main/java/org/bukkit/craftbukkit/generator/structure/CraftStructure.java
|
||||
index 09fd006244320ddf1191240b2ad6a373bdf11e58..7ef679fdd2c0e44f357967e51606cdbef2d2cdb3 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/generator/structure/CraftStructure.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/generator/structure/CraftStructure.java
|
||||
@@ -42,6 +42,7 @@ public class CraftStructure extends Structure implements Handleable<net.minecraf
|
||||
|
||||
@Override
|
||||
public NamespacedKey getKey() {
|
||||
+ if (true) return java.util.Objects.requireNonNull(org.bukkit.Registry.STRUCTURE.getKey(this), () -> this + " doesn't have a key"); // Paper
|
||||
return this.key;
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java
|
||||
index caf7e4312e95e90dd0822355c8832006e69a2700..38578ef887227ecc8e8bba281eae17a849b4fbe6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java
|
||||
|
|
Loading…
Reference in a new issue