Revert "renamed player actions class"

This reverts commit f0862f7f16.
This commit is contained in:
Steffen Schröder 2014-07-19 23:40:16 +02:00
parent 2ae38ed1fa
commit c50e4f5a84
7 changed files with 44 additions and 44 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -35,7 +35,7 @@ class PlayerManager implements CallbackListener, TimerListener {
/* /*
* Public Properties * Public Properties
*/ */
public $actions = null; public $playerActions = null;
public $playerCommands = null; public $playerCommands = null;
public $playerDetailed = null; public $playerDetailed = null;
public $playerList = null; public $playerList = null;
@ -58,7 +58,7 @@ class PlayerManager implements CallbackListener, TimerListener {
$this->initTables(); $this->initTables();
$this->playerCommands = new PlayerCommands($maniaControl); $this->playerCommands = new PlayerCommands($maniaControl);
$this->actions = new Actions($maniaControl); $this->playerActions = new PlayerActions($maniaControl);
$this->playerDetailed = new PlayerDetailed($maniaControl); $this->playerDetailed = new PlayerDetailed($maniaControl);
$this->playerDataManager = new PlayerDataManager($maniaControl); $this->playerDataManager = new PlayerDataManager($maniaControl);
$this->playerList = new PlayerList($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) { public function startVote(Player $player, $voteIndex, $function = null) {
//Player is muted //Player is muted
if ($this->maniaControl->playerManager->actions->isPlayerMuted($player)) { if ($this->maniaControl->playerManager->playerActions->isPlayerMuted($player)) {
$this->maniaControl->chat->sendError('Muted Players are not allowed to start a vote.', $player->login); $this->maniaControl->chat->sendError('Muted Players are not allowed to start a vote.', $player->login);
return; return;
} }

View File

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