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

Solved Gave me Wrong Item

Discussion in 'Development' started by xXNiceAssassinlo YT, Dec 15, 2017.

  1. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    Config:
    PHP:
    #CrateUI PocketMine-MP and PMMP
    authorxXNiceAssasinl0Az928

    #Do Not Remove " Lines


    #Prefix For Crates
    Prefix"§7(§4§l!§r§7)"

    #Items For Crates
    Common:
       
    Item-11:0
    Code:

    Use:

    PHP:
    use pocketmine\item\Item;
    use 
    pocketmine\item\ItemFactory;
    use 
    pocketmine\utils\Config;
    use 
    pocketmine\inventory\Inventory;
    Code For Item:

    PHP:
    $this->cfg $this->getConfig();
    $inv $sender->getInventory();
    $item1 ItemFactory::fromString($this->cfg->getNested("Common.Item-1"));
    $inv->addItem($item1);
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    I'm pretty sure it needs to be in string as such:
    Code:
    #Items For Crates
    Common:
       Item-1: "1:0"
    
    Y.A.M.L.
     
    OnTheVerge likes this.
  3. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    Thx
     
  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.