Skip to content

Commit

Permalink
new superstar color
Browse files Browse the repository at this point in the history
  • Loading branch information
Plancke committed Jul 31, 2018
1 parent 2b108da commit 99caf96
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
15 changes: 14 additions & 1 deletion src/responses/player/Player.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
7 changes: 6 additions & 1 deletion src/responses/player/Rank.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]';
}
}
}
}
Expand Down

0 comments on commit 99caf96

Please sign in to comment.