Code: [16:41:16] [Server thread/CRITICAL]: Unhandled exception executing command 'testc' in testc: Argument 1 passed to pocketmine\utils\BinaryStream::putUnsignedVarInt() must be of the type integer, null given, called in phar://C:/Users/arjxy/Desktop/pocketmine/PocketMine-MP.phar/src/pocketmine/network/mcpe/protocol/BossEventPacket.php on line 115 [16:41:16] [Server thread/CRITICAL]: TypeError: "Argument 1 passed to pocketmine\utils\BinaryStream::putUnsignedVarInt() must be of the type integer, null given, called in phar://C:/Users/arjxy/Desktop/pocketmine/PocketMine-MP.phar/src/pocketmine/network/mcpe/protocol/BossEventPacket.php on line 115" (EXCEPTION) in "vendor/pocketmine/binaryutils/src/BinaryStream" at line 230 PHP: $pk = new AddEntityPacket(); $pk->type = Entity::ZOMBIE; $pk->entityRuntimeId = Entity::$entityCount++; $pk->position = new Vector3(); $pk->metadata[Entity::DATA_NAMETAG] = [Entity::DATA_TYPE_STRING, "Title"]; $sender->dataPacket($pk); $pbk = new BossEventPacket(); $pbk->bossEid = (int)32; $pbk->eventType = BossEventPacket::TYPE_SHOW; $pbk->healthPercent = 1;$pbk->playerEid = $sender->getId(); $pbk->title = "hi"; $sender->dataPacket($pbk);
PHP: $id = Entity::$entityCount++;$pk = new AddEntityPacket();$pk->type = Entity::ARROW;$pk->entityRuntimeId = $id;$pk->position = $player->asVector3();$pk->metadata = [Entity::DATA_NAMETAG => [Entity::DATA_TYPE_STRING, "text"]];$player->dataPacket($pk);$pk = new BossEventPacket();$pk->bossEid = $id;$pk->playerEid = $player->getId();$pk->eventType = BossEventPacket::TYPE_SHOW;$pk->healthPercent = 100;$pk->unknownShort = 1;$pk->color = 1;$pk->overlay = 1;$pk->title = "text";$player->dataPacket($pk);
1. Why do you use a repeating task for sending the boss bar? Explain what you're trying to do and we will be able to help. 2. You can replace PHP: Entity::ARROW to whatever you want, It was an example.