pocketmine\utils\Config::set PHP Method

set() public method

public set ( string $k, mixed $v = true )
$k string key to be set
$v mixed value to set key
    public function set($k, $v = true)
    {
        $this->config[$k] = $v;
        foreach ($this->nestedCache as $nestedKey => $nvalue) {
            if (substr($nestedKey, 0, strlen($k) + 1) === $k . ".") {
                unset($this->nestedCache[$nestedKey]);
            }
        }
    }

Usage Example

Exemplo n.º 1
2
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $sub)
 {
     @mkdir($this->getServer()->getDataPath() . "/plugins/! DeBePlugins/");
     $korean = new Config($this->getServer()->getDataPath() . "/plugins/! DeBePlugins/" . "! Korean.yml", Config::YAML, ["Korean" => false]);
     if ($korean->get("Korean")) {
         $korean->set("Korean", false);
         $m = "설정";
     } else {
         $korean->set("Korean", true);
         $m = "해제";
     }
     $sender->sendMessage("[Korean] 한국말 {$m}");
     $korean->save();
     return true;
 }
All Usage Examples Of pocketmine\utils\Config::set