Skip to content
This repository has been archived by the owner on Sep 8, 2018. It is now read-only.

BossbarAPI

Emre Yavuzyiğit edited this page Jun 20, 2018 · 12 revisions

Bossbar API

Altay's bossbar api is very simple! Lets read the blog.

How can I create a Bossbar?

$title = "title"; // optional, default value: Altay Bossbar API
$currentHealth = 1; // optional, default value: 1
$maxHealth = 1; // optional, default value: 1
$bossbar = new Bossbar($title, $currentHealth, $maxHealth);

How can I set/change health percent of Bossbar?

$currentHealth = 1;
$maxHealth = 1; // optional
$bossbar->setHealthPercent($currentHealth, $maxHealth); // fill this bossbar

How can I set/change title of Bossbar?

$bossbar->setTitle("test");

Show bossbar to a player:

$bossbar->showTo($player);

Hide bossbar from a player:

$bossbar->hideFrom($player);

Other Funtions of Bossbar:

$bossbar->getTitle(); // type: string , gets title
$bossbar->getHealthPercent(); // type: float , gets current health percentage
$bossbar->getMaxHealthPercent(); // type: float , gets maximum health percentage
$bossbar->getViewers(); // type: array , gets viewers of bossbar
$bossbar->updateForAll(); // updates bossbar to viewers, (internal use)

End.

Yup, that's it. It's that simple 😄 .