renamed player actions class

This commit is contained in:
Steffen Schröder 2014-07-19 23:37:19 +02:00
parent 61d80b340d
commit f0862f7f16
7 changed files with 44 additions and 44 deletions

View File

@ -207,7 +207,7 @@ class AdminLists implements ManialinkPageAnswerListener, CallbackListener {
switch ($action) {
case self::ACTION_REVOKE_RIGHTS:
$this->maniaControl->playerManager->playerActions->revokeAuthLevel($adminLogin, $targetLogin);
$this->maniaControl->playerManager->actions->revokeAuthLevel($adminLogin, $targetLogin);
break;
}
}

View File

@ -24,7 +24,7 @@ use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
* @copyright 2014 ManiaControl Team
* @license http://www.gnu.org/licenses/ GNU General Public License, Version 3
*/
class PlayerActions {
class Actions {
/*
* Constants
*/
@ -52,7 +52,7 @@ class PlayerActions {
private $maniaControl = null;
/**
* Create a PlayerActions Instance
* Create a new Player Actions Instance
*
* @param ManiaControl $maniaControl
*/

View File

@ -119,7 +119,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
* @param Player $player
*/
public function command_Kick(array $chat, Player $player) {
if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_KICK_PLAYER)) {
if (!$this->maniaControl->authenticationManager->checkPermission($player, Actions::SETTING_PERMISSION_KICK_PLAYER)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player);
return;
}
@ -133,7 +133,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
if (isset($params[2])) {
$message = $params[2];
}
$this->maniaControl->playerManager->playerActions->kickPlayer($player->login, $targetLogin, $message);
$this->maniaControl->playerManager->actions->kickPlayer($player->login, $targetLogin, $message);
}
/**
@ -143,7 +143,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
* @param Player $player
*/
public function command_Ban(array $chat, Player $player) {
if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_BAN_PLAYER)) {
if (!$this->maniaControl->authenticationManager->checkPermission($player, Actions::SETTING_PERMISSION_BAN_PLAYER)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player);
return;
}
@ -157,7 +157,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
if (isset($params[2])) {
$message = $params[2];
}
$this->maniaControl->playerManager->playerActions->banPlayer($player->login, $targetLogin, $message);
$this->maniaControl->playerManager->actions->banPlayer($player->login, $targetLogin, $message);
}
/**
@ -173,7 +173,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
return;
}
$targetLogin = $params[1];
$this->maniaControl->playerManager->playerActions->warnPlayer($player->login, $targetLogin);
$this->maniaControl->playerManager->actions->warnPlayer($player->login, $targetLogin);
}
/**
@ -183,7 +183,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
* @param Player $player
*/
public function command_ForceSpectator(array $chat, Player $player) {
if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_SPEC)) {
if (!$this->maniaControl->authenticationManager->checkPermission($player, Actions::SETTING_PERMISSION_FORCE_PLAYER_SPEC)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player);
return;
}
@ -196,9 +196,9 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
if (isset($params[2]) && is_numeric($params[2])) {
$type = (int)$params[2];
$this->maniaControl->playerManager->playerActions->forcePlayerToSpectator($player->login, $targetLogin, $type);
$this->maniaControl->playerManager->actions->forcePlayerToSpectator($player->login, $targetLogin, $type);
} else {
$this->maniaControl->playerManager->playerActions->forcePlayerToSpectator($player->login, $targetLogin);
$this->maniaControl->playerManager->actions->forcePlayerToSpectator($player->login, $targetLogin);
}
}
@ -209,7 +209,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
* @param Player $player
*/
public function command_ForcePlay(array $chat, Player $player) {
if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_PLAY)) {
if (!$this->maniaControl->authenticationManager->checkPermission($player, Actions::SETTING_PERMISSION_FORCE_PLAYER_PLAY)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player);
return;
}
@ -226,7 +226,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
}
$selectable = ($type === 2);
$this->maniaControl->playerManager->playerActions->forcePlayerToPlay($player->login, $targetLogin, $selectable);
$this->maniaControl->playerManager->actions->forcePlayerToPlay($player->login, $targetLogin, $selectable);
}
/**
@ -236,7 +236,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
* @param Player $player
*/
public function command_ForceBlue(array $chat, Player $player) {
if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) {
if (!$this->maniaControl->authenticationManager->checkPermission($player, Actions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player);
return;
}
@ -247,7 +247,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
}
$targetLogin = $params[1];
$this->maniaControl->playerManager->playerActions->forcePlayerToTeam($player->login, $targetLogin, PlayerActions::TEAM_BLUE);
$this->maniaControl->playerManager->actions->forcePlayerToTeam($player->login, $targetLogin, Actions::TEAM_BLUE);
}
/**
@ -257,7 +257,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
* @param Player $player
*/
public function command_ForceRed(array $chat, Player $player) {
if (!$this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) {
if (!$this->maniaControl->authenticationManager->checkPermission($player, Actions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) {
$this->maniaControl->authenticationManager->sendNotAllowed($player);
return;
}
@ -268,7 +268,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
}
$targetLogin = $params[1];
$this->maniaControl->playerManager->playerActions->forcePlayerToTeam($player->login, $targetLogin, PlayerActions::TEAM_RED);
$this->maniaControl->playerManager->actions->forcePlayerToTeam($player->login, $targetLogin, Actions::TEAM_RED);
}
/**
@ -326,7 +326,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
return;
}
$targetLogin = $commandParts[1];
$this->maniaControl->playerManager->playerActions->mutePlayer($admin->login, $targetLogin);
$this->maniaControl->playerManager->actions->mutePlayer($admin->login, $targetLogin);
}
/**
@ -342,7 +342,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
return;
}
$targetLogin = $commandParts[1];
$this->maniaControl->playerManager->playerActions->unMutePlayer($admin->login, $targetLogin);
$this->maniaControl->playerManager->actions->unMutePlayer($admin->login, $targetLogin);
}
/**

View File

@ -317,7 +317,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
}
if ($this->maniaControl->server->isTeamMode()) {
if ($this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) {
if ($this->maniaControl->authenticationManager->checkPermission($player, Actions::SETTING_PERMISSION_FORCE_PLAYER_TEAM)) {
// Force to Red-Team Quad
$redQuad = new Quad_Emblems();
$playerFrame->add($redQuad);
@ -358,7 +358,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$kickQuad->addTooltipLabelFeature($descriptionLabel, $description);
}
} else {
if ($this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_PLAY)) {
if ($this->maniaControl->authenticationManager->checkPermission($player, Actions::SETTING_PERMISSION_FORCE_PLAYER_PLAY)) {
// Force to Play
$playQuad = new Quad_Emblems();
$playerFrame->add($playQuad);
@ -373,7 +373,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
}
}
if ($this->maniaControl->authenticationManager->checkPermission($player, PlayerActions::SETTING_PERMISSION_FORCE_PLAYER_SPEC)) {
if ($this->maniaControl->authenticationManager->checkPermission($player, Actions::SETTING_PERMISSION_FORCE_PLAYER_SPEC)) {
// Force to Spectator Quad
$spectatorQuad = new Quad_BgRaceScore2();
$playerFrame->add($spectatorQuad);
@ -505,7 +505,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$label->setTextSize($textSize);
$label->setTextColor($textColor);
if (!$this->maniaControl->playerManager->playerActions->isPlayerMuted($login)) {
if (!$this->maniaControl->playerManager->actions->isPlayerMuted($login)) {
$label->setText('Mute');
$quad->setAction(self::ACTION_MUTE_PLAYER . '.' . $login);
} else {
@ -629,7 +629,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
switch ($action) {
case self::ACTION_SPECTATE_PLAYER:
try {
$this->maniaControl->client->forceSpectator($adminLogin, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE);
$this->maniaControl->client->forceSpectator($adminLogin, Actions::SPECTATOR_BUT_KEEP_SELECTABLE);
$this->maniaControl->client->forceSpectatorTarget($adminLogin, $targetLogin, 1);
} catch (PlayerStateException $e) {
}
@ -640,49 +640,49 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
unset($this->playersListShown[$player->login]);
break;
case self::ACTION_FORCE_BLUE:
$this->maniaControl->playerManager->playerActions->forcePlayerToTeam($adminLogin, $targetLogin, PlayerActions::TEAM_BLUE);
$this->maniaControl->playerManager->actions->forcePlayerToTeam($adminLogin, $targetLogin, Actions::TEAM_BLUE);
break;
case self::ACTION_FORCE_RED:
$this->maniaControl->playerManager->playerActions->forcePlayerToTeam($adminLogin, $targetLogin, PlayerActions::TEAM_RED);
$this->maniaControl->playerManager->actions->forcePlayerToTeam($adminLogin, $targetLogin, Actions::TEAM_RED);
break;
case self::ACTION_FORCE_SPEC:
$this->maniaControl->playerManager->playerActions->forcePlayerToSpectator($adminLogin, $targetLogin, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE);
$this->maniaControl->playerManager->actions->forcePlayerToSpectator($adminLogin, $targetLogin, Actions::SPECTATOR_BUT_KEEP_SELECTABLE);
break;
case self::ACTION_FORCE_PLAY:
$this->maniaControl->playerManager->playerActions->forcePlayerToPlay($adminLogin, $targetLogin);
$this->maniaControl->playerManager->actions->forcePlayerToPlay($adminLogin, $targetLogin);
break;
case self::ACTION_MUTE_PLAYER:
$this->maniaControl->playerManager->playerActions->mutePlayer($adminLogin, $targetLogin);
$this->maniaControl->playerManager->actions->mutePlayer($adminLogin, $targetLogin);
$this->showPlayerList($this->maniaControl->playerManager->getPlayer($adminLogin));
break;
case self::ACTION_UNMUTE_PLAYER:
$this->maniaControl->playerManager->playerActions->unMutePlayer($adminLogin, $targetLogin);
$this->maniaControl->playerManager->actions->unMutePlayer($adminLogin, $targetLogin);
$this->showPlayerList($this->maniaControl->playerManager->getPlayer($adminLogin));
break;
case self::ACTION_WARN_PLAYER:
$this->maniaControl->playerManager->playerActions->warnPlayer($adminLogin, $targetLogin);
$this->maniaControl->playerManager->actions->warnPlayer($adminLogin, $targetLogin);
break;
case self::ACTION_KICK_PLAYER:
$this->maniaControl->playerManager->playerActions->kickPlayer($adminLogin, $targetLogin);
$this->maniaControl->playerManager->actions->kickPlayer($adminLogin, $targetLogin);
break;
case self::ACTION_BAN_PLAYER:
$this->maniaControl->playerManager->playerActions->banPlayer($adminLogin, $targetLogin);
$this->maniaControl->playerManager->actions->banPlayer($adminLogin, $targetLogin);
break;
case self::ACTION_PLAYER_ADV:
$admin = $this->maniaControl->playerManager->getPlayer($adminLogin);
$this->advancedPlayerWidget($admin, $targetLogin);
break;
case self::ACTION_ADD_AS_MASTER:
$this->maniaControl->playerManager->playerActions->grandAuthLevel($adminLogin, $targetLogin, AuthenticationManager::AUTH_LEVEL_SUPERADMIN);
$this->maniaControl->playerManager->actions->grandAuthLevel($adminLogin, $targetLogin, AuthenticationManager::AUTH_LEVEL_SUPERADMIN);
break;
case self::ACTION_ADD_AS_ADMIN:
$this->maniaControl->playerManager->playerActions->grandAuthLevel($adminLogin, $targetLogin, AuthenticationManager::AUTH_LEVEL_ADMIN);
$this->maniaControl->playerManager->actions->grandAuthLevel($adminLogin, $targetLogin, AuthenticationManager::AUTH_LEVEL_ADMIN);
break;
case self::ACTION_ADD_AS_MOD:
$this->maniaControl->playerManager->playerActions->grandAuthLevel($adminLogin, $targetLogin, AuthenticationManager::AUTH_LEVEL_MODERATOR);
$this->maniaControl->playerManager->actions->grandAuthLevel($adminLogin, $targetLogin, AuthenticationManager::AUTH_LEVEL_MODERATOR);
break;
case self::ACTION_REVOKE_RIGHTS:
$this->maniaControl->playerManager->playerActions->revokeAuthLevel($adminLogin, $targetLogin);
$this->maniaControl->playerManager->actions->revokeAuthLevel($adminLogin, $targetLogin);
break;
case self::ACTION_FORCE_SPEC_VOTE:
/** @var $votesPlugin CustomVotesPlugin */
@ -700,7 +700,7 @@ class PlayerList implements ManialinkPageAnswerListener, CallbackListener, Timer
$votesPlugin->undefineVote('forcespec');
try {
$this->maniaControl->client->forceSpectator($target->login, PlayerActions::SPECTATOR_BUT_KEEP_SELECTABLE);
$this->maniaControl->client->forceSpectator($target->login, Actions::SPECTATOR_BUT_KEEP_SELECTABLE);
$this->maniaControl->client->spectatorReleasePlayerSlot($target->login);
} catch (PlayerStateException $e) {
} catch (UnknownPlayerException $e){

View File

@ -35,7 +35,7 @@ class PlayerManager implements CallbackListener, TimerListener {
/*
* Public Properties
*/
public $playerActions = null;
public $actions = null;
public $playerCommands = null;
public $playerDetailed = null;
public $playerList = null;
@ -58,7 +58,7 @@ class PlayerManager implements CallbackListener, TimerListener {
$this->initTables();
$this->playerCommands = new PlayerCommands($maniaControl);
$this->playerActions = new PlayerActions($maniaControl);
$this->actions = new Actions($maniaControl);
$this->playerDetailed = new PlayerDetailed($maniaControl);
$this->playerDataManager = new PlayerDataManager($maniaControl);
$this->playerList = new PlayerList($maniaControl);

View File

@ -446,7 +446,7 @@ class CustomVotesPlugin implements CommandListener, CallbackListener, ManialinkP
*/
public function startVote(Player $player, $voteIndex, $function = null) {
//Player is muted
if ($this->maniaControl->playerManager->playerActions->isPlayerMuted($player)) {
if ($this->maniaControl->playerManager->actions->isPlayerMuted($player)) {
$this->maniaControl->chat->sendError('Muted Players are not allowed to start a vote.', $player->login);
return;
}

View File

@ -15,7 +15,7 @@ use ManiaControl\Callbacks\TimerListener;
use ManiaControl\ManiaControl;
use ManiaControl\Manialinks\ManialinkPageAnswerListener;
use ManiaControl\Players\Player;
use ManiaControl\Players\PlayerActions;
use ManiaControl\Players\Actions;
use ManiaControl\Players\PlayerManager;
use ManiaControl\Plugins\Plugin;
use Maniaplanet\DedicatedServer\Xmlrpc\Exception;
@ -337,7 +337,7 @@ class QueuePlugin implements CallbackListener, ManialinkPageAnswerListener, Time
if ($this->maxPlayers > $this->maniaControl->playerManager->getPlayerCount(true)) {
try {
$this->maniaControl->client->forceSpectator($player->login, PlayerActions::SPECTATOR_PLAYER);
$this->maniaControl->client->forceSpectator($player->login, Actions::SPECTATOR_PLAYER);
} catch (Exception $e) {
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
$this->maniaControl->chat->sendError("Error while leaving the Queue", $player->login);
@ -345,7 +345,7 @@ class QueuePlugin implements CallbackListener, ManialinkPageAnswerListener, Time
}
try {
$this->maniaControl->client->forceSpectator($player->login, PlayerActions::SPECTATOR_USER_SELECTABLE);
$this->maniaControl->client->forceSpectator($player->login, Actions::SPECTATOR_USER_SELECTABLE);
} catch (Exception $e) {
// TODO: only possible valid exception should be "wrong login" - throw others (like connection error)
}