I'm working on a mini-game and I am working on a custom name feature. I have it so that it makes the player open an anvil inventory and it automatically put a piece of paper to rename to what they want their new name to be, My issue is that I'm using InventoryClickEvent and when I click the output item in the inventory it clears it and resets it to how I had the anvil before they changed the name. I just want to be able to grab the name of the item or some way of getting what they are renaming it to. I'm using this[The code below] to see what the item is and it is returning null in chat. Code (Text): ItemStack clicked = clickedInv.getItem(2); p.sendMessage("" + clicked); Is there any sort of event that triggers upon using the anvil or something?
I had this very problem a long time ago. I'm not too sure if it still applies, but AFAIK there isn't good support for anvil GUIs, I ended up using an external API for it, which used NMS. I used an adapted version of this: https://gist.github.com/frostythedev/95b5d494a1697ad4a0a4 You would have to update the NMS yourself, as I think that was made for 1.7. Again, I'm not sure if there is a better way, this is just the only way I know of.