I'm trying to create god mode plugin, the god mode enabled and disabled message is shown but I'm still taking damage My code : In main : PHP: public function onHurt(EntityDamageEvent $hurt){ $hurted = $hurt->getEntity(); if(isset($this->god[$hurted->getName()])){ $hurt->setCancelled(true); } } In commands\godcmd : PHP: class GodCmd extends PluginCommand { public $god = []; public function __construct(string $name, LytraSystem $plugin){ parent::__construct($name, $plugin); $this->setDescription("Toggle god mode"); $this->plugin = $plugin; } public function execute(CommandSender $sender, string $alias, array $args) : bool{ if(!$sender->hasPermission("godmode.toggle")){ $sender->sendMessage("No perm!"); return false; } if(!$sender instanceof Player){ $sender->sendMessage("§cConsole cant use this command"); return false; } if(isset($this->god[$sender->getName()])){ unset($this->god[$sender->getName()]); $sender->sendMessage("§cGod mode has been disabled"); return true; } else { $this->god[$sender->getName()] = $sender->getName(); $sender->sendMessage("§bGod mode has been enabled"); return true; } }}