Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

certain hotbar-slot?

Comments in 'Plugin Development' started by cake23, Feb 7, 2016.

  1. cake23
    Offline

    cake23 Active Member

    Joined:
    Aug 10, 2015
    Posts:
    124
    Minecraft User:
    TheEnd
    I want to add a certain item in a certain hotbarslot, but i dont know how i can do this.
    I already try this:

    $player = $event->getPlayer();
    $item = Item::get(Item::SNOWBALL, 0, 20);
    $player->getInventory()->setHotbarSlotIndex($item, 3);

    But its not working. :/
    Can anyone help me?
    Thanks!
  2. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    PHP:
    $player->getInventory()->setHotbarSlotIndex(3$item);
    AndrewBit likes this.
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Twitter $tags?
    PocketKiller likes this.

Share This Page

Advertisement