I want to do check when player send command for example /blabla , but command doesn't exist and then I want to cancel sending.. Is this possible?????????
PHP: public function rjdjdjf(PlayerCommandPreprocessEvent $e){ if($e->getMessage() == "/unknowncommand"){ $e->setCancelled();}} For some reason it don't work
1. What command did you type 2. Did you make sure to register the class as a listener 3. Did you make sure the function was called at all? maybe using an echo statement
/unknowncommand isn't a command therefore PlayerCommandPreprocessEvent won't be triggered. try PlayerChatEvent instead.