| @@ 14-58 (lines=45) @@ | ||
| 11 | * @package eXpansion\Bundle\AdminChat\ChatCommand; |
|
| 12 | * @author reaby |
|
| 13 | */ |
|
| 14 | class Ban extends AbstractConnectionCommand |
|
| 15 | { |
|
| 16 | /** |
|
| 17 | * @inheritdoc |
|
| 18 | */ |
|
| 19 | protected function configure() |
|
| 20 | { |
|
| 21 | parent::configure(); |
|
| 22 | ||
| 23 | $this->inputDefinition->addArgument( |
|
| 24 | new InputArgument('login', InputArgument::REQUIRED, 'Login of player to ban.') |
|
| 25 | ); |
|
| 26 | $this->inputDefinition->addArgument( |
|
| 27 | new InputArgument('reason', InputArgument::REQUIRED, 'The reason for banning.') |
|
| 28 | ); |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @inheritdoc |
|
| 33 | */ |
|
| 34 | public function getDescription() |
|
| 35 | { |
|
| 36 | return 'expansion_admin_chat.ban.description'; |
|
| 37 | } |
|
| 38 | ||
| 39 | /** |
|
| 40 | * @inheritdoc |
|
| 41 | */ |
|
| 42 | public function execute($login, InputInterface $input) |
|
| 43 | { |
|
| 44 | $nickName = $this->playerStorage->getPlayerInfo($login)->getNickName(); |
|
| 45 | $playerLogin = $input->getArgument('login'); |
|
| 46 | $reason = $input->getArgument('reason'); |
|
| 47 | ||
| 48 | $playerNickName = $this->playerStorage->getPlayerInfo($playerLogin)->getNickName(); |
|
| 49 | ||
| 50 | $this->chatNotification->sendMessage( |
|
| 51 | 'expansion_admin_chat.ban.msg', |
|
| 52 | null, |
|
| 53 | ['%admin%' => $nickName, '%player%' => $playerNickName, "%reason%" => $reason] |
|
| 54 | ); |
|
| 55 | ||
| 56 | $this->connection->ban($playerLogin, $reason); |
|
| 57 | } |
|
| 58 | } |
|
| 59 | ||
| @@ 14-58 (lines=45) @@ | ||
| 11 | * @package eXpansion\Bundle\AdminChat\ChatCommand; |
|
| 12 | * @author reaby |
|
| 13 | */ |
|
| 14 | class Black extends AbstractConnectionCommand |
|
| 15 | { |
|
| 16 | /** |
|
| 17 | * @inheritdoc |
|
| 18 | */ |
|
| 19 | protected function configure() |
|
| 20 | { |
|
| 21 | parent::configure(); |
|
| 22 | ||
| 23 | $this->inputDefinition->addArgument( |
|
| 24 | new InputArgument('login', InputArgument::REQUIRED, 'Login of player to blacklist.') |
|
| 25 | ); |
|
| 26 | $this->inputDefinition->addArgument( |
|
| 27 | new InputArgument('reason', InputArgument::REQUIRED, 'The reason for blacklisting.') |
|
| 28 | ); |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @inheritdoc |
|
| 33 | */ |
|
| 34 | public function getDescription() |
|
| 35 | { |
|
| 36 | return 'expansion_admin_chat.black.description'; |
|
| 37 | } |
|
| 38 | ||
| 39 | /** |
|
| 40 | * @inheritdoc |
|
| 41 | */ |
|
| 42 | public function execute($login, InputInterface $input) |
|
| 43 | { |
|
| 44 | $nickName = $this->playerStorage->getPlayerInfo($login)->getNickName(); |
|
| 45 | $playerLogin = $input->getArgument('login'); |
|
| 46 | $reason = $input->getArgument('reason'); |
|
| 47 | ||
| 48 | $playerNickName = $this->playerStorage->getPlayerInfo($playerLogin)->getNickName(); |
|
| 49 | ||
| 50 | $this->chatNotification->sendMessage( |
|
| 51 | 'expansion_admin_chat.black.msg', |
|
| 52 | null, |
|
| 53 | ['%admin%' => $nickName, '%player%' => $playerNickName, "%reason%" => $reason] |
|
| 54 | ); |
|
| 55 | ||
| 56 | $this->connection->banAndBlackList($playerLogin, $reason); |
|
| 57 | } |
|
| 58 | } |
|
| 59 | ||
| @@ 14-58 (lines=45) @@ | ||
| 11 | * @package eXpansion\Bundle\AdminChat\ChatCommand; |
|
| 12 | * @author reaby |
|
| 13 | */ |
|
| 14 | class Kick extends AbstractConnectionCommand |
|
| 15 | { |
|
| 16 | /** |
|
| 17 | * @inheritdoc |
|
| 18 | */ |
|
| 19 | protected function configure() |
|
| 20 | { |
|
| 21 | parent::configure(); |
|
| 22 | ||
| 23 | $this->inputDefinition->addArgument( |
|
| 24 | new InputArgument('login', InputArgument::REQUIRED, 'Login of player to kick.') |
|
| 25 | ); |
|
| 26 | $this->inputDefinition->addArgument( |
|
| 27 | new InputArgument('reason', InputArgument::REQUIRED, 'The reason for kicking.') |
|
| 28 | ); |
|
| 29 | } |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @inheritdoc |
|
| 33 | */ |
|
| 34 | public function getDescription() |
|
| 35 | { |
|
| 36 | return 'expansion_admin_chat.kick.description'; |
|
| 37 | } |
|
| 38 | ||
| 39 | /** |
|
| 40 | * @inheritdoc |
|
| 41 | */ |
|
| 42 | public function execute($login, InputInterface $input) |
|
| 43 | { |
|
| 44 | $nickName = $this->playerStorage->getPlayerInfo($login)->getNickName(); |
|
| 45 | $playerLogin = $input->getArgument('login'); |
|
| 46 | $reason = $input->getArgument('reason'); |
|
| 47 | ||
| 48 | $playerNickName = $this->playerStorage->getPlayerInfo($playerLogin)->getNickName(); |
|
| 49 | ||
| 50 | $this->chatNotification->sendMessage( |
|
| 51 | 'expansion_admin_chat.kick.msg', |
|
| 52 | null, |
|
| 53 | ['%admin%' => $nickName, '%player%' => $playerNickName, "%reason%" => $reason] |
|
| 54 | ); |
|
| 55 | ||
| 56 | $this->connection->kick($playerLogin, $reason); |
|
| 57 | } |
|
| 58 | } |
|
| 59 | ||