Solved Displaying ItemStack in chat using kyori.adventure HoverEvent

Discussion in 'Plugin Development' started by Terra_Miner, Jul 7, 2023.

Thread Status:
Not open for further replies.
  1. Offline

    Terra_Miner

    Previously, using md5 it was possible to display the ItemStack via NMS in chat, but today, this method is deprecated. Is there a way to display an ItemStack using kyori.adventure HoverEvent?
     
    Last edited: Jul 7, 2023
  2. Offline

    timtower Administrator Administrator Moderator

  3. Offline

    Terra_Miner

    yes, sorry, my bad
     
  4. Offline

    timtower Administrator Administrator Moderator

  5. Offline

    Terra_Miner

    sure, but i found this,

    Code:
    Key key = Key.key(item.translationKey())
    
    String nms = CraftItemStack.asNMSCopy(item).v().toString()
    
    hoverEvent(HoverEvent.showItem(key, amount, BinaryTagHolder.binaryTagHolder(nms)))
    NMS from 1.19.4
    Code:
    compileOnly("org.spigotmc:spigot:1.19.4-R0.1-SNAPSHOT")
    compileOnly("io.papermc.paper:paper-api:1.19.4-R0.1-SNAPSHOT")
    
     
    Last edited: Jul 7, 2023
  6. Offline

    EvilWitchdoctor

    Sorry for replying to a solved thread, but I just wanted to mention (for any other adventures who come here) that this can still be done with NMS on plain craftbukkit, either by importing Kyori as a standalone library or formatting your own JSON message and sending it to player(s) with `/tellraw`
     
Thread Status:
Not open for further replies.

Share This Page