Solved Setting a player's selected hotbar slot

Discussion in 'Plugin Development' started by JRL1004, Jan 11, 2014.

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

    JRL1004

    So I am making a pvp minigame plugin and I was wondering how to get and set a players current hotbar slot. I have seen in some events/methods that you can get the players current hotbar slot but I never actually remember how to get it.

    My question is this: How do I get and set a player's active hotbar slot to a certain number?
     
  2. Offline

    Eballer48


    To my knowledge, you cannot. I believe it is client sided.

    However you could get whatever slot that player currently has "selected" and change the item of that slot. Theoretically giving the same effect, forcing a playing to hold a specific material.
     
  3. Offline

    AzureDev

    Simple:
    Code:java
    1. event.getPlayer().getInventory().setHeldItemSlot(4); //4 is the 5th slot, Change this to a number between 0-8
     
    XdeathringzX, JRL1004 and Eballer48 like this.
  4. Offline

    Garris0n

    Since like 1.5 it's been client <-> server.
     
  5. Offline

    XdeathringzX

  6. Offline

    JRL1004

    Can't believe I missed that. Thanks for the help!
     
  7. Offline

    AzureDev

    Welcome :)
     
Thread Status:
Not open for further replies.

Share This Page