I'm trying to convert the plugin "TnT" running into a error after converting the code Code: Could not pass event 'pocketmine\event\server\DataPacketReceiveEvent' to 'TNT v1.2.5': Class pocketmine\nbt\tag\EnumTag not found on Tnt\Tnt Could not pass event 'pocketmine\event\block\BlockPlaceEvent' to 'TNT v1.2.5': Call to undefined method pocketmine\utils\Random::nextSignedFloatTag() on Tnt\Tnt [15:08:20] [Server thread/CRITICAL]: Error: "Call to undefined method pocketmine\utils\Random::nextSignedFloatTag()" (EXCEPTION) in "/plugins/TNT_v1.2.5/src/Tnt/Tnt" at line 117 Any light on the subject helps Still never have time to learn past basic knowledge of PHP :/ too busy with school Pocketmine Version: Latest From Github (PHP7 Build Official PocketMine) Pocketmine binarys: PHP 7.0.3 RC2 OS: CentOs 6 (64 Bit) Plugin Main.php code Spoiler Code: <?php namespace Tnt; use pocketmine\utils\TextFormat; use pocketmine\utils\Random; use pocketmine\utils\Config; use pocketmine\entity\Entity; use pocketmine\event\entity\EntityDamageEvent; use pocketmine\level\sound\AnvilUseSound; use pocketmine\nbt\tag\CompoundTag; use pocketmine\nbt\tag\EnumTag; use pocketmine\nbt\tag\DoubleTag; use pocketmine\nbt\tag\FloatTag; use pocketmine\nbt\tag\ByteTag; use pocketmine\plugin\PluginBase; use pocketmine\event\entity\ExplosionPrimeEvent; use pocketmine\event\Listener; use pocketmine\event\server\DataPacketReceiveEvent; use pocketmine\event\block\BlockPlaceEvent; use pocketmine\network\protocol\UseItemPacket; class Tnt extends PluginBase implements Listener { public $config; private $getTntCode; public function onEnable() { $this->getLogger()->info(TextFormat::BLUE ."==============="); $this->getLogger()->info(TextFormat::GREEN ."Have FUN Plugin BY Nawaf_Craft1b"); $this->getLogger()->info(TextFormat::BLUE ."==============="); $this->getServer ()->getPluginManager ()->registerEvents ( $this, $this ); @mkdir($this->getDataFolder()); $this->config = (new Config($this->getDataFolder()."config.yml", Config::YAML,array("TntDamage" => "10")))->getAll(); $this->getTntCode = new TntCode(); } public function onPacketReceived(DataPacketReceiveEvent $event){ $pk = $event->getPacket(); $player = $event->getPlayer(); if($pk instanceof UseItemPacket and $pk->face === 0xff) { $item = $player->getInventory()->getItemInHand(); if($item->getId() == 369){ $mot = (new Random())->nextSignedFloat() * M_PI * 2; $this->getTntCode->place[$player->getName()]=$player->getName(); $tnt = Entity::createEntity("PrimedTNT", $player->getLevel()->getChunk($player->x >> 4, $player->z >> 4), new CompoundTag("", [ "Pos" => new EnumTag("Pos", [ new DoubleTag("", $player->x + 0.5), new DoubleTag("", $player->y), new DoubleTag("", $player->z + 0.5) ]), "Motion" => new EnumTag("Motion", [ new DoubleTag("", -sin($mot) * 0.02), new DoubleTag("", 0.2), new DoubleTag("", -cos($mot) * 0.02) ]), "Rotation" => new EnumTag("Rotation", [ new FloatTag("", 0), new FloatTag("", 0) ]), "Fuse" => new ByteTag("Fuse", 80) ])); $tnt->spawnToAll(); $player->getLevel()->addSound(new AnvilUseSound($player),array($player)); return true; } } } public function onPlace(BlockPlaceEvent $place){ $block = $place->getBlock(); $player = $place->getPlayer(); IF($block->getId()===46){ $place->setCancelled(); $mot = (new Random())->nextSignedFloatTag() * M_PI * 2; $this->getTntCode->place[$player->getName()]=$player->getName(); $tnt = Entity::createEntity("PrimedTNT", $block->getLevel()->getChunk($block->x >> 4, $block->z >> 4), new CompoundTag("", [ "Pos" => new EnumTag("Pos", [ new DoubleTag("", $block->x + 0.5), new DoubleTag("", $block->y), new DoubleTag("", $block->z + 0.5) ]), "Motion" => new EnumTag("Motion", [ new DoubleTag("", -sin($mot) * 0.02), new DoubleTag("", 0.2), new DoubleTag("", -cos($mot) * 0.02) ]), "Rotation" => new EnumTag("Rotation", [ new FloatTag("", 0), new FloatTag("", 0) ]), "Fuse" => new ByteTag("Fuse", 80) ])); $tnt->spawnToAll(); $player->getLevel()->addSound(new AnvilUseSound($player),array($player)); return true; } } public function ExplosionPrimeEvent(ExplosionPrimeEvent $p){ $p->setBlockBreaking(false); } public function onDamage(EntityDamageEvent $event){ if($event->getCause() == 10 || $event->getCause() == 9){ $event->setDamage($this->config["TntDamage"]); if($this->getTntCode()->isPlace($event->getEntity())){ $event->setDamage(0); $this->getTntCode()->remove($event->getEntity()); } } } public function getTntCode(){ return $this->getTntCode; } } class TntCode{ public $place = array(); public function isPlace($player){ return in_array($player->getName(), $this->place); } public function remove($player){ unset($this->place[$player->getName()]); } } [/spoiler]
Code: Call to undefined method pocketmine\utils\Random::nextSignedFloatTag() https://github.com/PocketMine/PocketMine-MP/blob/master/src/pocketmine/utils/Random.php#L88
Thanks I realized I put tag on the second float line now just enumtag class error Code: Could not pass event 'pocketmine\event\block\BlockPlaceEvent' to 'TNT v1.2.5': Class pocketmine\nbt\tag\EnumTag not found on Tnt\Tnt [15:42:36] [Server thread/CRITICAL]: ClassNotFoundException: "Class pocketmine\nbt\tag\EnumTag not found" (EXCEPTION) in "/src/spl/BaseClassLoader" at line 144