Code is not work, help please public function onMove(EntityMoveEvent $event){ $entity = $event->getEntity(); if($entity instanceof Snowball){ $x = $entity->getX(); $y = $entity->getY(); $z = $entity->getZ(); $level = $entity->getLevel(); $level->addParticle (new FlameParticle(new Vector3($x, $y, $z)));
Then schedule a repeating task to keep the particles spawning. Or use EntityMoveEvent. You cannot do this with the PlayerMoveEvent. Snowball is an entity not a player.
Can you give an example please? I can't... ; public function onHit(ProjectileLaunchEvent $event){ $entity = $event->getEntity(); if($entity instanceof Snowball){ $x = $entity->getX(); $y = $entity->getY(); $z = $entity->getZ(); $level = $entity->getLevel(); $level->addParticle(new FlameParticle(new Vector3($x, $y, $z))); $this->getServer()->getScheduler()->scheduleRepeatingTask(new CallbackTask(array($this, "Repeat")), 10); $this->timer = 0; } } public function Repeat(){ $entity = $event->getEntity(); if($entity instanceof Snowball){ $x = $entity->getX(); $y = $entity->getY(); $z = $entity->getZ(); $level = $entity->getLevel(); $level->addParticle(new FlameParticle(new Vector3($x, $y, $z))); } } }
Learn how to use tasks here: http://forums.pocketmine.net/threads/how-to-use-schedules-in-a-plugin.4796/ Btw, if I remember correctly, CallBackTask is deprecated.