mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@acc6d01 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9861) PaperMC/Paper@b974a6b Update paperweight to 1.5.9 (#9872)
45 lines
2.0 KiB
Diff
45 lines
2.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Meln Cat <melncatuwu@gmail.com>
|
|
Date: Mon, 2 Oct 2023 17:42:19 -0700
|
|
Subject: [PATCH] Add hover lines API
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
|
index 1c4e0c7356047163a38f5ac4dd544129d0b36271..5e64f172508d928b6d74796a942ecc1077665b7b 100644
|
|
--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
|
|
+++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
|
|
@@ -299,4 +299,14 @@ public interface ItemFactory {
|
|
@Deprecated
|
|
net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull org.bukkit.entity.Entity entity, @NotNull net.md_5.bungee.api.chat.BaseComponent[] customName);
|
|
// Paper end - bungee hover events
|
|
+
|
|
+ // Purpur start
|
|
+ /**
|
|
+ * Returns the lines of text shown when hovering over an item
|
|
+ * @param itemStack The ItemStack
|
|
+ * @param advanced Whether advanced tooltips are shown
|
|
+ * @return the list of Components
|
|
+ */
|
|
+ @NotNull java.util.List<net.kyori.adventure.text.@NotNull Component> getHoverLines(@NotNull ItemStack itemStack, boolean advanced);
|
|
+ // Purpur end
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
index c733206b769d7a55076d863757fcac1a129033b7..ed168cba3692f55ac976c6ef31525e83ae36f5f9 100644
|
|
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
@@ -1638,5 +1638,14 @@ public class ItemStack implements Cloneable, ConfigurationSerializable, Translat
|
|
}
|
|
return random.nextInt(unbreaking + 1) > 0;
|
|
}
|
|
+
|
|
+ /**
|
|
+ * Returns the lines of text shown when hovering over the item
|
|
+ * @param advanced Whether advanced tooltips are shown
|
|
+ * @return the list of Components
|
|
+ */
|
|
+ public @NotNull List<net.kyori.adventure.text.@NotNull Component> getHoverLines(boolean advanced) {
|
|
+ return Bukkit.getItemFactory().getHoverLines(this, advanced);
|
|
+ }
|
|
// Purpur end
|
|
}
|