2013-12-05 00:30:10 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace ManiaControl\Players;
|
|
|
|
|
2014-01-05 00:02:13 +01:00
|
|
|
use FML\Controls\Quads\Quad_Icons128x32_1;
|
2014-01-05 00:43:46 +01:00
|
|
|
use FML\Controls\Quads\Quad_UIConstruction_Buttons;
|
2013-12-05 00:30:10 +01:00
|
|
|
use ManiaControl\Admin\AuthenticationManager;
|
2014-02-01 19:06:21 +01:00
|
|
|
use ManiaControl\Callbacks\CallbackListener;
|
2013-12-05 00:30:10 +01:00
|
|
|
use ManiaControl\Commands\CommandListener;
|
2014-01-04 18:49:33 +01:00
|
|
|
use ManiaControl\ManiaControl;
|
2014-01-04 18:18:46 +01:00
|
|
|
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
|
2014-02-01 19:06:21 +01:00
|
|
|
use ManiaControl\Server\Server;
|
2014-02-13 14:21:25 +01:00
|
|
|
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
|
2013-12-05 00:30:10 +01:00
|
|
|
|
|
|
|
/**
|
2014-01-06 16:14:49 +01:00
|
|
|
* Class offering various Admin Commands related to Players
|
2013-12-05 00:30:10 +01:00
|
|
|
*
|
|
|
|
* @author steeffeen & kremsy
|
2014-04-12 12:14:37 +02:00
|
|
|
* @copyright ManiaControl Copyright © 2014 ManiaControl Team
|
|
|
|
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
|
2013-12-05 00:30:10 +01:00
|
|
|
*/
|
2014-02-01 19:06:21 +01:00
|
|
|
class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, CallbackListener {
|
2014-04-12 12:14:37 +02:00
|
|
|
/*
|
2014-01-04 18:18:46 +01:00
|
|
|
* Constants
|
|
|
|
*/
|
2014-01-31 16:55:01 +01:00
|
|
|
const ACTION_BALANCE_TEAMS = 'PlayerCommands.BalanceTeams';
|
|
|
|
const ACTION_OPEN_PLAYERLIST = 'PlayerCommands.OpenPlayerList';
|
|
|
|
const SETTING_PERMISSION_ADD_BOT = 'Add Bot';
|
|
|
|
const SETTING_PERMISSION_TEAM_BALANCE = 'Balance Teams';
|
2014-01-10 13:28:48 +01:00
|
|
|
|
2014-04-12 12:14:37 +02:00
|
|
|
/*
|
2014-01-06 16:14:49 +01:00
|
|
|
* Private Properties
|
2013-12-05 00:30:10 +01:00
|
|
|
*/
|
|
|
|
private $maniaControl = null;
|
2014-01-04 18:49:33 +01:00
|
|
|
|
2013-12-05 00:30:10 +01:00
|
|
|
/**
|
2014-01-06 16:14:49 +01:00
|
|
|
* Create a new Player Commands Instance
|
2013-12-05 00:30:10 +01:00
|
|
|
*
|
2014-01-04 18:49:33 +01:00
|
|
|
* @param ManiaControl $maniaControl
|
2013-12-05 00:30:10 +01:00
|
|
|
*/
|
|
|
|
public function __construct(ManiaControl $maniaControl) {
|
|
|
|
$this->maniaControl = $maniaControl;
|
2014-01-10 13:28:48 +01:00
|
|
|
|
2013-12-14 22:00:59 +01:00
|
|
|
// Register for admin commands
|
2014-01-04 18:49:33 +01:00
|
|
|
$this->maniaControl->commandManager->registerCommandListener('balance', $this, 'command_TeamBalance', true);
|
|
|
|
$this->maniaControl->commandManager->registerCommandListener('teambalance', $this, 'command_TeamBalance', true);
|
|
|
|
$this->maniaControl->commandManager->registerCommandListener('autoteambalance', $this, 'command_TeamBalance', true);
|
|
|
|
$this->maniaControl->commandManager->registerCommandListener('kick', $this, 'command_Kick', true);
|
|
|
|
$this->maniaControl->commandManager->registerCommandListener('forcespec', $this, 'command_ForceSpectator', true);
|
|
|
|
$this->maniaControl->commandManager->registerCommandListener('forcespectator', $this, 'command_ForceSpectator', true);
|
2014-01-06 18:09:47 +01:00
|
|
|
$this->maniaControl->commandManager->registerCommandListener('forceplay', $this, 'command_ForcePlay', true);
|
|
|
|
$this->maniaControl->commandManager->registerCommandListener('forceblue', $this, 'command_ForceBlue', true);
|
|
|
|
$this->maniaControl->commandManager->registerCommandListener('forcered', $this, 'command_ForceRed', true);
|
2014-01-04 18:49:33 +01:00
|
|
|
$this->maniaControl->commandManager->registerCommandListener('addbot', $this, 'command_AddFakePlayers', true);
|
|
|
|
$this->maniaControl->commandManager->registerCommandListener('removebot', $this, 'command_RemoveFakePlayers', true);
|
|
|
|
$this->maniaControl->commandManager->registerCommandListener('addbots', $this, 'command_AddFakePlayers', true);
|
|
|
|
$this->maniaControl->commandManager->registerCommandListener('removebots', $this, 'command_RemoveFakePlayers', true);
|
2014-01-06 17:33:45 +01:00
|
|
|
$this->maniaControl->commandManager->registerCommandListener('mute', $this, 'command_MutePlayer', true);
|
|
|
|
$this->maniaControl->commandManager->registerCommandListener('unmute', $this, 'command_UnmutePlayer', true);
|
2014-01-10 13:28:48 +01:00
|
|
|
|
2013-12-18 15:48:33 +01:00
|
|
|
// Register for player chat commands
|
|
|
|
$this->maniaControl->commandManager->registerCommandListener('player', $this, 'command_playerList');
|
|
|
|
$this->maniaControl->commandManager->registerCommandListener('players', $this, 'command_playerList');
|
2014-01-10 13:28:48 +01:00
|
|
|
|
2014-01-31 16:55:01 +01:00
|
|
|
//Define Rights
|
|
|
|
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_ADD_BOT, AuthenticationManager::AUTH_LEVEL_MODERATOR);
|
|
|
|
$this->maniaControl->authenticationManager->definePermissionLevel(self::SETTING_PERMISSION_TEAM_BALANCE, AuthenticationManager::AUTH_LEVEL_MODERATOR);
|
|
|
|
|
2014-02-01 19:06:21 +01:00
|
|
|
//CallbackManager
|
2014-02-19 15:44:00 +01:00
|
|
|
$this->maniaControl->callbackManager->registerCallbackListener(Server::CB_TEAM_MODE_CHANGED, $this, 'teamStatusChanged');
|
2014-01-10 13:28:48 +01:00
|
|
|
|
2014-01-06 16:14:49 +01:00
|
|
|
// Action Open Playerlist
|
2014-01-04 18:49:33 +01:00
|
|
|
$this->maniaControl->manialinkManager->registerManialinkPageAnswerListener(self::ACTION_OPEN_PLAYERLIST, $this, 'command_playerList');
|
2014-01-05 00:43:46 +01:00
|
|
|
$itemQuad = new Quad_UIConstruction_Buttons();
|
|
|
|
$itemQuad->setSubStyle($itemQuad::SUBSTYLE_Author);
|
2014-01-04 18:49:33 +01:00
|
|
|
$itemQuad->setAction(self::ACTION_OPEN_PLAYERLIST);
|
2014-01-05 01:29:49 +01:00
|
|
|
$this->maniaControl->actionsMenu->addMenuItem($itemQuad, true, 15, 'Open Playerlist');
|
2014-01-04 18:49:33 +01:00
|
|
|
}
|
|
|
|
|
2014-02-01 19:06:21 +01:00
|
|
|
/**
|
|
|
|
* Handle TeamStatusChanged
|
2014-02-19 15:44:00 +01:00
|
|
|
*
|
|
|
|
* @param bool $teamMode
|
2014-02-01 19:06:21 +01:00
|
|
|
*/
|
2014-02-19 15:44:00 +01:00
|
|
|
public function teamStatusChanged($teamMode) {
|
2014-02-01 19:06:21 +01:00
|
|
|
//Add Balance Team Icon if it's a teamMode
|
2014-02-19 15:44:00 +01:00
|
|
|
if ($teamMode) {
|
2014-02-01 19:06:21 +01:00
|
|
|
// Action Balance Teams
|
|
|
|
$this->maniaControl->manialinkManager->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->actionsMenu->addMenuItem($itemQuad, false, 40, 'Balance Teams');
|
|
|
|
}
|
|
|
|
}
|
2013-12-05 00:30:10 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle //teambalance command
|
|
|
|
*
|
2014-01-10 13:28:48 +01:00
|
|
|
* @param array $chatCallback
|
2014-01-04 18:49:33 +01:00
|
|
|
* @param Player $player
|
2013-12-05 00:30:10 +01:00
|
|
|
*/
|
|
|
|
public function command_TeamBalance(array $chatCallback, Player $player) {
|
2014-01-31 16:55:01 +01:00
|
|
|
if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_TEAM_BALANCE)) {
|
2013-12-05 00:30:10 +01:00
|
|
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
|
|
|
return;
|
|
|
|
}
|
2014-01-20 20:51:03 +01:00
|
|
|
|
|
|
|
try {
|
|
|
|
$this->maniaControl->client->autoTeamBalance();
|
2014-02-13 14:21:25 +01:00
|
|
|
} catch(Exception $e) {
|
2014-03-01 11:11:50 +01:00
|
|
|
$this->maniaControl->errorHandler->triggerDebugNotice("PlayerCommands Debug Line 110: " . $e->getMessage());
|
2014-02-13 14:21:25 +01:00
|
|
|
// TODO: only catch 'not in team mode' exception - throw others (like connection error)
|
2014-01-20 20:51:03 +01:00
|
|
|
$this->maniaControl->chat->sendError('Error occurred: ' . $e->getMessage(), $player->login);
|
2013-12-05 00:30:10 +01:00
|
|
|
return;
|
|
|
|
}
|
2014-01-20 20:51:03 +01:00
|
|
|
|
2013-12-05 00:30:10 +01:00
|
|
|
$this->maniaControl->chat->sendInformation('$<' . $player->nickname . '$> balanced Teams!');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle //kick command
|
|
|
|
*
|
2014-01-10 13:28:48 +01:00
|
|
|
* @param array $chat
|
2014-01-04 18:49:33 +01:00
|
|
|
* @param Player $player
|
2013-12-05 00:30:10 +01:00
|
|
|
*/
|
|
|
|
public function command_Kick(array $chat, Player $player) {
|
2014-01-31 16:55:01 +01:00
|
|
|
if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_KICK_PLAYER)) {
|
2013-12-05 00:30:10 +01:00
|
|
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
$params = explode(' ', $chat[1][2], 3);
|
2014-01-31 16:55:01 +01:00
|
|
|
if (count($params) <= 1) {
|
2014-01-06 17:33:45 +01:00
|
|
|
$this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//kick login'", $player->login);
|
2013-12-05 00:30:10 +01:00
|
|
|
return;
|
|
|
|
}
|
2014-01-06 17:33:45 +01:00
|
|
|
$targetLogin = $params[1];
|
2014-01-10 13:28:48 +01:00
|
|
|
$message = '';
|
2014-01-31 16:55:01 +01:00
|
|
|
if (isset($params[2])) {
|
2013-12-05 00:30:10 +01:00
|
|
|
$message = $params[2];
|
|
|
|
}
|
2014-01-06 17:33:45 +01:00
|
|
|
$this->maniaControl->playerManager->playerActions->kickPlayer($player->login, $targetLogin, $message);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle //warn Command
|
|
|
|
*
|
2014-01-10 13:28:48 +01:00
|
|
|
* @param array $chatCallback
|
2014-01-06 17:33:45 +01:00
|
|
|
* @param Player $player
|
|
|
|
*/
|
2014-01-12 20:59:32 +01:00
|
|
|
public function command_Warn(array $chat, Player $player) {
|
2014-01-06 17:33:45 +01:00
|
|
|
$params = explode(' ', $chat[1][2], 3);
|
2014-01-31 16:55:01 +01:00
|
|
|
if (count($params) <= 1) {
|
2014-01-06 17:33:45 +01:00
|
|
|
$this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//kick login'", $player->login);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
$targetLogin = $params[1];
|
|
|
|
$this->maniaControl->playerManager->playerActions->warnPlayer($player->login, $targetLogin);
|
2013-12-05 00:30:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle //forcespec command
|
|
|
|
*
|
2014-01-10 13:28:48 +01:00
|
|
|
* @param array $chat
|
2014-01-04 18:49:33 +01:00
|
|
|
* @param Player $player
|
2013-12-05 00:30:10 +01:00
|
|
|
*/
|
|
|
|
public function command_ForceSpectator(array $chat, Player $player) {
|
2014-01-31 16:55:01 +01:00
|
|
|
if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_SPEC)) {
|
2013-12-05 00:30:10 +01:00
|
|
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
$params = explode(' ', $chat[1][2]);
|
2014-01-31 16:55:01 +01:00
|
|
|
if (count($params) <= 1) {
|
2014-01-06 17:33:45 +01:00
|
|
|
$this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//forcespec login'", $player->login);
|
2013-12-05 00:30:10 +01:00
|
|
|
return;
|
|
|
|
}
|
2014-01-06 17:33:45 +01:00
|
|
|
$targetLogin = $params[1];
|
2014-01-10 13:28:48 +01:00
|
|
|
|
2014-01-31 16:55:01 +01:00
|
|
|
if (isset($params[2]) && is_numeric($params[2])) {
|
2014-01-10 13:28:48 +01:00
|
|
|
$type = (int)$params[2];
|
2014-01-06 17:33:45 +01:00
|
|
|
$this->maniaControl->playerManager->playerActions->forcePlayerToSpectator($player->login, $targetLogin, $type);
|
2014-01-10 13:28:48 +01:00
|
|
|
} else {
|
2014-01-06 17:33:45 +01:00
|
|
|
$this->maniaControl->playerManager->playerActions->forcePlayerToSpectator($player->login, $targetLogin);
|
2013-12-05 00:30:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle //forceplay command
|
|
|
|
*
|
2014-01-10 13:28:48 +01:00
|
|
|
* @param array $chat
|
2014-01-04 18:49:33 +01:00
|
|
|
* @param Player $player
|
2013-12-05 00:30:10 +01:00
|
|
|
*/
|
2014-01-06 18:09:47 +01:00
|
|
|
public function command_ForcePlay(array $chat, Player $player) {
|
2014-01-31 16:55:01 +01:00
|
|
|
if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_PLAY)) {
|
2013-12-05 00:30:10 +01:00
|
|
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
$params = explode(' ', $chat[1][2]);
|
2014-01-31 16:55:01 +01:00
|
|
|
if (!isset($params[1])) {
|
2014-01-06 18:09:47 +01:00
|
|
|
$this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//forceplay login'", $player->login);
|
2013-12-05 00:30:10 +01:00
|
|
|
return;
|
|
|
|
}
|
2014-01-06 18:09:47 +01:00
|
|
|
$targetLogin = $params[1];
|
2014-01-10 13:28:48 +01:00
|
|
|
|
2013-12-05 00:30:10 +01:00
|
|
|
$type = 2;
|
2014-01-31 16:55:01 +01:00
|
|
|
if (isset($params[2]) && is_numeric($params[2])) {
|
2013-12-05 00:30:10 +01:00
|
|
|
$type = intval($params[2]);
|
|
|
|
}
|
2014-01-14 14:37:31 +01:00
|
|
|
$selectable = false;
|
2014-01-31 16:55:01 +01:00
|
|
|
if ($type == 2) {
|
2014-01-14 14:37:31 +01:00
|
|
|
$selectable = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->maniaControl->playerManager->playerActions->forcePlayerToPlay($player->login, $targetLogin, $selectable);
|
2014-01-06 18:09:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle //forceblue command
|
|
|
|
*
|
2014-01-10 13:28:48 +01:00
|
|
|
* @param array $chat
|
2014-01-06 18:09:47 +01:00
|
|
|
* @param Player $player
|
|
|
|
*/
|
|
|
|
public function command_ForceBlue(array $chat, Player $player) {
|
2014-01-31 16:55:01 +01:00
|
|
|
if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) {
|
2014-01-06 18:09:47 +01:00
|
|
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
2013-12-05 00:30:10 +01:00
|
|
|
return;
|
|
|
|
}
|
2014-01-06 18:09:47 +01:00
|
|
|
$params = explode(' ', $chat[1][2]);
|
2014-01-31 16:55:01 +01:00
|
|
|
if (!isset($params[1])) {
|
2014-01-06 18:09:47 +01:00
|
|
|
$this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//forceblue login'", $player->login);
|
|
|
|
return;
|
2013-12-05 00:30:10 +01:00
|
|
|
}
|
2014-01-06 18:09:47 +01:00
|
|
|
$targetLogin = $params[1];
|
2014-01-10 13:28:48 +01:00
|
|
|
|
2014-01-06 18:09:47 +01:00
|
|
|
$this->maniaControl->playerManager->playerActions->forcePlayerToTeam($player->login, $targetLogin, PlayerActions::TEAM_BLUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle //forcered command
|
|
|
|
*
|
2014-01-10 13:28:48 +01:00
|
|
|
* @param array $chat
|
2014-01-06 18:09:47 +01:00
|
|
|
* @param Player $player
|
|
|
|
*/
|
|
|
|
public function command_ForceRed(array $chat, Player $player) {
|
2014-01-31 16:55:01 +01:00
|
|
|
if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) {
|
2014-01-06 18:09:47 +01:00
|
|
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
$params = explode(' ', $chat[1][2]);
|
2014-01-31 16:55:01 +01:00
|
|
|
if (!isset($params[1])) {
|
2014-01-06 18:09:47 +01:00
|
|
|
$this->maniaControl->chat->sendUsageInfo("No Login given! Example: '//forcered login'", $player->login);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
$targetLogin = $params[1];
|
2014-01-10 13:28:48 +01:00
|
|
|
|
2014-01-06 18:09:47 +01:00
|
|
|
$this->maniaControl->playerManager->playerActions->forcePlayerToTeam($player->login, $targetLogin, PlayerActions::TEAM_RED);
|
2013-12-05 00:30:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle //addfakeplayers command
|
|
|
|
*
|
2014-01-10 13:28:48 +01:00
|
|
|
* @param array $chatCallback
|
2014-01-04 18:49:33 +01:00
|
|
|
* @param Player $player
|
2013-12-05 00:30:10 +01:00
|
|
|
*/
|
|
|
|
public function command_AddFakePlayers(array $chatCallback, Player $player) {
|
2014-01-31 16:55:01 +01:00
|
|
|
if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_ADD_BOT)) {
|
2013-12-05 00:30:10 +01:00
|
|
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
|
|
|
return;
|
|
|
|
}
|
2014-01-10 13:28:48 +01:00
|
|
|
$amount = 1;
|
2013-12-05 00:30:10 +01:00
|
|
|
$messageParts = explode(' ', $chatCallback[1][2]);
|
2014-01-31 16:55:01 +01:00
|
|
|
if (isset($messageParts[1]) && is_numeric($messageParts[1])) {
|
2013-12-05 00:30:10 +01:00
|
|
|
$amount = intval($messageParts[1]);
|
|
|
|
}
|
2014-02-13 14:21:25 +01:00
|
|
|
for ($i = 0; $i < $amount; $i++) {
|
|
|
|
$this->maniaControl->client->connectFakePlayer();
|
2013-12-05 00:30:10 +01:00
|
|
|
}
|
|
|
|
$this->maniaControl->chat->sendSuccess('Fake players connected!', $player->login);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle //removefakeplayers command
|
|
|
|
*
|
2014-01-10 13:28:48 +01:00
|
|
|
* @param array $chatCallback
|
2014-01-04 18:49:33 +01:00
|
|
|
* @param Player $player
|
2013-12-05 00:30:10 +01:00
|
|
|
*/
|
|
|
|
public function command_RemoveFakePlayers(array $chatCallback, Player $player) {
|
2014-01-31 16:55:01 +01:00
|
|
|
if (!$this->maniaControl->authenticationManager->checkPermission($player, self::SETTING_PERMISSION_ADD_BOT)) {
|
2013-12-05 00:30:10 +01:00
|
|
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
|
|
|
return;
|
|
|
|
}
|
2014-02-13 14:21:25 +01:00
|
|
|
$this->maniaControl->client->disconnectFakePlayer('*');
|
2013-12-05 00:30:10 +01:00
|
|
|
$this->maniaControl->chat->sendSuccess('Fake players disconnected!', $player->login);
|
|
|
|
}
|
2013-12-18 15:48:33 +01:00
|
|
|
|
2014-01-06 17:33:45 +01:00
|
|
|
/**
|
|
|
|
* Handle //mute Command
|
|
|
|
*
|
2014-01-10 13:28:48 +01:00
|
|
|
* @param array $chatCallback
|
2014-01-06 17:33:45 +01:00
|
|
|
* @param Player $admin
|
|
|
|
*/
|
|
|
|
public function command_MutePlayer(array $chatCallback, Player $admin) {
|
|
|
|
$commandParts = explode(' ', $chatCallback[1][2]);
|
2014-01-31 16:55:01 +01:00
|
|
|
if (count($commandParts) <= 1) {
|
2014-01-06 17:33:45 +01:00
|
|
|
$this->maniaControl->chat->sendUsageInfo("No login specified! Example: '//mute login'");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
$targetLogin = $commandParts[1];
|
|
|
|
$this->maniaControl->playerManager->playerActions->mutePlayer($admin->login, $targetLogin);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handle //unmute Command
|
|
|
|
*
|
2014-01-10 13:28:48 +01:00
|
|
|
* @param array $chatCallback
|
2014-01-06 17:33:45 +01:00
|
|
|
* @param Player $admin
|
|
|
|
*/
|
|
|
|
public function command_UnmutePlayer(array $chatCallback, Player $admin) {
|
|
|
|
$commandParts = explode(' ', $chatCallback[1][2]);
|
2014-01-31 16:55:01 +01:00
|
|
|
if (count($commandParts) <= 1) {
|
2014-01-06 17:33:45 +01:00
|
|
|
$this->maniaControl->chat->sendUsageInfo("No login specified! Example: '//unmute login'");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
$targetLogin = $commandParts[1];
|
|
|
|
$this->maniaControl->playerManager->playerActions->unMutePlayer($admin->login, $targetLogin);
|
|
|
|
}
|
|
|
|
|
2013-12-18 15:48:33 +01:00
|
|
|
/**
|
|
|
|
* Handle Player list command
|
2014-01-04 18:49:33 +01:00
|
|
|
*
|
2014-01-10 13:28:48 +01:00
|
|
|
* @param array $chatCallback
|
2013-12-18 15:48:33 +01:00
|
|
|
* @param Player $player
|
|
|
|
*/
|
|
|
|
public function command_playerList(array $chatCallback, Player $player) {
|
2014-01-06 16:14:49 +01:00
|
|
|
$this->maniaControl->playerManager->playerList->addPlayerToShownList($player, PlayerList::SHOWN_MAIN_WINDOW);
|
|
|
|
$this->maniaControl->playerManager->playerList->showPlayerList($player);
|
2013-12-18 15:48:33 +01:00
|
|
|
}
|
2013-12-05 00:30:10 +01:00
|
|
|
}
|