I have this autoclicker detector, the detector works fine there is nothing wrong with the actual detection but when the plugin is on the server pvp is disabled. The pvp doesnt enable at all I dont know what it is but 100% it is the plugin any help. Here is the only code for the plugin. please try and help me figure out why it doesnt enable pvp when on PHP: <?phpdeclare(strict_types=1);namespace anticheat;use pocketmine\event\entity\EntityDamageByEntityEvent;use pocketmine\event\entity\EntityDamageEvent;use pocketmine\event\Listener;use pocketmine\Player;class AntiCheatListener implements Listener{ private $plugin; //AutoClicker AntiCheat. public $hits = []; public $timer = []; public function __construct(AntiCheat $plugin){ $plugin->getServer()->getPluginManager()->registerEvents($this, $plugin); $this->plugin = $plugin; } public function handleDamage(EntityDamageEvent $event){ if($event instanceof EntityDamageByEntityEvent){ $damager = $event->getDamager(); if($damager instanceof Player){ $name = $damager->getName(); if(isset($this->hits[$name])){ if(!isset($this->timer[$name]) or time() > $this->timer[$name]){ $this->timer[$name] = time() + $this->getConfig("autoclicker", "timer"); $this->hits[$name] = 0; }else{ $this->hits[$name] = $this->hits[$name] + 1; } }else{ $this->hits[$name] = 0; } if($this->hits[$name] >= $this->getConfig("autoclicker", "max-hits")){ unset($this->hits[$name]); $damager->kick((string)$this->getConfig("autoclicker", "kick-message"), false); } } if(!$damager->canInteract($event->getEntity(), $this->getConfig("max-reach"))){ $event->setCancelled(true); } } } //makes my life easier lol private function getConfig(string $key, $key2 = ""){ return $this->plugin->config->get($key)[$key2]; }}
Your canInteract() function is probably incorrect and causing the if statement to always return true, which in-turn cancels pvp