aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0417-Create-HoverEvent-from-ItemStack-Entity.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0417-Create-HoverEvent-from-ItemStack-Entity.patch')
-rw-r--r--patches/server/0417-Create-HoverEvent-from-ItemStack-Entity.patch55
1 files changed, 55 insertions, 0 deletions
diff --git a/patches/server/0417-Create-HoverEvent-from-ItemStack-Entity.patch b/patches/server/0417-Create-HoverEvent-from-ItemStack-Entity.patch
new file mode 100644
index 0000000000..4117c384be
--- /dev/null
+++ b/patches/server/0417-Create-HoverEvent-from-ItemStack-Entity.patch
@@ -0,0 +1,55 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: ysl3000 <[email protected]>
+Date: Mon, 6 Jul 2020 22:18:04 +0200
+Subject: [PATCH] Create HoverEvent from ItemStack Entity
+
+
+diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+index 2c5037f04f79564306d3319e6489dfcf3d244d80..46a4518e25a0eaaa99b13e4fb522060974ce4ec2 100644
+--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+@@ -541,4 +541,44 @@ public final class CraftItemFactory implements ItemFactory {
+ return nms != null ? net.minecraft.locale.Language.getInstance().getOrDefault(nms.getItem().getDescriptionId(nms)) : null;
+ }
+ // Paper end - add getI18NDisplayName
++
++ // Paper start - bungee hover events
++ @Override
++ public net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(ItemStack itemStack) {
++ throw new UnsupportedOperationException("BungeeCord Chat API does not support data components");
++ /*
++ net.md_5.bungee.api.chat.ItemTag itemTag = net.md_5.bungee.api.chat.ItemTag.ofNbt(CraftItemStack.asNMSCopy(itemStack).getOrCreateTag().toString());
++ return new net.md_5.bungee.api.chat.hover.content.Item(
++ itemStack.getType().getKey().toString(),
++ itemStack.getAmount(),
++ itemTag);
++ */
++ }
++
++ @Override
++ public net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(org.bukkit.entity.Entity entity) {
++ return hoverContentOf(entity, org.apache.commons.lang3.StringUtils.isBlank(entity.getCustomName()) ? null : new net.md_5.bungee.api.chat.TextComponent(entity.getCustomName()));
++ }
++
++ @Override
++ public net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(org.bukkit.entity.Entity entity, String customName) {
++ return hoverContentOf(entity, org.apache.commons.lang3.StringUtils.isBlank(customName) ? null : new net.md_5.bungee.api.chat.TextComponent(customName));
++ }
++
++ @Override
++ public net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(org.bukkit.entity.Entity entity, net.md_5.bungee.api.chat.BaseComponent customName) {
++ return new net.md_5.bungee.api.chat.hover.content.Entity(
++ entity.getType().getKey().toString(),
++ entity.getUniqueId().toString(),
++ customName);
++ }
++
++ @Override
++ public net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(org.bukkit.entity.Entity entity, net.md_5.bungee.api.chat.BaseComponent[] customName) {
++ return new net.md_5.bungee.api.chat.hover.content.Entity(
++ entity.getType().getKey().toString(),
++ entity.getUniqueId().toString(),
++ new net.md_5.bungee.api.chat.TextComponent(customName));
++ }
++ // Paper end - bungee hover events
+ }