/** * Trigger a Hack event. * * @param int $cheatType A constant from CheatType class. * @param int $severity A value that describes how severe this hack is. 0-10+ */ public function triggerDetection($cheatType, $severity) { if ($severity <= 0) { // This shouldn't happen, but in-case of bad plugins that have their own hooks! return; } NoCheatPEPlugin::getInstance()->getLogger()->debug("PlayerHackEvent: " . $this->getPlayer()->getName() . " - " . CheatType::getName($cheatType) . " VL " . $severity); $ev = new PlayerHackEvent($this->getPlayer(), $cheatType, $severity); Server::getInstance()->getPluginManager()->callEvent($ev); }
/** * @param Player $player */ public function __construct(Player $player) { $this->player = $player; // Initialise the hooks $hooks = NoCheatPEPlugin::getHooks(); if (count($hooks) > 0) { foreach ($hooks as $hookClass) { /** @var DetectionHook $hook */ $hook = new $hookClass($this); $this->hooks[] = $hook; } } }