minor performance improvements
This commit is contained in:
parent
52b54073bb
commit
677f278e53
@ -72,11 +72,12 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA
|
||||
* @param string $message
|
||||
* @param string $login
|
||||
* @param string|bool $prefix
|
||||
* @param bool $multiCall
|
||||
* @return bool
|
||||
*/
|
||||
public function sendInformation($message, $login = null, $prefix = true) {
|
||||
public function sendInformation($message, $login = null, $prefix = true, $multiCall = false) {
|
||||
$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_INFORMATION);
|
||||
return $this->sendChat($format . $message, $login, $prefix);
|
||||
return $this->sendChat($format . $message, $login, $prefix, $multiCall);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -85,9 +86,10 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA
|
||||
* @param string $message
|
||||
* @param string $login
|
||||
* @param string|bool $prefix
|
||||
* @param bool $multiCall
|
||||
* @return bool
|
||||
*/
|
||||
public function sendChat($message, $login = null, $prefix = true) {
|
||||
public function sendChat($message, $login = null, $prefix = true, $multiCall = false) {
|
||||
if (!$this->maniaControl->getClient()) {
|
||||
return false;
|
||||
}
|
||||
@ -100,13 +102,13 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA
|
||||
$login = Player::parseLogin($login);
|
||||
}
|
||||
try {
|
||||
return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, $login);
|
||||
return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, $login, $multiCall);
|
||||
} catch (UnknownPlayerException $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage);
|
||||
return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, null, $multiCall);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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++;
|
||||
|
Loading…
Reference in New Issue
Block a user