Hi! So i want an Config where the number of the kills a player has, is saved. I tried already but my Config doesnt change and with my code, all Players have the same kill number. (I dont know how to change that) Could somebody help me? :/ https://pastebin.com/pE5yGWmQ
To save the player kill point to plugin default config: PHP: /** * Add player kill point * @param string $name Player name */ public function addKillPoint(string $name) { $this->getConfig()->setNested("$name.Kills", $this->getPlayerKills($name) + 1); $this->saveConfig(); } /** * Get player kills * @param string $name Player name * @return int Kill count */ public function getPlayerKills(string $name): int { return $this->getConfig()->getNested("$name.Kills", 0); } and the "config.yml" file will looks like: Code: --- DavyCraft648: Kills: 2 ... --- To save the player kill point to a config named "(player name).yml": PHP: /** * Get player config file * @param string $name Player name * @return Config Player Config */ public function getPlayerConfig(string $name) : Config { return new Config($this->getDataFolder()."$name.yml", Config::YAML); } /** * Add player kill point * @param string $name Player name */ public function addKillPoint(string $name) { $config = $this->getPlayerConfig($name); $config->set("Kills", $this->getPlayerKills($name) + 1); $config->save(); } /** * Get player kills * @param string $name Player name * @return int Kill count */ public function getPlayerKills(string $name): int { return $this->getPlayerConfig($name)->get("Kills", 0); } the "(player name).yml" file will looks like: Code: --- Kills: 1 ...