Hello. I want to check player message and then execute action. Code that i have does not do anything for me and there is no error in console. What is wrong? Code i got so far: PHP: foreach($this->bannedWords->getAll(true) as $bannedword) { if(stripos($message, $bannedword) !== false) { if($player->hasPermission("perm1") || $player->hasPermission("perm2") || $player->isOp()){ return false; } else { $event->setCancelled(true); if($this->getConfig()->getAll()["bad-words"] == "kick"){ $player->kick($this->betterColors("&", "&c".$bwk)); } else { $player->sendMessage($this->betterColors("&", "&c".$bwmsg)); return true; } }
Here is a modified main file. If it doesn't work, then look at it and try to understand why. A poor formatting style doesn't help anyone.