Sporech
Sporech

Reputation: 35

How do you return the slot a player has selected

In bukkit, I need a method that can return what hotkey a player has selected. I can't find a way to do this, the bukkit api doesn't have anything along those lines, is there another api that does include this?

Upvotes: 1

Views: 2054

Answers (1)

ColonelHedgehog
ColonelHedgehog

Reputation: 460

What you want to do get the held item slot:

int itemSlot = Player.getInventory().getHeldItemSlot();

Keep in mind, the held item slot is an index. This means that slot #1 is 0, and slot #2 is 1, and so on.

Upvotes: 2

Related Questions