Hi, does anyone know how to create that if someone with permission exclusiveemotes.item will type in chat :item: it will replace the text by an item the user holds in his hand and if someone hover over it will show the description of the item? Like it is shown in the picture. -Richard37
Use chat components and HoverAction.SHOW_ITEM to show items in chat. Listen to chat events, check if the message contains :item: and the player has sufficient permissions, then cancel the event and broadcast the chat components
Thank you but I still do not understand how can I replace :item: by item that user holds in his hand.
String.replace if you are up to java 8 or StringUtils.replace from Apache’s API (Java’s one is slower)
I have this: Code (Java): public class ItemReplacement implements Listener { @EventHandler public void onItemSend(AsyncPlayerChatEvent e){ String newMessage = e.getMessage().replace(":item:" , ); }