mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Fix jukebox playable component not being applied on item meta (#10922)
This commit is contained in:
parent
72883ff600
commit
a362e724b2
5 changed files with 59 additions and 1 deletions
|
@ -1006,6 +1006,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
public enum ChatColor {
|
public enum ChatColor {
|
||||||
/**
|
/**
|
||||||
* Represents black
|
* Represents black
|
||||||
|
diff --git a/src/main/java/org/bukkit/JukeboxSong.java b/src/main/java/org/bukkit/JukeboxSong.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/org/bukkit/JukeboxSong.java
|
||||||
|
+++ b/src/main/java/org/bukkit/JukeboxSong.java
|
||||||
|
@@ -0,0 +0,0 @@ public interface JukeboxSong extends Keyed, Translatable {
|
||||||
|
private static JukeboxSong get(@NotNull String s) {
|
||||||
|
return Objects.requireNonNull(Registry.JUKEBOX_SONG.get(NamespacedKey.minecraft(s)), "Missing song " + s);
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // Paper start - adventure
|
||||||
|
+ /**
|
||||||
|
+ * @deprecated this method assumes that jukebox song description will
|
||||||
|
+ * always be a translatable component which is not guaranteed.
|
||||||
|
+ */
|
||||||
|
+ @Override
|
||||||
|
+ @Deprecated(forRemoval = true)
|
||||||
|
+ @org.jetbrains.annotations.NotNull String getTranslationKey();
|
||||||
|
+ // Paper end - adventure
|
||||||
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/Keyed.java b/src/main/java/org/bukkit/Keyed.java
|
diff --git a/src/main/java/org/bukkit/Keyed.java b/src/main/java/org/bukkit/Keyed.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/Keyed.java
|
--- a/src/main/java/org/bukkit/Keyed.java
|
||||||
|
|
|
@ -1627,6 +1627,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
* @param name the name to set
|
* @param name the name to set
|
||||||
* @deprecated meta no longer exists
|
* @deprecated meta no longer exists
|
||||||
*/
|
*/
|
||||||
|
@@ -0,0 +0,0 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||||
|
*
|
||||||
|
* @return component
|
||||||
|
*/
|
||||||
|
- @Nullable
|
||||||
|
+ @NotNull // Paper
|
||||||
|
JukeboxPlayableComponent getJukeboxPlayable();
|
||||||
|
|
||||||
|
/**
|
||||||
diff --git a/src/main/java/org/bukkit/inventory/meta/MapMeta.java b/src/main/java/org/bukkit/inventory/meta/MapMeta.java
|
diff --git a/src/main/java/org/bukkit/inventory/meta/MapMeta.java b/src/main/java/org/bukkit/inventory/meta/MapMeta.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/inventory/meta/MapMeta.java
|
--- a/src/main/java/org/bukkit/inventory/meta/MapMeta.java
|
||||||
|
|
|
@ -1561,6 +1561,24 @@ diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/ja
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||||
+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||||
|
@@ -0,0 +0,0 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||||
|
* The returned component is a snapshot of its current state and does not
|
||||||
|
* reflect a live view of what is on an item. After changing any value on
|
||||||
|
* this component, it must be set with
|
||||||
|
- * {@link #setJukeboxPlayable(org.bukkit.inventory.meta.components.JukeboxComponent)}
|
||||||
|
+ * {@link #setJukeboxPlayable(org.bukkit.inventory.meta.components.JukeboxPlayableComponent)}
|
||||||
|
* to apply the changes.
|
||||||
|
*
|
||||||
|
* @return component
|
||||||
|
@@ -0,0 +0,0 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||||
|
JukeboxPlayableComponent getJukeboxPlayable();
|
||||||
|
|
||||||
|
/**
|
||||||
|
- * Sets the item tool.
|
||||||
|
+ * Sets the jukebox playable component.
|
||||||
|
*
|
||||||
|
* @param jukeboxPlayable new component
|
||||||
|
*/
|
||||||
@@ -0,0 +0,0 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
@@ -0,0 +0,0 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||||
/**
|
/**
|
||||||
* Return an immutable copy of all {@link Attribute}s and their
|
* Return an immutable copy of all {@link Attribute}s and their
|
||||||
|
|
|
@ -3313,6 +3313,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
collection = icons;
|
collection = icons;
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftJukeboxSong.java b/src/main/java/org/bukkit/craftbukkit/CraftJukeboxSong.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftJukeboxSong.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftJukeboxSong.java
|
||||||
|
@@ -0,0 +0,0 @@ public class CraftJukeboxSong implements JukeboxSong, Handleable<net.minecraft.w
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public String getTranslationKey() {
|
||||||
|
+ if (!(this.handle.description().getContents() instanceof TranslatableContents)) throw new UnsupportedOperationException("Description isn't translatable!"); // Paper
|
||||||
|
return ((TranslatableContents) this.handle.description().getContents()).getKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
|
|
@ -912,7 +912,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
@Overridden
|
@Overridden
|
||||||
boolean isEmpty() {
|
boolean isEmpty() {
|
||||||
- return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasTool() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null || this.canPlaceOnPredicates != null || this.canBreakPredicates != null); // Paper
|
- return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasTool() || this.hasDamage() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null || this.canPlaceOnPredicates != null || this.canBreakPredicates != null); // Paper
|
||||||
+ return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasTool() || this.hasDamageValue() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null || this.canPlaceOnPredicates != null || this.canBreakPredicates != null); // Paper
|
+ return !(this.hasDisplayName() || this.hasItemName() || this.hasLocalizedName() || this.hasEnchants() || (this.lore != null) || this.hasCustomModelData() || this.hasBlockData() || this.hasRepairCost() || !this.unhandledTags.build().isEmpty() || !this.removedTags.isEmpty() || !this.persistentDataContainer.isEmpty() || this.hideFlag != 0 || this.isHideTooltip() || this.isUnbreakable() || this.hasEnchantmentGlintOverride() || this.isFireResistant() || this.hasMaxStackSize() || this.hasRarity() || this.hasFood() || this.hasTool() || this.hasJukeboxPlayable() || this.hasDamageValue() || this.hasMaxDamage() || this.hasAttributeModifiers() || this.customTag != null || this.canPlaceOnPredicates != null || this.canBreakPredicates != null); // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
// Paper start
|
// Paper start
|
||||||
|
|
Loading…
Reference in a new issue