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

Object of class pocketmine\utils\Config could not be converted to string"

Discussion in 'Plugin Help' started by Ali26, Dec 25, 2019.

  1. Ali26

    Ali26 Creeper

    Messages:
    3
    Object of class pocketmine\utils\Config could not be converted to string"

    Main.php
    PHP:
    $pconfig = new Config($this->getDataFolder()."players/".strtolower($event->getPlayer()->getName()).".yml"Config::YAML, array());
            
    $player $event->getPlayer();
          
            foreach(
    $this->$pconfig->get('farmer-lvl' or 'bucheron-lvl' or 'alchimiste-lvl' or 'miner-lvl') as $id => $array) {
     
    Config.yml
    PHP:
    313#id item
      
    damage0
      need
    -lvl#level for unlock craft
      
    job"bucheron-lvl"
      
    message"§aYou can't craft this because you are not level 5" #set error message when your level is <"
     
  2. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    What the hell are you trying to do here?
     
  3. Provsnoobgaming

    Provsnoobgaming Baby Zombie

    Messages:
    134
    GitHub:
    provsalt
    he is trying to make a xy problem
     
  4. Ali26

    Ali26 Creeper

    Messages:
    3
    I want to get all job in config of a player
     
  5. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    What does the player's yml file look like? Or is that the config.yml in your post?
     
  6. Ali26

    Ali26 Creeper

    Messages:
    3
    aPlayer.yml
    PHP:
    ---
    miner-xp1
    bucheron
    -xp1
    alchimiste
    -xp1
    farmer
    -xp1
    bucheron
    -lvl1
    farmer
    -lvl1
    alchimiste
    -lvl1
    miner
    -lvl1
    ...
    I want to make this config.yml:
    Code:
    ---
    
    313: #id item
      damage: 0
      need-lvl: 5 #level for unlock craft
      job: "bucheron-lvl"
      message: "§aYou can't craft this because you are not level 5" #set error message when your level is < 
    
    ...
     
  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.