PHP: if($e->getDamage() >= $player->getHealth()){ $e->setCancelled(); if($combat->getLogging()->inCombat($player)){ $lasthit = $combat->getLogging()->getLastHitter($player); $last = $this->plugin->getServer()->getPlayerExact($lasthit); if($last == null){ $combat->getSlay()->processSuicide($player); }else{ $combat->getSlay()->processKill($last, $player); } }else{ $combat->getSlay()->processSuicide($player); }} $lasthit is the last person to hit a player in combat mode. functions for that: PHP: public function setCombat(Player $player, Player $damager){ $this->logging[strtolower($player->getName())] = [time(),$damager->getName()]; } public function getLastHitter(Player $player){ return $this->plugin->getServer()->getPlayerExact($this->logging[strtolower($player->getName())][1]); } $last keeps returning null.. Am I doing something wrong? I just don't see what the issue is.. Maybe I'm blind.
PHP: public function getLastHitter(Player $player){ return $this->plugin->getServer()->getPlayerExact($this->logging[strtolower($player->getName())][1]); } This returned a Player object, not a string like used here: PHP: $lasthit = $combat->getLogging()->getLastHitter($player); $last = $this->plugin->getServer()->getPlayerExact($lasthit);