refactor codestyle (chaining)
This commit is contained in:
@ -44,51 +44,34 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
||||
$this->maniaControl = $maniaControl;
|
||||
|
||||
// Admin commands
|
||||
$this->maniaControl->getCommandManager()
|
||||
->registerCommandListener(array('balance', 'teambalance', 'autoteambalance'), $this, 'command_TeamBalance', true, 'Balances the teams.');
|
||||
$this->maniaControl->getCommandManager()
|
||||
->registerCommandListener('kick', $this, 'command_Kick', true, 'Kicks player from the server.');
|
||||
$this->maniaControl->getCommandManager()
|
||||
->registerCommandListener('ban', $this, 'command_Ban', true, 'Bans player from the server.');
|
||||
$this->maniaControl->getCommandManager()
|
||||
->registerCommandListener(array('forcespec', 'forcespectator'), $this, 'command_ForceSpectator', true, 'Forces player into spectator.');
|
||||
$this->maniaControl->getCommandManager()
|
||||
->registerCommandListener('forceplay', $this, 'command_ForcePlay', true, 'Forces player into Play mode.');
|
||||
$this->maniaControl->getCommandManager()
|
||||
->registerCommandListener('forceblue', $this, 'command_ForceBlue', true, 'Forces player into blue team.');
|
||||
$this->maniaControl->getCommandManager()
|
||||
->registerCommandListener('forcered', $this, 'command_ForceRed', true, 'Forces player into red team.');
|
||||
$this->maniaControl->getCommandManager()
|
||||
->registerCommandListener(array('addbots', 'addbot'), $this, 'command_AddFakePlayers', true, 'Adds bots to the game.');
|
||||
$this->maniaControl->getCommandManager()
|
||||
->registerCommandListener(array('removebot', 'removebots'), $this, 'command_RemoveFakePlayers', true, 'Removes bots from the game.');
|
||||
$this->maniaControl->getCommandManager()
|
||||
->registerCommandListener('mute', $this, 'command_MutePlayer', true, 'Mutes a player (prevents player from chatting).');
|
||||
$this->maniaControl->getCommandManager()
|
||||
->registerCommandListener('unmute', $this, 'command_UnmutePlayer', true, 'Unmute a player (enables player to chat again).');
|
||||
$this->maniaControl->getCommandManager()->registerCommandListener(array('balance', 'teambalance', 'autoteambalance'), $this, 'command_TeamBalance', true, 'Balances the teams.');
|
||||
$this->maniaControl->getCommandManager()->registerCommandListener('kick', $this, 'command_Kick', true, 'Kicks player from the server.');
|
||||
$this->maniaControl->getCommandManager()->registerCommandListener('ban', $this, 'command_Ban', true, 'Bans player from the server.');
|
||||
$this->maniaControl->getCommandManager()->registerCommandListener(array('forcespec', 'forcespectator'), $this, 'command_ForceSpectator', true, 'Forces player into spectator.');
|
||||
$this->maniaControl->getCommandManager()->registerCommandListener('forceplay', $this, 'command_ForcePlay', true, 'Forces player into Play mode.');
|
||||
$this->maniaControl->getCommandManager()->registerCommandListener('forceblue', $this, 'command_ForceBlue', true, 'Forces player into blue team.');
|
||||
$this->maniaControl->getCommandManager()->registerCommandListener('forcered', $this, 'command_ForceRed', true, 'Forces player into red team.');
|
||||
$this->maniaControl->getCommandManager()->registerCommandListener(array('addbots', 'addbot'), $this, 'command_AddFakePlayers', true, 'Adds bots to the game.');
|
||||
$this->maniaControl->getCommandManager()->registerCommandListener(array('removebot', 'removebots'), $this, 'command_RemoveFakePlayers', true, 'Removes bots from the game.');
|
||||
$this->maniaControl->getCommandManager()->registerCommandListener('mute', $this, 'command_MutePlayer', true, 'Mutes a player (prevents player from chatting).');
|
||||
$this->maniaControl->getCommandManager()->registerCommandListener('unmute', $this, 'command_UnmutePlayer', true, 'Unmute a player (enables player to chat again).');
|
||||
|
||||
// Player commands
|
||||
$this->maniaControl->getCommandManager()
|
||||
->registerCommandListener(array('player', 'players'), $this, 'command_playerList', false, 'Shows players currently on the server.');
|
||||
$this->maniaControl->getCommandManager()->registerCommandListener(array('player', 'players'), $this, 'command_playerList', false, 'Shows players currently on the server.');
|
||||
|
||||
// Permissions
|
||||
$this->maniaControl->getAuthenticationManager()
|
||||
->definePermissionLevel(self::SETTING_PERMISSION_ADD_BOT, AuthenticationManager::AUTH_LEVEL_MODERATOR);
|
||||
$this->maniaControl->getAuthenticationManager()
|
||||
->definePermissionLevel(self::SETTING_PERMISSION_TEAM_BALANCE, AuthenticationManager::AUTH_LEVEL_MODERATOR);
|
||||
$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_ADD_BOT, AuthenticationManager::AUTH_LEVEL_MODERATOR);
|
||||
$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_TEAM_BALANCE, AuthenticationManager::AUTH_LEVEL_MODERATOR);
|
||||
|
||||
// Callbacks
|
||||
$this->maniaControl->getCallbackManager()
|
||||
->registerCallbackListener(Server::CB_TEAM_MODE_CHANGED, $this, 'teamStatusChanged');
|
||||
$this->maniaControl->getCallbackManager()->registerCallbackListener(Server::CB_TEAM_MODE_CHANGED, $this, 'teamStatusChanged');
|
||||
|
||||
// Action Open PlayerList
|
||||
$this->maniaControl->getManialinkManager()
|
||||
->registerManialinkPageAnswerListener(self::ACTION_OPEN_PLAYERLIST, $this, 'command_playerList');
|
||||
$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_OPEN_PLAYERLIST, $this, 'command_playerList');
|
||||
$itemQuad = new Quad_UIConstruction_Buttons();
|
||||
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Author);
|
||||
$itemQuad->setAction(self::ACTION_OPEN_PLAYERLIST);
|
||||
$this->maniaControl->getActionsMenu()
|
||||
->addMenuItem($itemQuad, true, 15, 'Open PlayerList');
|
||||
$this->maniaControl->getActionsMenu()->addMenuItem($itemQuad, true, 15, 'Open PlayerList');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,13 +83,11 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
||||
//Add Balance Team Icon if it's a teamMode
|
||||
if ($teamMode) {
|
||||
// Action Balance Teams
|
||||
$this->maniaControl->getManialinkManager()
|
||||
->registerManialinkPageAnswerListener(self::ACTION_BALANCE_TEAMS, $this, 'command_TeamBalance');
|
||||
$this->maniaControl->getManialinkManager()->registerManialinkPageAnswerListener(self::ACTION_BALANCE_TEAMS, $this, 'command_TeamBalance');
|
||||
$itemQuad = new Quad_Icons128x32_1();
|
||||
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_RT_Team);
|
||||
$itemQuad->setAction(self::ACTION_BALANCE_TEAMS);
|
||||
$this->maniaControl->getActionsMenu()
|
||||
->addMenuItem($itemQuad, false, 40, 'Balance Teams');
|
||||
$this->maniaControl->getActionsMenu()->addMenuItem($itemQuad, false, 40, 'Balance Teams');
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,25 +98,20 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
||||
* @param Player $player
|
||||
*/
|
||||
public function command_TeamBalance(array $chatCallback, Player $player) {
|
||||
if (!$this->maniaControl->getAuthenticationManager()
|
||||
->checkPermission($player, self::SETTING_PERMISSION_TEAM_BALANCE)
|
||||
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_TEAM_BALANCE)
|
||||
) {
|
||||
$this->maniaControl->getAuthenticationManager()
|
||||
->sendNotAllowed($player);
|
||||
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$this->maniaControl->getClient()
|
||||
->autoTeamBalance();
|
||||
$this->maniaControl->getClient()->autoTeamBalance();
|
||||
} catch (GameModeException $exception) {
|
||||
$this->maniaControl->getChat()
|
||||
->sendException($exception, $player);
|
||||
$this->maniaControl->getChat()->sendException($exception, $player);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->maniaControl->getChat()
|
||||
->sendInformation($player->getEscapedNickname() . ' balanced Teams!');
|
||||
$this->maniaControl->getChat()->sendInformation($player->getEscapedNickname() . ' balanced Teams!');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -145,17 +121,14 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
||||
* @param Player $player
|
||||
*/
|
||||
public function command_Kick(array $chat, Player $player) {
|
||||
if (!$this->maniaControl->getAuthenticationManager()
|
||||
->checkPermission($player, PlayerActions::SETTING_PERMISSION_KICK_PLAYER)
|
||||
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, PlayerActions::SETTING_PERMISSION_KICK_PLAYER)
|
||||
) {
|
||||
$this->maniaControl->getAuthenticationManager()
|
||||
->sendNotAllowed($player);
|
||||
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player);
|
||||
return;
|
||||
}
|
||||
$params = explode(' ', $chat[1][2], 3);
|
||||
if (count($params) <= 1) {
|
||||
$this->maniaControl->getChat()
|
||||
->sendUsageInfo("No Login given! Example: '//kick login'", $player->login);
|
||||
$this->maniaControl->getChat()->sendUsageInfo("No Login given! Example: '//kick login'", $player->login);
|
||||
return;
|
||||
}
|
||||
$targetLogin = $params[1];
|
||||
@ -163,9 +136,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
||||
if (isset($params[2])) {
|
||||
$message = $params[2];
|
||||
}
|
||||
$this->maniaControl->getPlayerManager()
|
||||
->getPlayerActions()
|
||||
->kickPlayer($player->login, $targetLogin, $message);
|
||||
$this->maniaControl->getPlayerManager()->getPlayerActions()->kickPlayer($player->login, $targetLogin, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -175,17 +146,14 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
||||
* @param Player $player
|
||||
*/
|
||||
public function command_Ban(array $chat, Player $player) {
|
||||
if (!$this->maniaControl->getAuthenticationManager()
|
||||
->checkPermission($player, PlayerActions::SETTING_PERMISSION_BAN_PLAYER)
|
||||
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, PlayerActions::SETTING_PERMISSION_BAN_PLAYER)
|
||||
) {
|
||||
$this->maniaControl->getAuthenticationManager()
|
||||
->sendNotAllowed($player);
|
||||
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player);
|
||||
return;
|
||||
}
|
||||
$params = explode(' ', $chat[1][2], 3);
|
||||
if (count($params) <= 1) {
|
||||
$this->maniaControl->getChat()
|
||||
->sendUsageInfo("No Login given! Example: '//ban login'", $player->login);
|
||||
$this->maniaControl->getChat()->sendUsageInfo("No Login given! Example: '//ban login'", $player->login);
|
||||
return;
|
||||
}
|
||||
$targetLogin = $params[1];
|
||||
@ -193,9 +161,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
||||
if (isset($params[2])) {
|
||||
$message = $params[2];
|
||||
}
|
||||
$this->maniaControl->getPlayerManager()
|
||||
->getPlayerActions()
|
||||
->banPlayer($player->login, $targetLogin, $message);
|
||||
$this->maniaControl->getPlayerManager()->getPlayerActions()->banPlayer($player->login, $targetLogin, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -207,14 +173,11 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
||||
public function command_Warn(array $chatCallback, Player $player) {
|
||||
$params = explode(' ', $chatCallback[1][2], 3);
|
||||
if (count($params) <= 1) {
|
||||
$this->maniaControl->getChat()
|
||||
->sendUsageInfo("No Login given! Example: '//warn login'", $player->login);
|
||||
$this->maniaControl->getChat()->sendUsageInfo("No Login given! Example: '//warn login'", $player->login);
|
||||
return;
|
||||
}
|
||||
$targetLogin = $params[1];
|
||||
$this->maniaControl->getPlayerManager()
|
||||
->getPlayerActions()
|
||||
->warnPlayer($player->login, $targetLogin);
|
||||
$this->maniaControl->getPlayerManager()->getPlayerActions()->warnPlayer($player->login, $targetLogin);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -224,30 +187,23 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
||||
* @param Player $player
|
||||
*/
|
||||
public function command_ForceSpectator(array $chat, Player $player) {
|
||||
if (!$this->maniaControl->getAuthenticationManager()
|
||||
->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_SPEC)
|
||||
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_SPEC)
|
||||
) {
|
||||
$this->maniaControl->getAuthenticationManager()
|
||||
->sendNotAllowed($player);
|
||||
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player);
|
||||
return;
|
||||
}
|
||||
$params = explode(' ', $chat[1][2]);
|
||||
if (count($params) <= 1) {
|
||||
$this->maniaControl->getChat()
|
||||
->sendUsageInfo("No Login given! Example: '//forcespec login'", $player->login);
|
||||
$this->maniaControl->getChat()->sendUsageInfo("No Login given! Example: '//forcespec login'", $player->login);
|
||||
return;
|
||||
}
|
||||
$targetLogin = $params[1];
|
||||
|
||||
if (isset($params[2]) && is_numeric($params[2])) {
|
||||
$type = (int)$params[2];
|
||||
$this->maniaControl->getPlayerManager()
|
||||
->getPlayerActions()
|
||||
->forcePlayerToSpectator($player->login, $targetLogin, $type);
|
||||
$this->maniaControl->getPlayerManager()->getPlayerActions()->forcePlayerToSpectator($player->login, $targetLogin, $type);
|
||||
} else {
|
||||
$this->maniaControl->getPlayerManager()
|
||||
->getPlayerActions()
|
||||
->forcePlayerToSpectator($player->login, $targetLogin);
|
||||
$this->maniaControl->getPlayerManager()->getPlayerActions()->forcePlayerToSpectator($player->login, $targetLogin);
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,17 +214,14 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
||||
* @param Player $player
|
||||
*/
|
||||
public function command_ForcePlay(array $chat, Player $player) {
|
||||
if (!$this->maniaControl->getAuthenticationManager()
|
||||
->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_PLAY)
|
||||
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_PLAY)
|
||||
) {
|
||||
$this->maniaControl->getAuthenticationManager()
|
||||
->sendNotAllowed($player);
|
||||
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player);
|
||||
return;
|
||||
}
|
||||
$params = explode(' ', $chat[1][2]);
|
||||
if (!isset($params[1])) {
|
||||
$this->maniaControl->getChat()
|
||||
->sendUsageInfo("No Login given! Example: '//forceplay login'", $player->login);
|
||||
$this->maniaControl->getChat()->sendUsageInfo("No Login given! Example: '//forceplay login'", $player->login);
|
||||
return;
|
||||
}
|
||||
$targetLogin = $params[1];
|
||||
@ -279,9 +232,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
||||
}
|
||||
$selectable = ($type === 2);
|
||||
|
||||
$this->maniaControl->getPlayerManager()
|
||||
->getPlayerActions()
|
||||
->forcePlayerToPlay($player->login, $targetLogin, $selectable);
|
||||
$this->maniaControl->getPlayerManager()->getPlayerActions()->forcePlayerToPlay($player->login, $targetLogin, $selectable);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -291,24 +242,19 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
||||
* @param Player $player
|
||||
*/
|
||||
public function command_ForceBlue(array $chat, Player $player) {
|
||||
if (!$this->maniaControl->getAuthenticationManager()
|
||||
->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)
|
||||
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)
|
||||
) {
|
||||
$this->maniaControl->getAuthenticationManager()
|
||||
->sendNotAllowed($player);
|
||||
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player);
|
||||
return;
|
||||
}
|
||||
$params = explode(' ', $chat[1][2]);
|
||||
if (!isset($params[1])) {
|
||||
$this->maniaControl->getChat()
|
||||
->sendUsageInfo("No Login given! Example: '//forceblue login'", $player->login);
|
||||
$this->maniaControl->getChat()->sendUsageInfo("No Login given! Example: '//forceblue login'", $player->login);
|
||||
return;
|
||||
}
|
||||
$targetLogin = $params[1];
|
||||
|
||||
$this->maniaControl->getPlayerManager()
|
||||
->getPlayerActions()
|
||||
->forcePlayerToTeam($player->login, $targetLogin, PlayerActions::TEAM_BLUE);
|
||||
$this->maniaControl->getPlayerManager()->getPlayerActions()->forcePlayerToTeam($player->login, $targetLogin, PlayerActions::TEAM_BLUE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -318,24 +264,19 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
||||
* @param Player $player
|
||||
*/
|
||||
public function command_ForceRed(array $chat, Player $player) {
|
||||
if (!$this->maniaControl->getAuthenticationManager()
|
||||
->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)
|
||||
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)
|
||||
) {
|
||||
$this->maniaControl->getAuthenticationManager()
|
||||
->sendNotAllowed($player);
|
||||
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player);
|
||||
return;
|
||||
}
|
||||
$params = explode(' ', $chat[1][2]);
|
||||
if (!isset($params[1])) {
|
||||
$this->maniaControl->getChat()
|
||||
->sendUsageInfo("No Login given! Example: '//forcered login'", $player->login);
|
||||
$this->maniaControl->getChat()->sendUsageInfo("No Login given! Example: '//forcered login'", $player->login);
|
||||
return;
|
||||
}
|
||||
$targetLogin = $params[1];
|
||||
|
||||
$this->maniaControl->getPlayerManager()
|
||||
->getPlayerActions()
|
||||
->forcePlayerToTeam($player->login, $targetLogin, PlayerActions::TEAM_RED);
|
||||
$this->maniaControl->getPlayerManager()->getPlayerActions()->forcePlayerToTeam($player->login, $targetLogin, PlayerActions::TEAM_RED);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -345,11 +286,9 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
||||
* @param Player $player
|
||||
*/
|
||||
public function command_AddFakePlayers(array $chatCallback, Player $player) {
|
||||
if (!$this->maniaControl->getAuthenticationManager()
|
||||
->checkPermission($player, self::SETTING_PERMISSION_ADD_BOT)
|
||||
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_ADD_BOT)
|
||||
) {
|
||||
$this->maniaControl->getAuthenticationManager()
|
||||
->sendNotAllowed($player);
|
||||
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player);
|
||||
return;
|
||||
}
|
||||
$amount = 1;
|
||||
@ -360,14 +299,11 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
||||
|
||||
try {
|
||||
for ($i = 0; $i < $amount; $i++) {
|
||||
$this->maniaControl->getClient()
|
||||
->connectFakePlayer();
|
||||
$this->maniaControl->getClient()->connectFakePlayer();
|
||||
}
|
||||
$this->maniaControl->getChat()
|
||||
->sendSuccess('Fake players connected!', $player);
|
||||
$this->maniaControl->getChat()->sendSuccess('Fake players connected!', $player);
|
||||
} catch (UnavailableFeatureException $e) {
|
||||
$this->maniaControl->getChat()
|
||||
->sendSuccess('Error while connecting a Fake-Player.', $player);
|
||||
$this->maniaControl->getChat()->sendSuccess('Error while connecting a Fake-Player.', $player);
|
||||
}
|
||||
}
|
||||
|
||||
@ -378,17 +314,13 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
||||
* @param Player $player
|
||||
*/
|
||||
public function command_RemoveFakePlayers(array $chatCallback, Player $player) {
|
||||
if (!$this->maniaControl->getAuthenticationManager()
|
||||
->checkPermission($player, self::SETTING_PERMISSION_ADD_BOT)
|
||||
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($player, self::SETTING_PERMISSION_ADD_BOT)
|
||||
) {
|
||||
$this->maniaControl->getAuthenticationManager()
|
||||
->sendNotAllowed($player);
|
||||
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($player);
|
||||
return;
|
||||
}
|
||||
$this->maniaControl->getClient()
|
||||
->disconnectFakePlayer('*');
|
||||
$this->maniaControl->getChat()
|
||||
->sendSuccess('Fake players disconnected!', $player);
|
||||
$this->maniaControl->getClient()->disconnectFakePlayer('*');
|
||||
$this->maniaControl->getChat()->sendSuccess('Fake players disconnected!', $player);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -400,14 +332,11 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
||||
public function command_MutePlayer(array $chatCallback, Player $admin) {
|
||||
$commandParts = explode(' ', $chatCallback[1][2]);
|
||||
if (count($commandParts) <= 1) {
|
||||
$this->maniaControl->getChat()
|
||||
->sendUsageInfo("No login specified! Example: '//mute login'", $admin);
|
||||
$this->maniaControl->getChat()->sendUsageInfo("No login specified! Example: '//mute login'", $admin);
|
||||
return;
|
||||
}
|
||||
$targetLogin = $commandParts[1];
|
||||
$this->maniaControl->getPlayerManager()
|
||||
->getPlayerActions()
|
||||
->mutePlayer($admin->login, $targetLogin);
|
||||
$this->maniaControl->getPlayerManager()->getPlayerActions()->mutePlayer($admin->login, $targetLogin);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -419,14 +348,11 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
||||
public function command_UnmutePlayer(array $chatCallback, Player $admin) {
|
||||
$commandParts = explode(' ', $chatCallback[1][2]);
|
||||
if (count($commandParts) <= 1) {
|
||||
$this->maniaControl->getChat()
|
||||
->sendUsageInfo("No login specified! Example: '//unmute login'", $admin);
|
||||
$this->maniaControl->getChat()->sendUsageInfo("No login specified! Example: '//unmute login'", $admin);
|
||||
return;
|
||||
}
|
||||
$targetLogin = $commandParts[1];
|
||||
$this->maniaControl->getPlayerManager()
|
||||
->getPlayerActions()
|
||||
->unMutePlayer($admin->login, $targetLogin);
|
||||
$this->maniaControl->getPlayerManager()->getPlayerActions()->unMutePlayer($admin->login, $targetLogin);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -436,11 +362,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
||||
* @param Player $player
|
||||
*/
|
||||
public function command_playerList(array $chatCallback, Player $player) {
|
||||
$this->maniaControl->getPlayerManager()
|
||||
->getPlayerList()
|
||||
->addPlayerToShownList($player, PlayerList::SHOWN_MAIN_WINDOW);
|
||||
$this->maniaControl->getPlayerManager()
|
||||
->getPlayerList()
|
||||
->showPlayerList($player);
|
||||
$this->maniaControl->getPlayerManager()->getPlayerList()->addPlayerToShownList($player, PlayerList::SHOWN_MAIN_WINDOW);
|
||||
$this->maniaControl->getPlayerManager()->getPlayerList()->showPlayerList($player);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user