Since there is no BossBar function in PocketMine yet, you have to create this function yourself. Here's a tutorial on how to do it. I know there is already PLUGINS that have been created such as PocketEssential's OR XenialDan's BossBarAPI. This, however is a completely different tutorial. First you need to create your Main class, which you can do as such; Spoiler: Main class PHP: use pocketmine\plugin\PluginBase;use /** YOUR BOSSBAR CLASS THAT WE CREATE OURSELF*/ PHP: class Main extends PluginBase {//This is our main class named "Main".//We now create our function named "getBossBar()" which just returns our BossBar class.public function getBossBar(){return new BossBar($this);} We now need to create another class named BossEventPacket. Spoiler: BossEventPacket Class PHP: use pocketmine\network\protocol\DataPacket;use pocketmine\network\protocol\Info;use pocketmine\utils\Binary;class BossEventPacket extends DataPacket{ const BOSS_EVENT_PACKET = 0x4a; const NETWORK_ID = self::BOSS_EVENT_PACKET; public $eid; public $type; public function decode(){ } public function encode(){ $this->reset(); $this->putEntityId($this->eid); $this->putUnsignedVarInt($this->type); Now we shall create our BossBar class. This class will be named "BossBar". Spoiler: BossBar class PHP: class BossBar { private $plugin; public function __construct(Main $plugin){$this->plugin = $plugin;}//We have now created our constructor and we are 'linked' to the Main class.//Now, stuff gets complicated!//We will create 2 functions. "addBar", and "setTitle"use pocketmine\item\Item;use pocketmine\network\mcpe\protocol\AddPlayerPacket;use BossEventPacket;//Our BossEventPacket class.//Make sure the path is rightuse pocketmine\network\mcpe\protocol\MovePlayerPacket;use pocketmine\network\mcpe\protocol\SetEntityDataPacket;use pocketmine\Player;use pocketmine\network\mcpe\protocol\RemoveEntityPacket;use pocketmine\Server;use pocketmine\network\mcpe\protocol\AddEntityPacket;use pocketmine\entity\Entity;use pocketmine\utils\UUID;public function addBar(array $players = null){ if(empty($players)){ $players = $this->plugin->getPlayers(); } $eid = Entity::$entityCount++; $aepkt = new AddEntityPacket(); $aepkt->metadata = [Entity::DATA_LEAD_HOLDER => [Entity::DATA_TYPE_LONG, -1], Entity::DATA_FLAG_SILENT => [Entity::DATA_TYPE_BYTE, 1], Entity::DATA_SCALE => [Entity::DATA_TYPE_FLOAT, 0], Entity::DATA_BOUNDING_BOX_WIDTH => [Entity::DATA_TYPE_FLOAT, 0], Entity::DATA_BOUNDING_BOX_HEIGHT => [Entity::DATA_TYPE_FLOAT, 0]]; $aepkt->eid = Entity::$entityCount++; $aepkt->type = 52; $aepkt->yaw = 0; $aepkt->pitch = 0; foreach($players as $player){ $ppkt = clone $aepkt; $ppkt->x = $player->x; $ppkt->y = $player->y; $ppkt->z = $player->z; $player->dataPacket($ppkt); } $pk = new BossEventPacket(); $pk->state = 0; $pk->eid = Entity::$entityCount++; Server::getInstance()->broadcastPacket($players, $pk); return $eid; } public function setTitle(int $eid, string $string){ $players = $this->plugin->getServer()->getOnlinePlayers(); $pk = new SetEntityDataPacket(); $pk->metadata = [Entity::DATA_NAMETAG => [Entity::DATA_TYPE_STRING, $string]]; $pk->eid = $eid; Server::getInstance()->broadcastPacket($players, $pk); $pkt = new BossEventPacket(); $pkt->eid = $eid; $pkt->state = 500; Server::getInstance()->broadcastPacket($players, $pkt);//We have now created our BossBar. Please read the code to try and understand how this works.//We can set the text by calling setTitle as such;/** public function (your function)*/$this->setTitle(11000,"BossBar Created!") I hope this has helped you understand. Please give me a like if you have learnt something (anything). Just thought this needed to be out there. It's very complex, however. I would recommend people to also study PocketEssential's or XenialDan's BossBarAPI. You should also use a task to repeat the BossBar.
To be honest this isn't a tutorial. This thread just lists some code to copy. I recommend making this into a library.
I cannot understand this... please edit & give more explanation. I like that you have put effort into this though!
Code: PocketMine-MP Crash Dump Fri May 5 20:59:52 BST 2017 Error: Class Core\Packets\BossEventPacket contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (pocketmine\network\mcpe\protocol\DataPacket::handle) File: /plugins/NewCore/src/Core/Packets/BossEventPacket Line: 28 Type: E_ERROR THIS CRASH WAS CAUSED BY A PLUGIN BAD PLUGIN: Core v3.0 Code: [19] [20] } [21] [22] public function encode() [23] { [24] $this->reset(); [25] $this->putEntityId($this->eid); [26] $this->putUnsignedVarInt($this->type); [27] } [28] } [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] ??? This i get after I join my server
Look at the original post by @Lowkey. PHP: use BossEventPacket; This tells me that BossEventPacket.php is in the same directory as the BossBar class