my attempt: PHP: <?phpnamespace te;use pocketmine\plugin\PluginBase;use te\BadWordsEvent;use pocketmine\event\Listener;use pocketmine\event\player\PlayerChatEvent;use pocketmine\Player;use pocketmine\event\player\PlayerEvent;use pocketmine\event\Cancellable;class TestEvent extends PluginBase implements Listener{ public $badWords = [ "fuck", "shit", "poop" ]; public function onEnable(){ $this->getServer()->getPluginManager()->registerEvents($this, $this); } public function onChat(PlayerChatEvent $ev){ if(in_array($ev->getMessage(), $this->badWords)){ $ev->getPlayer()->sendMessage("§cBad Words are not allowed"); $this->getServer()->getPluginManager()->callEvent(new BadWordsEvent($ev->getPlayer())); } } public function onBadWords(BadWordsEvent $e){ $e->getPlayer()->sendMessage("§aIt Worked Khaled!"); }}class BadWordsEvent extends PlayerEvent implements Cancellable { protected $player; public function __construct(Player $player){ $this->player = $player; } public function getPlayer() : Player { return $this->player; }}?> but it doesnt work when i chat with the bad words, it doesnt send the message: "It worked khaled!". so please someone help
your event needs to extend PluginEvent some examples: https://github.com/robske110/SignSe.../robske_110/SSS/event/SSSasyncUpdateEvent.php https://github.com/robske110/Server...rSelector/src/robske_110/ServerSelector/event
no, but you can create your own "base event" with a getPlayer() function (just like in ServerSelector) if you have more player-based events. No problem, if you want you can drop a like