aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--LICENSE.md1
-rw-r--r--Spigot-API-Patches/Create-HoverEvent-from-ItemStack-Entity.patch65
-rw-r--r--Spigot-Server-Patches/Create-HoverEvent-from-ItemStack-Entity.patch51
3 files changed, 117 insertions, 0 deletions
diff --git a/LICENSE.md b/LICENSE.md
index 45eb8cd666..5512fb7a4f 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -42,4 +42,5 @@ rickyboy320 <[email protected]>
DoNotSpamPls <[email protected]>
Josh Roy <[email protected]>
```
diff --git a/Spigot-API-Patches/Create-HoverEvent-from-ItemStack-Entity.patch b/Spigot-API-Patches/Create-HoverEvent-from-ItemStack-Entity.patch
new file mode 100644
index 0000000000..a643a9e5ed
--- /dev/null
+++ b/Spigot-API-Patches/Create-HoverEvent-from-ItemStack-Entity.patch
@@ -0,0 +1,65 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: ysl3000 <[email protected]>
+Date: Mon, 6 Jul 2020 22:17:37 +0200
+Subject: [PATCH] Create HoverEvent from ItemStack Entity
+
+
+diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java
+index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
+--- a/src/main/java/org/bukkit/inventory/ItemFactory.java
++++ b/src/main/java/org/bukkit/inventory/ItemFactory.java
+@@ -0,0 +0,0 @@ public interface ItemFactory {
+ */
+ @Nullable
+ String getI18NDisplayName(@Nullable ItemStack item);
++
++ /**
++ * Creates a {@link net.md_5.bungee.api.chat.hover.content.Content} of that ItemStack for displaying.
++ *
++ * @param itemStack
++ * @return the {@link net.md_5.bungee.api.chat.hover.content.Content} of that ItemStack
++ */
++ @NotNull
++ net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull ItemStack itemStack);
++
++ /**
++ * Creates a {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity} for displaying.
++ * Uses the display name of the entity, if present.
++ *
++ * @param entity Entity to create the HoverEvent for
++ * @return the {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity}
++ */
++ @NotNull
++ net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull org.bukkit.entity.Entity entity);
++
++ /**
++ * Creates a {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity} for displaying.
++ *
++ * @param entity Entity to create the HoverEvent for
++ * @param customName a custom name that should be displayed, if not passed entity name will be displayed
++ * @return the {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity}
++ */
++ @NotNull
++ net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull org.bukkit.entity.Entity entity, @Nullable String customName);
++
++ /**
++ * Creates a {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity} for displaying.
++ *
++ * @param entity Entity to create the HoverEvent for
++ * @param customName a custom name that should be displayed, if not passed entity name will be displayed
++ * @return the {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity}
++ */
++ @NotNull
++ net.md_5.bungee.api.chat.hover.content.Content hoverContentOf(@NotNull org.bukkit.entity.Entity entity, @Nullable net.md_5.bungee.api.chat.BaseComponent customName);
++
++ /**
++ * Creates a {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity} for displaying.
++ *
++ * @param entity Entity to create the HoverEvent for
++ * @param customName a custom name that should be displayed, if not passed entity name will be displayed
++ * @return the {@link net.md_5.bungee.api.chat.hover.content.Content} of that {@link org.bukkit.entity.Entity}
++ */
++ @NotNull
++ 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
+ }
diff --git a/Spigot-Server-Patches/Create-HoverEvent-from-ItemStack-Entity.patch b/Spigot-Server-Patches/Create-HoverEvent-from-ItemStack-Entity.patch
new file mode 100644
index 0000000000..35083eee90
--- /dev/null
+++ b/Spigot-Server-Patches/Create-HoverEvent-from-ItemStack-Entity.patch
@@ -0,0 +1,51 @@
+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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
+--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+@@ -0,0 +0,0 @@ public final class CraftItemFactory implements ItemFactory {
+
+ return nms != null ? net.minecraft.server.LocaleLanguage.getInstance().translateKey(nms.getItem().getName()) : null;
+ }
++
++ @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
+ }