Почему-то не работает такой код. Ошибко нету, подскажите где ошибка/не доработка.
Плагин должен вызывать молнию на игрока, который зашёл на сервер.
<?php
namespace S;
use pocketmine\plugin\PluginBase;
use pocketmine\event\Listener;
use pocketmine\player\Player;
use pocketmine\network\mcpe\protocol\AddActorPacket;
use pocketmine\math\Vector3;
use pocketmine\event\player\PlayerJoinEvent;
class Main extends PluginBase implements Listener {
public function onEnable() : void{
$this->getServer()->getPluginManager()->registerEvents($this, $this);
}
public function onJoin(PlayerJoinEvent $e){
$player = $e->getPlayer();
$player->sendMessage ("Молния");
$pos = $player->getPosition();
$light = new AddActorPacket();
$light->type = "minecraft:lightning_bolt";
$light->actorRuntimeId = 100;
$light->actorUniqueId = 100;
$light->metadata = [];
$light->motion = NULL;
$light->yaw = $player->getLocation()->getYaw();
$light->pitch = $player->getLocation()->getPitch();
$light->position = new Vector3($pos->getX(), $pos->getY(), $pos->getZ());
}
}
?>