inxomnyaa/apibossbar
Composer 安装命令:
composer require inxomnyaa/apibossbar
包简介
A simple virion API for Minecraft Bossbars for PocketMine-MP
README 文档
README
A simple api virion to create, send, modify and use Minecraft's boss mob indicator bars in Plugins for PocketMine-MP
Advantages
It is quite easy to use this API
- It uses a single object
- Fluent setters (use multiple functions in 1 line)
- Cleaner code
- Easier to understand
- No worrying about the used entity id
- 2 types of bars (BossBar is same for all players, DiverseBossBar can be modified per player)
- No "API::function()" calls, just object methods
- Changeable entity (Can be used for actual boss mobs i.e.)
Types
There are 2 types of boss bars.
- BossBar: is used for shared data, so all registered players see the same bar.
- DiverseBossBar: is used for unique data, their data can be changed per player. They can also be set in a batch for multiple players, and will use default values if no specific data is set for a player. The default data is set like on a shared BossBar
API & usage
A very basic example can be seen here: BossBarTest. For a more advanced example you could check out BossAnnouncement
Create a new boss bar
/** @var BossBar */ $bar = new BossBar();
Set the title and/or subtitle
$bar->setTitle(string $title = ""); $bar->setSubTitle(string $subTitle = "");
Set the color
// Available Colors: // PINK,BLUE,RED,GREEN,YELLOW,PURPLE,REBECCA_PURPLE,WHITE $bar->setColor(pocketmine\network\mcpe\protocol\types\BossBarColor::RED);
Set the fill percentage
// Half-filled $bar->setPercentage(0.5);
Add and remove players
// Single $bar->addPlayer(Player $player);// This will spawn the bar to the player $bar->removePlayer(Player $player); // Multiple /** @var Player[] $players */ $bar->addPlayers(array $players); $bar->removePlayers(array $players); $bar->removeAllPlayers();
Hide and show bar
/** @var Player[] $players */ $bar->hideFrom(array $players); $bar->showTo(array $players);
Get and set the entity the bar is assigned to
/** @var Entity|Player $entity */ $bar->getEntity(); $bar->setEntity(Entity $entity); $bar->resetEntity();
Single line example
/** @var Player $player */ $player = Server::getInstance()->getPlayerByName("Steve"); /** @var BossBar */ $bar = (new BossBar())->setTitle("Hello world!")->setSubTitle("Foo Bar")->setPercentage(0.5)->addPlayer($player);
DiverseBossBar has some additional methods to set data per player:
Reset the data to its defaults
$bar->resetFor(Player $player); $bar->resetForAll();
Set & get title for players
/** @var Player[] $players */ $bar->setTitleFor(array $players); $bar->setSubTitleFor(array $players); $bar->getTitleFor(Player $player); $bar->getSubTitleFor(Player $player); $bar->getFullTitleFor(Player $player);// Combined and encoded title & subtitle
Set percentage for players
/** @var Player[] $players */ $bar->setPercentageFor(array $players); $bar->getPercentageFor(Player $player);
Disclaimer & Information
Coded and maintained by XenialDan
Feel free to open issues with suggestions and bug reports. Please leave as much information as possible to help speeding up the debugging of the issues.
This is a full rework of BossBarAPI. Plugins that used this virion should be upgraded to apibossbar ASAP
Colors and overlays do not work due to not being properly implemented in the client (They use data from the resource pack definitions file). #blamemojang for copy-paste leftovers from Minecraft: Java Edition
inxomnyaa/apibossbar 适用场景与选型建议
inxomnyaa/apibossbar 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 136 次下载、GitHub Stars 达 55, 最近一次更新时间为 2025 年 04 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 inxomnyaa/apibossbar 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 inxomnyaa/apibossbar 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 136
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 55
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2025-04-17