This is a discussion topic for the Ore project, ItemChat. View the full project on Ore for downloads and more information.
ItemChat
ItemChat is a Sponge plugin which allows you to display your currently-held item in chat.
To use, simply write {item}
as part of any chat message or command. It will be replaced with the name of the item you are holding, and if users hover over it, they can see the full item tooltip. If the item has a custom display name, it will be shown in the message instead of the item type.
If you want to use a different slot than your hand, simply type $num
after item
, where num
is the slot number. For instance, I could write {item $3}
to get the third hotbar slot.
You can also display items that donât actually exist! Simply write the NBT tag after item
, as you would in a /give
command. For example, {item {id:"minecraft:redstone",display:{Name:"Weird Dust"}}}
would display redstone with a custom name of Weird Dust
. Nonexistent items are colored differently from regular items.
If your nonexistent item NBT is too long to type in chat, you can write it in a book. Add #!
after item
to pull the NBT from the book youâre holding. You can also write a slot number after #!
if you want, to use a book from that hotbar slot. For example, {item #!3}
would pull NBT from a book in hotbar slot 3.
You can also assign custom text to it. For instance, if I were to type {item Apple}
, it would output [Apple]
regardless of what the actual item name is. However, it will be colored differently, so users without F3+H on will be able to tell the difference. This custom name goes after slot numbers and before NBT tags.
As a bonus, not only does the tooltip appear to each player in their native language, but so does the item name in chat if custom text isnât used and the item doesnât have a custom display name.
If you add @expander
after item
, where expander
is the name of an expander, then the item name in chat will be replaced with the output of the expander. Expanders are a way to make {item}
useful in different contexts from chat. For instance, I could type {item@nbt}
to say the itemâs NBT data. The other default expanders are:
nbt+tag
, which is like nbt
except the tag
tag is used,
name
which expands into the itemâs custom name,
id
which expands into the itemâs ID,
type
which expands into the auto-translated name of the item type,
count
which expands into the item quantity, data
which expands into the itemâs data value,
/give
which expands into the rest of the /give
command after the player name, and
/summon
which expands into the rest of the /summon
command (for dropped items) after the coordinates.
If you are not holding anything, or the $
slot number does not contain anything, or the #!
slot number does not contain a book, or youâre using an invalid expander, then the {item}
message will just appear normally. If you want to make a valid {item}
appear in raw form, use $
, as in ${item}
. If this should recurse, just add more $
s - one will be subtracted each time itâs evaluated.
Configuration
max-expander-size-chat
: The number of characters that an expander in chat can be (to avoid spamming. imagine someone picking up an AE drive and typing {item@nbt}
).
Permissions
itemchat.arbitrary_nbt
: Allows use of the arbitrary NBT feature. Given to everyone by default.
itemchat.bypass_expander_size
: Allows bypassing max-expander-size-chat
.
Plugin interop
Plugins can leverage the addItem
function in order to process {item}
in places besides commands and chat. Additionally, plugins can add their own expanders.
Changelog
1.0: Initial release.
1.1: Added hotbar slots, NBT, and books.
1.2: Added a permission for NBT.
1.3: Updated to API 7.
1.4: Added expanders, the ability to escape {item}
, and the ability to use {item}
in commands.
Metrics
This plugin uses bStats to collect metrics. A list of all metrics collected can be found here. This data is unobtrusive, lightweight, and completely anonymized, so there is no reason whatsoever to disable it. However, if you wish to do so anyway, simply set enabled
to false
in config/bStats/config.conf
.