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

set armor

Comments in 'Plugin Development' started by xiaoq, Mar 1, 2015.

  1. xiaoq
    Offline

    xiaoq Active Member

    Joined:
    Dec 23, 2014
    Posts:
    232
    Minecraft User:
    xiaoq
    How to set the Armor?
    --
    $player->getInventory()->setHelmet(Item::get(item id));
    $player->getInventory()->setChestplate(Item::get(item id));
    $player->getInventory()->setLeggings(Item::get(item id));
    $player->getInventory()->setBoots(Item::get(item id));
    $player->getInventory()->sendArmorContents($player);

    or

    $player->getInventory()->setHelmet(new Item(item id));
    $player->getInventory()->setChestplate(new Item(item id));
    $player->getInventory()->setLeggings(new Item(item id));
    $player->getInventory()->setBoots(new Item(item id));
    $player->getInventory()->sendArmorContents($player);
    hoyinm14mc likes this.
  2. LDX
    Offline

    LDX Notable Member Plugin Developer

    Joined:
    Oct 2, 2013
    Posts:
    1,397
    Plugins:
    14
    Either one works.
  3. xiaoq
    Offline

    xiaoq Active Member

    Joined:
    Dec 23, 2014
    Posts:
    232
    Minecraft User:
    xiaoq
    THX
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Always use Item::get(). Otherwise PocketMine may not function properly with some item clicks.
    Tethered_, LDX and Falk like this.

Share This Page

Advertisement