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:
JOO200 2023-03-20 09:18:06 +01:00 committed by GitHub
parent 7929540ba3
commit ff603cb76d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 17 deletions

View file

@ -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());