1.16.5 Checking selected item in Inventory

Discussion in 'Spigot Plugin Development' started by brentspine, Jun 29, 2021.

  1. Hi, how do i get an item selected in an players inventory, like this:
    upload_2021-6-29_10-49-41.png ?

    Also any quick idea how to make an elytra auto remove itself after x seconds?
  2. What do you mean "selected in an players inventory"? The item the player has selected in their hotbar or the item they currently have on their cursor?

    Also for the Elytra you need to build an armor equip event, and after checking that the equip item is an Elytra you run a delayed task to remove it.
    But you also have to make sure that if the player changes the item in the chest slot before the removal that you cancel the task (so you don't accidentally remove a different item).
  3. I mean like the item the players is currently moving around in the inventory and has no slot
  4. I have no idea what item that is since you're using BadLion launcher and that is not something vanilla, so I have no idea if that's even possible - I suggest you ask in BadLion's forums.
    If, like I asked, it's the item the player is currently moving around as in has on their cursor then just use "player.getCursor()".
    • Useful Useful x 1