But could this work? PHP: public function onChat(PlayerChatEvent $event){$p = $event->getPlayer(); If($event->getMessage() === 2){ $p->kick(); return true;}}
Of course no... $event->getMessage() only returns the message. PHP: private $last=[];public function onChat(PlayerChatEvent $e){ $player=$event->getPlayer(); $playerId=$player->getId(); // an identifier just for that player if(isset($this->last[$playerId]) and microtime(true)-$this->last[$playerId] < 0.5){ // if this is not the first message the player chatted, and the last message was sent less than 0.5 second ago $event->setCancelled(); $player->kick(); return; } $this->last[$playerId]=microtime(true); // save the current time as the time the player last chatted} Remember to unset the data when the player quits, or the memory will accumulate and overload.