Solved Get an item slot in custom inventory

Discussion in 'Plugin Development' started by MordorKing78, Jul 2, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    MordorKing78

    I want to create if you type a command you can put a weapon in a slot and then select the enchantment. But how would I check if that item is in the inventory?

    noone?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 10, 2016
  2. @MordorKing78 Get an instance of that inventory and check if it contains that weapon.
     
  3. Offline

    MordorKing78

    @CodePlaysMinecraft I just want to check what weapon is on eg slot 4 and then add a enchantment to it

    how woudl I do that?
     
    Last edited: Jul 2, 2015
  4. @MordorKing78 Inventory.getItem(int slot) returns an ItemStack. So what I would do is to create a new ItemStack, add the enchantment, and set it to the original slot it was in.
     
    MordorKing78 likes this.
  5. Offline

    MordorKing78

    Thanks, m8. I'll give it a shot! ;)
     
Thread Status:
Not open for further replies.

Share This Page