How to send a command or event to the player who clicked on another player? Maybe DataPacketReceiveEvent ,can send me an example code?
PHP: public function onInteract(EntityDamageEvent $event) { if($event instanceof EntityDamageByEntityEvent and $event->getEntity() instanceof Player and $event->getDamager() instanceof Player) { $this->getServer()->dispatchCommand($event->getPlayer(), "command to run here"); }}
Can you give me an example whit DataPacketSend? because i have whit EntityDamage cancelled on the world.