If someone could point out what I have done wrong and how to update it to php7, that would be greatly appreciated! Spoiler <?php __HALT_COMPILER(); ?> name: hoegunplugin main: sliperyplayz/hoegunplugin/hoegunplugin version: 2.0 api: [1.4.1]<?php namespace hoegunplugin; use pocketmine\plugin\PluginBase; use pocketmine\block\Air; use pocketmine\block\Block; use pocketmine\entity\Entity; use pocketmine\event\block\BlockBreakEvent; use pocketmine\event\block\BlockPlaceEvent; use pocketmine\event\Listener; use pocketmine\event\player\PlayerInteractEvent; use pocketmine\event\player\PlayerQuitEvent; use pocketmine\event\server\DataPacketReceiveEvent; use pocketmine\level\Position; use pocketmine\math\Vector3; use pocketmine\network\protocol\UseItemPacket; use pocketmine\Player; use pocketmine\nbt\tag\Compound; use pocketmine\nbt\tag\Enum; use pocketmine\nbt\tag\Double; use pocketmine\nbt\tag\Float; use pocketmine\item\Item; use pocketmine\event\entity\EntityDamageEvent; use pocketmine\event\entity\EntityDamageByEntityEvent; use pocketmine\event\entity\ProjectileLaunchEvent; use pocketmine\event\player\PlayerItemConsumeEvent; use pocketmine\entity\Snowball; use pocketmine\event\entity\EntityDespawnEvent; use pocketmine\scheduler\CallbackTask; use pocketmine\event\entity\EntityDeathEvent; use pocketmine\event\player\PlayerDeathEvent; use pocketmine\Server; use pocketmine\entity\Living; class hoegunplugin extends PluginBase implements Listener { public function onEnable() { $this->getServer ()->getPluginManager ()->registerEvents ( $this, $this ); } public function onPacketReceived(DataPacketReceiveEvent $event){ if($event->getPlayer()->getLevel()->getName() == "world"){ $pk = $event->getPacket(); $player = $event->getPlayer(); if($pk instanceof UseItemPacket and $pk->face === 0xff) { $item = $player->getInventory()->getItemInHand(); if($item->getId() == 292){ foreach($player->getInventory()->getContents() as $item){ if ($item->getID() == 289 && $item->getDamage() == 3 && $item->getCount() > 0){ $nbt = new Compound ( "", [ "Pos" => new Enum ( "Pos", [ new Double ( "", $player->x ), new Double ( "", $player->y + $player->getEyeHeight () ), new Double ( "", $player->z ) ] ), "Motion" => new Enum ( "Motion", [ new Double ( "", - \sin ( $player->yaw / 180 * M_PI ) *\cos ( $player->pitch / 180 * M_PI ) ), new Double ( "", - \sin ( $player->pitch / 180 * M_PI ) ), new Double ( "",\cos ( $player->yaw / 180 * M_PI ) *\cos ( $player->pitch / 180 * M_PI ) ) ] ), "Rotation" => new Enum ( "Rotation", [ new Float ( "", $player->yaw ), new Float ( "", $player->pitch ) ] ) ] ); $f = 2.0; $snowball = Entity::createEntity ( "Snowball", $player->chunk, $nbt, $player ); $snowball->setMotion ( $snowball->getMotion ()->multiply ( $f ) ); $snowball->spawnToAll (); $player->getInventory ()->removeItem ( Item::get(289) ); } }
Code: <?php namespace hoegunplugin; use pocketmine\plugin\PluginBase; use pocketmine\block\Air; use pocketmine\block\Block; use pocketmine\entity\Entity; use pocketmine\event\block\BlockBreakEvent; use pocketmine\event\block\BlockPlaceEvent; use pocketmine\event\Listener; use pocketmine\event\player\PlayerInteractEvent; use pocketmine\event\player\PlayerQuitEvent; use pocketmine\event\server\DataPacketReceiveEvent; use pocketmine\level\Position; use pocketmine\math\Vector3; use pocketmine\network\protocol\UseItemPacket; use pocketmine\Player; use pocketmine\nbt\tag\CompoundTag; use pocketmine\nbt\tag\ListTag; use pocketmine\nbt\tag\DoubleTag; use pocketmine\nbt\tag\FloatTag; use pocketmine\item\Item; use pocketmine\event\entity\EntityDamageEvent; use pocketmine\event\entity\EntityDamageByEntityEvent; use pocketmine\event\entity\ProjectileLaunchEvent; use pocketmine\event\player\PlayerItemConsumeEvent; use pocketmine\entity\Snowball; use pocketmine\event\entity\EntityDespawnEvent; use pocketmine\scheduler\CallbackTask; use pocketmine\event\entity\EntityDeathEvent; use pocketmine\event\player\PlayerDeathEvent; use pocketmine\Server; use pocketmine\entity\Living; class hoegunplugin extends PluginBase implements Listener { public function onEnable() { $this->getServer ()->getPluginManager ()->registerEvents ( $this, $this ); } public function onPacketReceived(DataPacketReceiveEvent $event){ if($event->getPlayer()->getLevel()->getName() == "world"){ $pk = $event->getPacket(); $player = $event->getPlayer(); if($pk instanceof UseItemPacket and $pk->face === 0xff) { $item = $player->getInventory()->getItemInHand(); if($item->getId() == 292){ foreach($player->getInventory()->getContents() as $item){ if ($item->getID() == 289 && $item->getDamage() == 3 && $item->getCount() > 0){ $nbt = new CompoundTag ( "", [ "Pos" => new ListTag ( "Pos", [ new DoubleTag ( "", $player->x ), new DoubleTag ( "", $player->y + $player->getEyeHeight () ), new DoubleTag ( "", $player->z ) ] ), "Motion" => new ListTag ( "Motion", [ new DoubleTag ( "", - \sin ( $player->yaw / 180 * M_PI ) *\cos ( $player->pitch / 180 * M_PI ) ), new DoubleTag ( "", - \sin ( $player->pitch / 180 * M_PI ) ), new DoubleTag ( "",\cos ( $player->yaw / 180 * M_PI ) *\cos ( $player->pitch / 180 * M_PI ) ) ] ), "Rotation" => new ListTag ( "Rotation", [ new FloatTag ( "", $player->yaw ), new FloatTag ( "", $player->pitch ) ] ) ] ); $f = 2.0; $snowball = Entity::createEntity ( "Snowball", $player->chunk, $nbt, $player ); $snowball->setMotion ( $snowball->getMotion ()->multiply ( $f ) ); $snowball->spawnToAll (); $player->getInventory ()->removeItem ( Item::get(289) ); } } Tried my best to fix it was hard to read
Hey,u would not believe how little I know about this stuff. I started 5 days ago... I have yet to learn what u r talking about thank you anyway!!
Yeeeeaaaahhhhhh.sorta I have just looked at a bunch of other similar plugins and tried to stitch this together (#nocomputer) and I am on IOS sooooo... I know it's pretty hooky but ya know,work with what ya can right?
The source code needs to be put in the right plugin format and them compiled into a .phar with DevTools or go to pmt.mcpe.me
A phar file contains a lot of binary bytes. You can't edit it directly (at least not through conventional editors), just like you can't edit a Microsoft Word file directly.