minor performance improvements
This commit is contained in:
@ -290,8 +290,9 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
|
||||
* Shows the serverRank to a certain Player
|
||||
*
|
||||
* @param Player $player
|
||||
* @param $multiCall
|
||||
*/
|
||||
public function showRank(Player $player) {
|
||||
public function showRank(Player $player, $multiCall = false) {
|
||||
$rankObj = $this->getRank($player);
|
||||
|
||||
$type = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_RANKING_TYPE);
|
||||
@ -325,7 +326,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
|
||||
$message = '$0f3 You need $<$fff' . $minRecords . '$> Records on this server before receiving a rank...';
|
||||
}
|
||||
}
|
||||
$this->maniaControl->getChat()->sendChat($message, $player);
|
||||
$this->maniaControl->getChat()->sendChat($message, $player, $multiCall);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -359,9 +360,10 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
|
||||
* Show which Player is next ranked to you
|
||||
*
|
||||
* @param Player $player
|
||||
* @param bool $multiCall
|
||||
* @return bool
|
||||
*/
|
||||
public function showNextRank(Player $player) {
|
||||
public function showNextRank(Player $player, $multiCall = false) {
|
||||
$rankObject = $this->getRank($player);
|
||||
if (!$rankObject) {
|
||||
return false;
|
||||
@ -380,7 +382,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
|
||||
} else {
|
||||
$message = '$0f3No better ranked player.';
|
||||
}
|
||||
$this->maniaControl->getChat()->sendChat($message, $player);
|
||||
$this->maniaControl->getChat()->sendChat($message, $player, $multiCall);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -427,10 +429,13 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
|
||||
continue;
|
||||
}
|
||||
//TODO combine the following to message to one (saves half of calls)
|
||||
$this->showRank($player);
|
||||
$this->showNextRank($player);
|
||||
$this->showRank($player, true);
|
||||
$this->showNextRank($player, true);
|
||||
}
|
||||
|
||||
//Execute as a MultiCall
|
||||
$this->maniaControl->getClient()->executeMulticall();
|
||||
|
||||
// Trigger callback
|
||||
$this->maniaControl->getCallbackManager()->triggerCallback(self::CB_RANK_BUILT);
|
||||
}
|
||||
@ -538,6 +543,7 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
|
||||
$playerObject = $this->maniaControl->getPlayerManager()->getPlayerByIndex($rankedPlayer->PlayerIndex);
|
||||
$array = array($rankedPlayer->Rank => $posX + 5, $playerObject->nickname => $posX + 18, (string) round($rankedPlayer->Avg, 2) => $posX + 70);
|
||||
$this->maniaControl->getManialinkManager()->labelLine($playerFrame, $array);
|
||||
//TODO change labelline
|
||||
|
||||
$posY -= 4;
|
||||
$index++;
|
||||
|
Reference in New Issue
Block a user