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

Config Error

Discussion in 'Development' started by xXNiceAssassinlo YT, Apr 19, 2018.

  1. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    PHP:
                $itemscfg $this->getMain()->getItemCfg()->getNested("common.items");
                
    $randomitem $itemscfg[array_rand($itemscfg)];
                
    $values explode(":"$randomitem);
                
    $item Item::get(intval($values[0]), intval($values[1]), intval($values[2]));
                
    $item->setCustomName($values[4]);
    err:
    PHP:
    Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'FormAPI v1.1'Undefined offset3 on jojoe77777\FormAPI\FormAPI
    [06:55:21] [Server thread/CRITICAL]: ErrorException"Undefined offset: 3" (EXCEPTIONin "CrateSystem-master/src/CrateSystem/crates/CrateManager" at line 54
    config:
    Code:
    common:
      items:
        - "1:1:1"
        - "2:2:2:Common"
    i dont want name on first one
     
  2. Daniktheboss

    Daniktheboss Baby Zombie

    Messages:
    144
    GitHub:
    daniktheboss
    It should be
    PHP:
    $item->setCustomName($values[3]);
     
  3. TwistedAsylumMC

    TwistedAsylumMC Slime

    Messages:
    96
    GitHub:
    twistedasylummc
    This, also add an if statement to check if there is a custom name in config
     
  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.