Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PiggyFactions addon for ScoreHUD
<?php
declare(strict_types=1);
/**
* @name PiggyFactionsAddon
* @version 1.1.0
* @main DaPigGuy\PiggyFactions\PiggyFactionsAddon
* @depend PiggyFactions
*/
namespace DaPigGuy\PiggyFactions {
use DaPigGuy\PiggyFactions\players\PlayerManager;
use JackMD\ScoreHud\addon\AddonBase;
use pocketmine\Player;
class PiggyFactionsAddon extends AddonBase
{
public function getProcessedTags(Player $player): array
{
$member = PlayerManager::getInstance()->getPlayer($player);
$faction = $member === null ? null : $member->getFaction();
return [
"{faction}" => $faction === null ? "N/A" : $faction->getName(),
"{faction_power}" => $faction === null ? "N/A" : round($faction->getPower(), 2, PHP_ROUND_HALF_DOWN),
"{faction_rank}" => $faction === null ? "N/A" : $member->getRole()
];
}
}
}
@Awsomegamer322
Copy link

Awsomegamer322 commented Jul 15, 2021

How do I add this to the sever and would I add this to the plug-in folder or the php folder?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment