Anvil output help

Discussion in 'Spigot Plugin Development' started by abandoncaptian, Apr 17, 2017.

  1. 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?
  2. 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:

    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.
  3. Ok thank you, I'll look into it.
  4. I'm trying to use it but I'm not understanding how.
  5. @WesJD has already made an amazing resource that fufills your specific usage. You can find it here.
    • Like Like x 1
  6. Is there any tutorial for how to use it?
  7. It's right on the GitHub link, scroll down.