added isMuted() function to the player object + some adds what a player cant do when muted (use chatmessages like /gg, add map to queue, start a vote...)
This commit is contained in:
@ -263,6 +263,12 @@ class MapQueue implements CallbackListener, CommandListener {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the Player is muted
|
||||
if ($player->isMuted()) {
|
||||
$this->maniaControl->getChat()->sendError('Muted Players are not allowed to queue a map.', $player);
|
||||
return;
|
||||
}
|
||||
|
||||
//Check if player is allowed to add (another) map
|
||||
$isModerator = $this->maniaControl->getAuthenticationManager()->checkRight($player, AuthenticationManager::AUTH_LEVEL_MODERATOR);
|
||||
|
||||
|
@ -317,7 +317,7 @@ class Player {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Player Data
|
||||
* Sets the Player Data and stores it in the Database
|
||||
*
|
||||
* @param mixed $object
|
||||
* @param string $dataName
|
||||
@ -329,6 +329,21 @@ class Player {
|
||||
return $this->maniaControl->getPlayerManager()->getPlayerDataManager()->setPlayerData($object, $dataName, $this, $value, $serverIndex);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if a Player is muted
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isMuted() {
|
||||
$ignoreList = $this->maniaControl->getClient()->getIgnoreList(100, 0);
|
||||
foreach ($ignoreList as $ignoredPlayers) {
|
||||
if ($ignoredPlayers->login === $this->login) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Var_Dump the Player
|
||||
*/
|
||||
|
@ -516,16 +516,9 @@ class PlayerActions {
|
||||
/**
|
||||
* Check if a Player is muted
|
||||
*
|
||||
* @param string $login
|
||||
* @return bool
|
||||
* @deprecated see Player/isMuted()
|
||||
*/
|
||||
public function isPlayerMuted($login) {
|
||||
$ignoreList = $this->maniaControl->getClient()->getIgnoreList(100, 0);
|
||||
foreach ($ignoreList as $ignoredPlayers) {
|
||||
if ($ignoredPlayers->login === $login) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return $this->maniaControl->getPlayerManager()->getPlayer($login)->isMuted();
|
||||
}
|
||||
}
|
||||
|
@ -515,8 +515,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
|
||||
$label->setTextSize($textSize);
|
||||
$label->setTextColor($textColor);
|
||||
|
||||
if (!$this->maniaControl->getPlayerManager()->getPlayerActions()->isPlayerMuted($login)
|
||||
) {
|
||||
if (!$player->isMuted()) {
|
||||
$label->setText('Mute');
|
||||
$quad->setAction(self::ACTION_MUTE_PLAYER . '.' . $login);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user