@@ -82,6 +82,7 @@ public void sendItemHologramChat(@NotNull Player player, @NotNull String text, @
8282 try {
8383 String json = ReflectFactory .convertBukkitItemStackToJson (itemStack );
8484 ComponentBuilder builder = new ComponentBuilder ();
85+ builder .event (new HoverEvent (HoverEvent .Action .SHOW_ITEM , new ComponentBuilder (json ).create ()));
8586 TextSplitter .SpilledString spilledString = TextSplitter .deBakeItem (text );
8687 if (spilledString == null ) {
8788 Util .debugLog ("Spilled string is null" );
@@ -92,7 +93,6 @@ public void sendItemHologramChat(@NotNull Player player, @NotNull String text, @
9293 builder .append (spilledString .getComponents ()).color (color );
9394 builder .appendLegacy (spilledString .getRight ()).color (color );
9495 }
95- builder .event (new HoverEvent (HoverEvent .Action .SHOW_ITEM , new ComponentBuilder (json ).create ()));
9696 BaseComponent [] components = builder .create ();
9797 Util .debugLog ("Sending debug: " + ComponentSerializer .toString (components ));
9898 player .spigot ().sendMessage (components );
@@ -111,14 +111,15 @@ public void sendItemHologramChat(@NotNull Player player, @NotNull String text, @
111111 return new QuickComponentImpl (errorComponent );
112112 }
113113 ComponentBuilder builder = new ComponentBuilder ();
114+ builder .event (new HoverEvent (HoverEvent .Action .SHOW_ITEM , new ComponentBuilder (json ).create ()));
114115 TextSplitter .SpilledString spilledString = TextSplitter .deBakeItem (message );
115116 if (spilledString == null ) {
116117 builder .appendLegacy (message );
117118 } else {
118119 builder .appendLegacy (spilledString .getLeft ());
119120 net .md_5 .bungee .api .ChatColor color = builder .getCurrentComponent ().getColorRaw ();
120121 builder .append (spilledString .getComponents ()).color (color );
121- builder .appendLegacy (spilledString .getRight ()).color (color );
122+ builder .reset (). appendLegacy (spilledString .getRight ()).color (color );
122123 }
123124
124125 builder .appendLegacy (" " ).appendLegacy (plugin .text ().of (player , "menu.preview" ).forLocale ());
@@ -130,7 +131,6 @@ public void sendItemHologramChat(@NotNull Player player, @NotNull String text, @
130131 "/qs silentpreview {0}" ,
131132 shop .getRuntimeRandomUniqueId ().toString ())));
132133 }
133- builder .event (new HoverEvent (HoverEvent .Action .SHOW_ITEM , new ComponentBuilder (json ).create ()));
134134 return new QuickComponentImpl (builder .create ());
135135 } catch (Throwable t ) {
136136 plugin .getLogger ().log (Level .WARNING , "Failed to process chat component" , t );
0 commit comments