So I'm making yet another plugin and I'm having problems with it (as usual). The plugin is supposed to add a number to a config every time a player votes for the server, or someone uses the command to add a vote to the player. I set up a separate config file for all of the players that have voted for the server before. But when I run the command to add a vote to the player, it doesn't do anything. It says that the I added a vote to the player, but it doesn't actually add a vote to the player. Here's some of the code: PHP: public function addVote($player){ if($this->players->get($player) == null){ $this->players->set($player, 1); $this->players->save(); }else{ $this->players->set(intval($this->players->get($player) + 1)); $this->players->save(); $rank = $this->getConfig()->get($this->players->get($player)); if($rank !== null){ if($this->getConfig()->get("AdminRank") == "false"){ $this->rankUp($player, $this->players->get($player)); }else{ if(!($this->getServer()->getPkayer($player)->isOp(true))){ $this->rankUp($player, $this->players->get($player)); } } } } } public function rankUp($player, $rank){ $newRank = $this->getPlugin()->get($rank); if($this->getConfig()->get("Plugin") == "PureChat"){ $command = "setgroup $player $newRank"; $this->getServer()->dispatchCommand(new ConsoleCommandSender, $command); }elseif($this->getConfig()->get("Plugin") == "CustomRanks"){ $command = "srank $player $newRank"; $this->getServer()->dispatchCommand(new ConsoleCommandSender, $command); }else{ $this->getLogger()->info(TextFormat::RED.$this->getConfig()->get("Plugin")." doesn't work with this plugin!"); } foreach($this->getConfig()->get("Commands") as $i){ $this->getServer()->dispatchCommand(new ConsoleCommandSender, str_replace(array("{PLAYER}","{NAME}"), array($this->getServer()->getPlayer($player),$this->getServer()->getPlayer($player)->getName()))); } } you can also find the plugin here.
https://github.com/Blubberboy333/VoteRanks/blob/master/Blubberboy333/VoteRanks/Main.php#L38 What is this line supposed to do? The second parameter is not set to anything, so I'm assuming that resets the votes. https://github.com/Blubberboy333/VoteRanks/blob/master/Blubberboy333/VoteRanks/Main.php#L45 getPkayer() ?