Last active
January 4, 2023 12:28
-
-
Save DaPigGuy/07442f8b98a70e5973a528e4516e35d1 to your computer and use it in GitHub Desktop.
PiggyFactions addon for ScoreHUD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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() | |
]; | |
} | |
} | |
} |
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
How do I add this to the sever and would I add this to the plug-in folder or the php folder?