adventure: make calls with generic component lists more usable (#9008)
This should allow the usage of ItemStack#lore and other methods with a List<TextComponent>
This commit is contained in:
parent
7929540ba3
commit
ff603cb76d
3 changed files with 17 additions and 17 deletions
|
@ -1953,7 +1953,7 @@ index 281518d6e1f67722134e22d89b71106aae0c4397..0a539af95e1bd331cec241403a15e4e6
|
|||
+ // Paper end
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index c60e1fc1cad1b9889a508602df84840723b7b966..baf0887ec941533f8007f2c7f7ab78f16b45bd74 100644
|
||||
index c60e1fc1cad1b9889a508602df84840723b7b966..59c1a3a137bd8f469353273cb98afae024b1e6ef 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -39,7 +39,28 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
@ -2151,7 +2151,7 @@ index c60e1fc1cad1b9889a508602df84840723b7b966..baf0887ec941533f8007f2c7f7ab78f1
|
|||
+ * @throws IllegalArgumentException if location is null
|
||||
+ * @throws IllegalArgumentException if lines is non-null and has a length less than 4
|
||||
+ */
|
||||
+ default void sendSignChange(@NotNull Location loc, @Nullable java.util.List<net.kyori.adventure.text.Component> lines) throws IllegalArgumentException {
|
||||
+ default void sendSignChange(@NotNull Location loc, @Nullable java.util.List<? extends net.kyori.adventure.text.Component> lines) throws IllegalArgumentException {
|
||||
+ this.sendSignChange(loc, lines, DyeColor.BLACK);
|
||||
+ }
|
||||
+
|
||||
|
@ -2172,7 +2172,7 @@ index c60e1fc1cad1b9889a508602df84840723b7b966..baf0887ec941533f8007f2c7f7ab78f1
|
|||
+ * @throws IllegalArgumentException if dyeColor is null
|
||||
+ * @throws IllegalArgumentException if lines is non-null and has a length less than 4
|
||||
+ */
|
||||
+ default void sendSignChange(@NotNull Location loc, @Nullable java.util.List<net.kyori.adventure.text.Component> lines, @NotNull DyeColor dyeColor) throws IllegalArgumentException {
|
||||
+ default void sendSignChange(@NotNull Location loc, @Nullable java.util.List<? extends net.kyori.adventure.text.Component> lines, @NotNull DyeColor dyeColor) throws IllegalArgumentException {
|
||||
+ this.sendSignChange(loc, lines, dyeColor, false);
|
||||
+ }
|
||||
+
|
||||
|
@ -2193,7 +2193,7 @@ index c60e1fc1cad1b9889a508602df84840723b7b966..baf0887ec941533f8007f2c7f7ab78f1
|
|||
+ * @throws IllegalArgumentException if dyeColor is null
|
||||
+ * @throws IllegalArgumentException if lines is non-null and has a length less than 4
|
||||
+ */
|
||||
+ default void sendSignChange(@NotNull Location loc, @Nullable java.util.List<net.kyori.adventure.text.Component> lines, boolean hasGlowingText) throws IllegalArgumentException {
|
||||
+ default void sendSignChange(@NotNull Location loc, @Nullable java.util.List<? extends net.kyori.adventure.text.Component> lines, boolean hasGlowingText) throws IllegalArgumentException {
|
||||
+ this.sendSignChange(loc, lines, DyeColor.BLACK, hasGlowingText);
|
||||
+ }
|
||||
+
|
||||
|
@ -2215,7 +2215,7 @@ index c60e1fc1cad1b9889a508602df84840723b7b966..baf0887ec941533f8007f2c7f7ab78f1
|
|||
+ * @throws IllegalArgumentException if dyeColor is null
|
||||
+ * @throws IllegalArgumentException if lines is non-null and has a length less than 4
|
||||
+ */
|
||||
+ void sendSignChange(@NotNull Location loc, @Nullable java.util.List<net.kyori.adventure.text.Component> lines, @NotNull DyeColor dyeColor, boolean hasGlowingText)
|
||||
+ void sendSignChange(@NotNull Location loc, @Nullable java.util.List<? extends net.kyori.adventure.text.Component> lines, @NotNull DyeColor dyeColor, boolean hasGlowingText)
|
||||
+ throws IllegalArgumentException;
|
||||
+ // Paper end
|
||||
+
|
||||
|
@ -4069,7 +4069,7 @@ index 94852d50e88d0594b84b581cd627174043629995..36bcbb3f3acedf7ebecbf6f6b358cf64
|
|||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||
index 2fbb0b7640dd9b9b0e70d4bc60fbb0310d5ec250..64114b1a9e201df369fc794fbee984d496385420 100644
|
||||
index 2fbb0b7640dd9b9b0e70d4bc60fbb0310d5ec250..7476bfb8f26ce541cd10feaaeaf0f9b17e46bee8 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java
|
||||
@@ -31,6 +31,24 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste
|
||||
|
@ -4136,7 +4136,7 @@ index 2fbb0b7640dd9b9b0e70d4bc60fbb0310d5ec250..64114b1a9e201df369fc794fbee984d4
|
|||
+ *
|
||||
+ * @param lore the lore to set
|
||||
+ */
|
||||
+ void lore(final @Nullable List<net.kyori.adventure.text.Component> lore);
|
||||
+ void lore(final @Nullable List<? extends net.kyori.adventure.text.Component> lore);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
|
|
|
@ -5,7 +5,7 @@ Subject: [PATCH] ItemStack API additions for quantity/flags/lore
|
|||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
index 53d99d214652ae1636f28a179a5b66edc0f8f229..a70de962712c14cb895708e89ad3811041728935 100644
|
||||
index 53d99d214652ae1636f28a179a5b66edc0f8f229..1907b8cfb4a78415fba8d5445ba98a6208516fd9 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
||||
@@ -3,6 +3,7 @@ package org.bukkit.inventory;
|
||||
|
@ -139,7 +139,7 @@ index 53d99d214652ae1636f28a179a5b66edc0f8f229..a70de962712c14cb895708e89ad38110
|
|||
+ *
|
||||
+ * @param lore the lore that will be set
|
||||
+ */
|
||||
+ public void lore(@Nullable List<net.kyori.adventure.text.Component> lore) {
|
||||
+ public void lore(@Nullable List<? extends net.kyori.adventure.text.Component> lore) {
|
||||
+ ItemMeta itemMeta = getItemMeta();
|
||||
+ if (itemMeta == null) {
|
||||
+ throw new IllegalStateException("Cannot set lore on " + getType());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue