Skip to content

Instantly share code, notes, and snippets.

@DaPigGuy
Last active January 4, 2023 12:28
Show Gist options
  • Save DaPigGuy/07442f8b98a70e5973a528e4516e35d1 to your computer and use it in GitHub Desktop.
Save DaPigGuy/07442f8b98a70e5973a528e4516e35d1 to your computer and use it in GitHub Desktop.
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

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

@Endermanbugzjfc
Copy link

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

plugins/.

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