public function isSpectator() : bool
{
return $this->gamemode === 3;
}
/** * Clear players inventory * @param Player $target */ public static function clearInventory(Player $target) { if ($target->isCreative() || $target->isSpectator()) { return; } $target->getInventory()->clearAll(); }