1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

setArmorContents()

Discussion in 'Development' started by WreckagePE / ZAYD, Apr 1, 2017.

  1. WreckagePE / ZAYD

    WreckagePE / ZAYD Slime

    Messages:
    82
    So, I was adding enchants to my Kohi 1vs1 duel plugin. Here is code w/o enchants;

    PHP:
            $player->getInventory()->setHelmet(Item::get(31001));
            
    $player->getInventory()->setChestplate(Item::get(31101));
            
    $player->getInventory()->setLeggings(Item::get(31201));
            
    $player->getInventory()->setBoots(Item::get(31301));
            
    $player->getInventory()->sendArmorContents($player);
    This worked fine, with $player in the brackets of sendArmorContents... But now;
    PHP:
    $enchantment Enchantment::getEnchantment(0);
            
    $enchantment->setLevel(1);
            
    $helmet Item::get(310,0,1);
            
    $chestplate Item::get(311,0,1);
            
    $leggings Item::get(312,0,1);
            
    $boots Item::get(313,0,1);
            
    $helmet->addEnchantment($enchantment);
            
    $chestplate->addEnchantment($enchantment);
            
    $leggings->addEnchantment($enchantment);
            
    $boots->addEnchantment($enchantment);
         
    $player->getInventory()->setHelmet($helmet);
            
    $player->getInventory()->setChestplate($chestplate);
            
    $player->getInventory()->setLeggings($leggings);
            
    $player->getInventory()->setBoots($boots);
            
    $player->getInventory()->sendArmorContents($helmet,$chestplate,$leggings,$boots);
    It only gives the armour and contents to one of the players, I would be really grateful if someone helped me. :£
     
  2. Irish

    Irish Baby Zombie

    Messages:
    156
    GitHub:
    irishpacks
    PHP:
    $player->getInventory()->setArmorContents([$helmet$chestplate$leggings$boots]);
    $player->getInventory()->sendArmorContents($player);
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.