I tried this: PHP: $d = $this->plugin->stats->get($name)["deaths"]; var_dump($d); $d1 = $d + 1; $this->plugin->stats->set($name["deaths"], $d1); But there is an error on the last line. How would I properly set it?
This should work PHP: $stats = $this->plugin->stats->get($name);var_dump($stats);$stats["deaths"] += 1;$this->plugin->stats->set($name, $stats); Edit: also this PHP: $this->plugin->stats->setNested("$name.deaths", $this->plugin->stats->getNested("$name.deaths") + 1);
I do this: PHP: public function onEnable(){$this->players = (new Config($this->getDataFolder()."players.yml", Config::YAML))->getAll(); // Load config in array}public function onDisable(){$this->players = new Config($this->getDataFolder()."players.yml", Config::YAML) // Save array in config.}public function addDeath($player){$name = ($player instanceof Player ? $player->getName() : $player);if(isset($this->players[$name]['deaths'])){$this->players[$name]['deaths']++;return true;}return false}