geforkt von Mirrors/Paper
89d51d5f29
Because this exploit has been widely known for years and has not been fixed by Mojang, we decided that it was worth allowing people to toggle it on/off due to how easy it is to make it configurable. It should be noted that this decision does not promise all future exploits will be configurable.
53 Zeilen
2.8 KiB
Diff
53 Zeilen
2.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: ysl3000 <yannicklamprecht@live.de>
|
|
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 71db89105c70cb70726fb6a732b899297aeee82a..12f90520e4d6d5fcea0c2f8e19dad9102970cd99 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
|
|
@@ -527,4 +527,41 @@ 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) {
|
|
+ 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
|
|
}
|