It took me a while to figure out (especially JSON, jesus), so I figured I should post it somewhere so people don't have to break their heads with JSON syntax.
You could make it so it replaces some placeholders in chat with it or something:
Requires Skellett and skript-mirror
Works on 1.13.2, probably needs tweaks for previous versions
You could make it so it replaces some placeholders in chat with it or something:
code_language.skript:
import:
net.md_5.bungee.api.chat.BaseComponent
net.md_5.bungee.api.chat.TextComponent
net.md_5.bungee.api.chat.TranslatableComponent
org.bukkit.Material
on rightclick:
if name of tool of player is not set:
set {_material} to Material.matchMaterial("%vanilla name of tool of player%") #get raw material from item
set {_rawName} to "%vanilla name of tool of player%"
replace every ":" in {_rawName} with "."
if {_material}.isBlock() is true: #if item is block, add "block." prefix, otherwise - "item."
set {_rawName} to "block.%{_rawName}%"
else:
set {_rawName} to "item.%{_rawName}%"
#translatable name would look like this: "block.minecraft.stone"
set {_c} to a new text component "<dark gray>[<reset>"
{_c}.addExtra(new TranslatableComponent({_rawName})) #adding translatabe component to text component of Skellett
{_c}.addExtra(new TextComponent(" <gray>x%number of tool of player%<dark gray>]"))
else: #if item has custom name
set {_c} to a new text component "<dark gray>[<reset>%name of tool of player% <gray>x%number of tool of player%<dark gray>]<reset>"
if item-nbt of tool of player is set: #if item has any nbt data, requires NBeeT
add hover event with action SHOW_ITEM with text "{""id"":""%vanilla name of tool of player%"",""Count"":1,""tag"":%item-nbt of tool of player%}" to text component {_c}
else: #if no nbt data
add hover event with action SHOW_ITEM with text "{""id"":""%vanilla name of tool of player%"",""Count"":1}" to text component {_c}
message text components {_c} to player
Requires Skellett and skript-mirror
Works on 1.13.2, probably needs tweaks for previous versions