Allows you to display your item in chat
8

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 {[email protected]} 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 {[email protected]}).

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.

Metrics

This plugin uses bStats, which can collect data about your server. This data is in no way intrusive, is completely anonymized, and has a negligible impact on server performance, so there is no reason whatsoever not to enable it. Knowing my plugins are actively used is what keeps me developing. Please consider enabling metrics globally or for this plugin specifically in the metrics section in global.conf. A list of collected data can be found here.

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.

Support

Appreciate tools like this? Wish there were more? Consider donating!

Category: Chat

Published on Jun 9, 2017

5073 views

8 stars

watchers

1,093 total downloads

Licensed under MIT

Promoted Versions

Pages

Members