PHP: namespace lightning;use pocketmine\event\player\PlayerDeathEvent;use pocketmine\event\Listener;use pocketmine\network\mcpe\protocol\AddEntityPacket;use pocketmine\network\mcpe\protocol\EntityEventPacket;use pocketmine\network\mcpe\protocol\MoveEntityPacket;use pocketmine\network\mcpe\protocol\RemoveEntityPacket;use pocketmine\network\mcpe\protocol\SetEntityDataPacket;use pocketmine\network\mcpe\protocol\SetEntityMotionPacket;use pocketmine\plugin\PluginBase;use pocketmine\Player;use pocketmine\Server;class Main extends PluginBase implements Listener{ public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this,$this); } public function addStrike(Player $player, $height) { $level = $player->getLevel(); $light = new AddEntityPacket(); $light->type = 93; $light->EntityRuntimeId = Entity::$entityCount++; $light->metadata = array(); $light->position = $p->asVector3()->add(0,$height,0); $light->yaw = $player->getYaw(); $light->pitch = $player->getPitch(); $player->getServer()->broadcastPacket($level->getPlayers(),$light); } public function onDeath(PlayerDeathEvent $event) { $player = $event->getEntity(); if($player instanceof Player){ $this->addStrike($player,0); } }} How can I add the main class? I dont really understand what the error is saying Error: Code: Server thread/CRITICAL Could not pass event 'pocketmine\event\player\PlayerDeathEvent' to 'ChestDrop v0.0.1': Class 'ChestDrop\AddEntityPacket' not found on ChestDrop\Main Thanks for the help in advance!
The error you provided is not reproducable, although there are some other problems with your code: The 'e' in entityRuntimeId should not be capitalised: The $p variable is undefined, you should be using $player as it is the name you assigned to the player parameter. You also forgot to import pocketmine\entity\Entity; I've included the fixed code below but would encourage you to try and debug simple issues like this yourself. It'd also be helpful if you provided an error that is actually reproducible and relevant to the code next time. Spoiler: code PHP: <?phpnamespace lightning;use pocketmine\event\player\PlayerDeathEvent;use pocketmine\event\Listener;use pocketmine\network\mcpe\protocol\AddEntityPacket;use pocketmine\network\mcpe\protocol\EntityEventPacket;use pocketmine\network\mcpe\protocol\MoveEntityPacket;use pocketmine\network\mcpe\protocol\RemoveEntityPacket;use pocketmine\network\mcpe\protocol\SetEntityDataPacket;use pocketmine\network\mcpe\protocol\SetEntityMotionPacket;use pocketmine\plugin\PluginBase;use pocketmine\Player;use pocketmine\Server;use pocketmine\entity\Entity;class Main extends PluginBase implements Listener{ public function onEnable() { $this->getServer()->getPluginManager()->registerEvents($this, $this); } public function addStrike(Player $player, $height) { $level = $player->getLevel(); $light = new AddEntityPacket(); $light->type = 93; $light->entityRuntimeId = Entity::$entityCount++; $light->metadata = array(); $light->position = $player->asVector3()->add(0,$height,0); $light->yaw = $player->getYaw(); $light->pitch = $player->getPitch(); $player->getServer()->broadcastPacket($level->getPlayers(), $light); } public function onDeath(PlayerDeathEvent $event) { $player = $event->getEntity(); if($player instanceof Player) { $this->addStrike($player,0); } }}
T Yeah this was a messed up version of the code, even though I fixed literally everything, I simply dont know what it means by cant find the AddEntityPacket Class when it is there
The error seems like you haven't imported AddEntityPacket. I would double check to make sure even tho you said you have it.
Check if you typed similar characters or invisible bytes. Maybe your friend trolled you and replaced your use statement with Cyrillic alphabets?