From 99caf96ef75dd46eca8f9df1566a7f18cb62bfbc Mon Sep 17 00:00:00 2001 From: Plancke Date: Tue, 31 Jul 2018 17:17:52 -0400 Subject: [PATCH] new superstar color --- src/responses/player/Player.php | 15 ++++++++++++++- src/responses/player/Rank.php | 7 ++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/responses/player/Player.php b/src/responses/player/Player.php index 72d4703..96f448a 100644 --- a/src/responses/player/Player.php +++ b/src/responses/player/Player.php @@ -4,6 +4,7 @@ use Plancke\HypixelPHP\cache\CacheTimes; use Plancke\HypixelPHP\classes\HypixelObject; +use Plancke\HypixelPHP\color\ColorUtils; use Plancke\HypixelPHP\exceptions\HypixelPHPException; use Plancke\HypixelPHP\fetch\FetchParams; use Plancke\HypixelPHP\fetch\Response; @@ -156,6 +157,18 @@ public function getRawFormattedName($prefix = true, $guildTag = false) { return $out; } + /** + * @return string + */ + public function getSuperStarColor() { + $color = $this->get('SUPERSTAR_COLOR'); + if ($color == null) return null; + if (isset(ColorUtils::NAME_TO_CODE[$color])) { + return ColorUtils::NAME_TO_CODE[$color]; + } + return ColorUtils::GOLD; + } + /** * get Rank * @param bool $package @@ -225,7 +238,7 @@ public function getPrefix() { public function getGuildTag() { $guild = $this->getGuild(); if ($guild instanceof Guild) { - return $guild->getTag(); + return $guild->getTag(); } return null; } diff --git a/src/responses/player/Rank.php b/src/responses/player/Rank.php index a432938..88032cd 100644 --- a/src/responses/player/Rank.php +++ b/src/responses/player/Rank.php @@ -72,7 +72,12 @@ public function getPrefix(Player $player) { if ($this->id == RankTypes::MVP_PLUS) { return '§b[MVP' . $plusColor . '+§b]'; } else if ($this->id == RankTypes::SUPERSTAR) { - return '§6[MVP' . $plusColor . '++§6]'; + $superStarColor = $player->getSuperStarColor(); + if ($superStarColor != null) { + return $player->getSuperStarColor() . '[MVP' . $plusColor . '++§6]'; + } else { + return '§6[MVP' . $plusColor . '++§6]'; + } } } }