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

[Solved] Config Help...

Discussion in 'Development' started by BEcraft, Mar 9, 2017.

  1. BEcraft

    BEcraft Slime

    Messages:
    79
    GitHub:
    BEcraft
    Hello, I'm having little problem with a config, well problem is that when i try to pick up any value from config it doesn't show anthing neither give any error on console..
    How I set the config:
    PHP:
    $config = new Config($this->getDataFolder().$player->getName().".yml"Config::YAML);
    $config->set("Datos", array($player->getName(), $player->getClientId(), $player->getAddress(), $reason));
    $config->save();
    Function where show the value:
    PHP:
    public function onBanned(PlayerPreLoginEvent $event){
        
    $player $event->getPlayer();
        if(
    $player->isBanned() and file_exists($this->getDataFolder().$player->getName().".yml")){
        
    $config = new Config($this->getDataFolder().$player->getName().".yml"Config::YAML);
        
    $datos $config->get("Datos");
        
    $event->setKickMessage("§cSorry Mr §a".$player->getName()."§c You are banned from this server,\n§eName: §7".$datos[0]."\n§eReason: §7".$datos[3]);
        
    $event->setCancelled(true);
        }else{
            }
        }
    Config:
    Code:
    ---
    Datos:
    - BEcraft
    - //client id
    - //ip
    - 'You have been banned '
    ...
    
    But it shows message like this
     

    Attached Files:

  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Do var_dump($datos) and post the output.
     
  3. BEcraft

    BEcraft Slime

    Messages:
    79
    GitHub:
    BEcraft
    Ummm I created new folder and transferred all files to another one and gave a new name and mysteriously it's working fine right now... By the way here its var_dump:

    Code:
    array(4) {
      [0]=>
      string(7) "BEcraft"
      [1]=>
      float(7.17355118888513716E+18)
      [2]=>
      string(9) "0.0.0.0"
      [3]=>
      string(21) "you have been banned "
    }
    
     
    Last edited: Mar 9, 2017
  4. BEcraft

    BEcraft Slime

    Messages:
    79
    GitHub:
    BEcraft
    Message:
     

    Attached Files:

  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.