:44:14] [Server thread/CRITICAL]: TypeError: "Return value of pocketmine\entity\Living::getArmorInventory() must be an instance of pocketmine\inventory\ArmorInventory, null returned" (EXCEPTION) in "src/pocketmine/entity/Living" at line 427 PHP: public static function armorsHealth($player) { if($player instanceof Player) { $l = $player->getArmorInventory()->getLeggings()->getDamage(); $b = $player->getArmorInventory()->getBoots()->getDamage(); $c = $player->getArmorInventory()->getChestplate()->getDamage(); $h = $player->getArmorInventory()->getHelmet()->getDamage(); $armorhealth = ((100 / 100) - ((($l + $b + $c + $h) / 4) / 100)) * 100; if($armorhealth !== null) return $armorhealth; } else { MTask::cancelMTask(); } } PHP: class Mtask extends Task implements Listener { public function __construct($sender) { $this->sender = $sender; } public function onRun(int $currentTick) { $sender = $this->sender; $hud = Main::$cfg->get("hud"); $hud = str_replace([ "{line}", "{health}", "{armors}", "{combatlog}"], ["\n", Main::playerHealth($sender), Main::armorsHealth($sender), Main::combatLog($sender)], $hud); $sender->sendPopup($hud); } public static function cancelMTask() { $this->getHandler()->cancel(); }} I tried some tricks to fix it but bruh, nothing is working
The Player object wasn't closed I had to check if it isn't close then cancel the task... Thx for platz1de