- started adding admin commands
! admin commands begin with //
This commit is contained in:
parent
6ce66e1640
commit
b389b32d88
5
application/core/Admin/AdminMenu.php
Normal file
5
application/core/Admin/AdminMenu.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
@ -1,16 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace ManiaControl;
|
namespace ManiaControl\Admin;
|
||||||
|
|
||||||
|
use ManiaControl\FileUtil;
|
||||||
|
use ManiaControl\ManiaControl;
|
||||||
|
use ManiaControl\Commands\CommandListener;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
use ManiaControl\Players\PlayerManager;
|
use ManiaControl\Players\PlayerManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class handling authentication levels
|
* Class managing authentication levels
|
||||||
*
|
*
|
||||||
* @author steeffeen & kremsy
|
* @author steeffeen & kremsy
|
||||||
*/
|
*/
|
||||||
class Authentication {
|
class AuthenticationManager implements CommandListener {
|
||||||
/**
|
/**
|
||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -28,11 +31,13 @@ class Authentication {
|
|||||||
/**
|
/**
|
||||||
* Construct authentication manager
|
* Construct authentication manager
|
||||||
*
|
*
|
||||||
* @param ManiaControl $maniaControl
|
* @param \ManiaControl\ManiaControl $maniaControl
|
||||||
*/
|
*/
|
||||||
public function __construct(ManiaControl $maniaControl) {
|
public function __construct(ManiaControl $maniaControl) {
|
||||||
$this->maniaControl = $maniaControl;
|
$this->maniaControl = $maniaControl;
|
||||||
$this->loadConfig();
|
$this->loadConfig();
|
||||||
|
|
||||||
|
$this->maniaControl->commandManager->registerCommandListener('/addadmin', $this, 'command_AddAdmin');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,7 +50,7 @@ class Authentication {
|
|||||||
$mysqli = $this->maniaControl->database->mysqli;
|
$mysqli = $this->maniaControl->database->mysqli;
|
||||||
|
|
||||||
// Remove all XSuperadmins
|
// Remove all XSuperadmins
|
||||||
$adminQuery = "UPDATE `" . Players\PlayerManager::TABLE_PLAYERS . "`
|
$adminQuery = "UPDATE `" . PlayerManager::TABLE_PLAYERS . "`
|
||||||
SET `authLevel` = ?
|
SET `authLevel` = ?
|
||||||
WHERE `authLevel` = ?;";
|
WHERE `authLevel` = ?;";
|
||||||
$adminStatement = $mysqli->prepare($adminQuery);
|
$adminStatement = $mysqli->prepare($adminQuery);
|
||||||
@ -64,7 +69,7 @@ class Authentication {
|
|||||||
|
|
||||||
// Set XSuperAdmins
|
// Set XSuperAdmins
|
||||||
$xAdmins = $config->xsuperadmins->xpath('login');
|
$xAdmins = $config->xsuperadmins->xpath('login');
|
||||||
$adminQuery = "INSERT INTO `" . Players\PlayerManager::TABLE_PLAYERS . "` (
|
$adminQuery = "INSERT INTO `" . PlayerManager::TABLE_PLAYERS . "` (
|
||||||
`login`,
|
`login`,
|
||||||
`authLevel`
|
`authLevel`
|
||||||
) VALUES (
|
) VALUES (
|
||||||
@ -98,7 +103,7 @@ class Authentication {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function grantAuthLevel(Player $player, $authLevel) {
|
public function grantAuthLevel(Player $player, $authLevel) {
|
||||||
if (!$player || $authLevel >= self::AUTH_LEVEL_XSUPERADMIN) {
|
if (!$player || !is_int($authLevel) || $authLevel >= self::AUTH_LEVEL_XSUPERADMIN) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$mysqli = $this->maniaControl->database->mysqli;
|
$mysqli = $this->maniaControl->database->mysqli;
|
||||||
@ -138,6 +143,40 @@ class Authentication {
|
|||||||
return $this->maniaControl->chat->sendError('You do not have the required rights to perform this command!', $player->login);
|
return $this->maniaControl->chat->sendError('You do not have the required rights to perform this command!', $player->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle //addadmin command
|
||||||
|
*
|
||||||
|
* @param array $chatCallback
|
||||||
|
* @param
|
||||||
|
* \ManiaControl\Players\Player
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function command_AddAdmin(array $chatCallback, Player $player) {
|
||||||
|
var_dump($chatCallback);
|
||||||
|
if (!$this->checkRight($player, self::AUTH_LEVEL_SUPERADMIN)) {
|
||||||
|
$this->sendNotAllowed($player);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$text = $chatCallback[1][2];
|
||||||
|
$commandParts = explode(' ', $text);
|
||||||
|
if (!array_key_exists(1, $commandParts)) {
|
||||||
|
$this->sendAddAdminUsageInfo($player);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send usage example for //addadmin command
|
||||||
|
*
|
||||||
|
* @param Player $player
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function sendAddAdminUsageInfo(Player $player) {
|
||||||
|
$message = "Usage Example: '//addadmin login'";
|
||||||
|
return $this->maniaControl->chat->sendUsageInfo($message);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the player has enough rights
|
* Check if the player has enough rights
|
||||||
*
|
*
|
@ -4,8 +4,8 @@ namespace ManiaControl\Commands;
|
|||||||
|
|
||||||
require_once __DIR__ . '/CommandListener.php';
|
require_once __DIR__ . '/CommandListener.php';
|
||||||
|
|
||||||
use ManiaControl\Authentication;
|
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
|
use ManiaControl\Admin\AuthenticationManager;
|
||||||
use ManiaControl\Callbacks\CallbackListener;
|
use ManiaControl\Callbacks\CallbackListener;
|
||||||
use ManiaControl\Callbacks\CallbackManager;
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
@ -117,8 +117,8 @@ class CommandManager implements CallbackListener, CommandListener {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function command_systeminfo(array $chat, Player $player) {
|
private function command_systeminfo(array $chat, Player $player) {
|
||||||
if (!$this->maniaControl->authentication->checkRight($player, Authentication::AUTH_LEVEL_SUPERADMIN)) {
|
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_SUPERADMIN)) {
|
||||||
$this->maniaControl->authentication->sendNotAllowed($player);
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$systemInfo = $this->maniaControl->server->getSystemInfo();
|
$systemInfo = $this->maniaControl->server->getSystemInfo();
|
||||||
@ -135,8 +135,8 @@ class CommandManager implements CallbackListener, CommandListener {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function command_shutdown(array $chat, Player $player) {
|
private function command_shutdown(array $chat, Player $player) {
|
||||||
if (!$this->maniaControl->authentication->checkRight($player, Authentication::AUTH_LEVEL_SUPERADMIN)) {
|
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_SUPERADMIN)) {
|
||||||
$this->maniaControl->authentication->sendNotAllowed($player);
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return $this->maniaControl->quit("ManiaControl shutdown requested by '{$player->login}'");
|
return $this->maniaControl->quit("ManiaControl shutdown requested by '{$player->login}'");
|
||||||
@ -150,8 +150,8 @@ class CommandManager implements CallbackListener, CommandListener {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function command_shutdownserver(array $chat, Player $player) {
|
private function command_shutdownserver(array $chat, Player $player) {
|
||||||
if (!$this->maniaControl->authentication->checkRight($player, Authentication::AUTH_LEVEL_SUPERADMIN)) {
|
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_SUPERADMIN)) {
|
||||||
$this->maniaControl->authentication->sendNotAllowed($player);
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Check for delayed shutdown
|
// Check for delayed shutdown
|
||||||
@ -190,8 +190,8 @@ class CommandManager implements CallbackListener, CommandListener {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function command_kick(array $chat, Player $player) {
|
private function command_kick(array $chat, Player $player) {
|
||||||
if (!$this->maniaControl->authentication->checkRight($player, Authentication::AUTH_LEVEL_OPERATOR)) {
|
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)) {
|
||||||
$this->maniaControl->authentication->sendNotAllowed($player);
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$params = explode(' ', $chat[1][2], 3);
|
$params = explode(' ', $chat[1][2], 3);
|
||||||
@ -220,8 +220,8 @@ class CommandManager implements CallbackListener, CommandListener {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function command_setservername(array $chat, Player $player) {
|
private function command_setservername(array $chat, Player $player) {
|
||||||
if (!$this->maniaControl->authentication->checkRight($player, Authentication::AUTH_LEVEL_ADMIN)) {
|
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)) {
|
||||||
$this->maniaControl->authentication->sendNotAllowed($player);
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$params = explode(' ', $chat[1][2], 2);
|
$params = explode(' ', $chat[1][2], 2);
|
||||||
|
@ -2,17 +2,18 @@
|
|||||||
|
|
||||||
namespace ManiaControl;
|
namespace ManiaControl;
|
||||||
|
|
||||||
use ManiaControl\Players\PlayerManager;
|
use ManiaControl\Admin\AuthenticationManager;
|
||||||
use ManiaControl\Callbacks\CallbackManager;
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
use ManiaControl\Commands\CommandManager;
|
use ManiaControl\Commands\CommandManager;
|
||||||
use ManiaControl\Manialinks\ManialinkIdHandler;
|
use ManiaControl\Manialinks\ManialinkIdHandler;
|
||||||
use ManiaControl\Maps\MapManager;
|
use ManiaControl\Maps\MapManager;
|
||||||
|
use ManiaControl\Players\PlayerManager;
|
||||||
use ManiaControl\Plugins\PluginManager;
|
use ManiaControl\Plugins\PluginManager;
|
||||||
|
|
||||||
require_once __DIR__ . '/Authentication.php';
|
|
||||||
require_once __DIR__ . '/Callbacks/CallbackManager.php';
|
require_once __DIR__ . '/Callbacks/CallbackManager.php';
|
||||||
require_once __DIR__ . '/Chat.php';
|
|
||||||
require_once __DIR__ . '/Commands/CommandManager.php';
|
require_once __DIR__ . '/Commands/CommandManager.php';
|
||||||
|
require_once __DIR__ . '/Admin/AuthenticationManager.php';
|
||||||
|
require_once __DIR__ . '/Chat.php';
|
||||||
require_once __DIR__ . '/Database.php';
|
require_once __DIR__ . '/Database.php';
|
||||||
require_once __DIR__ . '/FileUtil.php';
|
require_once __DIR__ . '/FileUtil.php';
|
||||||
require_once __DIR__ . '/Formatter.php';
|
require_once __DIR__ . '/Formatter.php';
|
||||||
@ -51,7 +52,7 @@ class ManiaControl {
|
|||||||
/**
|
/**
|
||||||
* Public properties
|
* Public properties
|
||||||
*/
|
*/
|
||||||
public $authentication = null;
|
public $authenticationManager = null;
|
||||||
public $callbackManager = null;
|
public $callbackManager = null;
|
||||||
public $chat = null;
|
public $chat = null;
|
||||||
public $client = null;
|
public $client = null;
|
||||||
@ -80,9 +81,9 @@ class ManiaControl {
|
|||||||
$this->settingManager = new SettingManager($this);
|
$this->settingManager = new SettingManager($this);
|
||||||
$this->chat = new Chat($this);
|
$this->chat = new Chat($this);
|
||||||
$this->server = new Server($this);
|
$this->server = new Server($this);
|
||||||
$this->authentication = new Authentication($this);
|
|
||||||
$this->playerManager = new PlayerManager($this);
|
|
||||||
$this->commandManager = new CommandManager($this);
|
$this->commandManager = new CommandManager($this);
|
||||||
|
$this->authenticationManager = new AuthenticationManager($this);
|
||||||
|
$this->playerManager = new PlayerManager($this);
|
||||||
$this->mapManager = new MapManager($this);
|
$this->mapManager = new MapManager($this);
|
||||||
$this->pluginManager = new PluginManager($this);
|
$this->pluginManager = new PluginManager($this);
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace ManiaControl\Maps;
|
namespace ManiaControl\Maps;
|
||||||
|
|
||||||
use ManiaControl\Authentication;
|
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
|
use ManiaControl\Admin\AuthenticationManager;
|
||||||
use ManiaControl\Commands\CommandListener;
|
use ManiaControl\Commands\CommandListener;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
|
|
||||||
@ -26,10 +26,10 @@ class MapCommands implements CommandListener {
|
|||||||
public function __construct(ManiaControl $maniaControl) {
|
public function __construct(ManiaControl $maniaControl) {
|
||||||
$this->maniaControl = $maniaControl;
|
$this->maniaControl = $maniaControl;
|
||||||
|
|
||||||
$this->maniaControl->commandManager->registerCommandListener('nextmap', $this, 'command_NextMap');
|
$this->maniaControl->commandManager->registerCommandListener('/nextmap', $this, 'command_NextMap');
|
||||||
$this->maniaControl->commandManager->registerCommandListener('restartmap', $this, 'command_RestartMap');
|
$this->maniaControl->commandManager->registerCommandListener('/restartmap', $this, 'command_RestartMap');
|
||||||
$this->maniaControl->commandManager->registerCommandListener('addmap', $this, 'command_AddMap');
|
$this->maniaControl->commandManager->registerCommandListener('/addmap', $this, 'command_AddMap');
|
||||||
$this->maniaControl->commandManager->registerCommandListener('removemap', $this, 'command_RemoveMap');
|
$this->maniaControl->commandManager->registerCommandListener('/removemap', $this, 'command_RemoveMap');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,8 +40,8 @@ class MapCommands implements CommandListener {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function command_RemoveMap(array $chat, Player $player) {
|
public function command_RemoveMap(array $chat, Player $player) {
|
||||||
if (!$this->maniaControl->authentication->checkRight($player, Authentication::AUTH_LEVEL_OPERATOR)) {
|
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)) {
|
||||||
$this->maniaControl->authentication->sendNotAllowed($player);
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Get map name
|
// Get map name
|
||||||
@ -69,10 +69,11 @@ class MapCommands implements CommandListener {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function command_AddMap(array $chat, Player $player) {
|
public function command_AddMap(array $chat, Player $player) {
|
||||||
if (!$this->maniaControl->authentication->checkRight($player, Authentication::AUTH_LEVEL_OPERATOR)) {
|
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)) {
|
||||||
$this->maniaControl->authentication->sendNotAllowed($player);
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// TODO: mx fetcher nutzen?
|
||||||
$params = explode(' ', $chat[1][2], 2);
|
$params = explode(' ', $chat[1][2], 2);
|
||||||
if (count($params) < 2) {
|
if (count($params) < 2) {
|
||||||
// TODO: show usage
|
// TODO: show usage
|
||||||
@ -158,8 +159,8 @@ class MapCommands implements CommandListener {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function command_NextMap(array $chat, Player $player) {
|
public function command_NextMap(array $chat, Player $player) {
|
||||||
if (!$this->maniaControl->authentication->checkRight($player, Authentication::AUTH_LEVEL_OPERATOR)) {
|
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)) {
|
||||||
$this->maniaControl->authentication->sendNotAllowed($player);
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return $this->maniaControl->client->query('NextMap');
|
return $this->maniaControl->client->query('NextMap');
|
||||||
@ -173,8 +174,8 @@ class MapCommands implements CommandListener {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function command_RestartMap(array $chat, Player $player) {
|
public function command_RestartMap(array $chat, Player $player) {
|
||||||
if (!$this->maniaControl->authentication->checkRight($player, Authentication::AUTH_LEVEL_OPERATOR)) {
|
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_OPERATOR)) {
|
||||||
$this->maniaControl->authentication->sendNotAllowed($player);
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return $this->maniaControl->client->query('RestartMap');
|
return $this->maniaControl->client->query('RestartMap');
|
||||||
|
@ -97,6 +97,19 @@ class Chat {
|
|||||||
$format = $this->maniaControl->settingManager->getSetting($this, 'ErrorFormat', '$f00');
|
$format = $this->maniaControl->settingManager->getSetting($this, 'ErrorFormat', '$f00');
|
||||||
return $this->sendChat($format . $message, $login);
|
return $this->sendChat($format . $message, $login);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send an usage info message to the given login
|
||||||
|
*
|
||||||
|
* @param string $message
|
||||||
|
* @param string $login
|
||||||
|
* @param string|bool $prefix
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function sendUsageInfo($message, $login = null, $prefix = false) {
|
||||||
|
$format = $this->maniaControl->settingManager->getSetting($this, 'UsageInfoFormat', '$f80');
|
||||||
|
return $this->sendChat($format . $message, $login);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
use ManiaControl\Authentication;
|
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
|
use ManiaControl\Admin\AuthenticationManager;
|
||||||
use ManiaControl\Callbacks\CallbackListener;
|
use ManiaControl\Callbacks\CallbackListener;
|
||||||
use ManiaControl\Callbacks\CallbackManager;
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
use ManiaControl\Commands\CommandListener;
|
use ManiaControl\Commands\CommandListener;
|
||||||
@ -38,8 +38,8 @@ class DonationPlugin extends Plugin implements CallbackListener, CommandListener
|
|||||||
$this->description = 'DonationPlugin commands like /donate, /pay and /getplanets and a donation widget.';
|
$this->description = 'DonationPlugin commands like /donate, /pay and /getplanets and a donation widget.';
|
||||||
|
|
||||||
$this->maniaControl->commandManager->registerCommandListener('donate', $this, 'command_Donate');
|
$this->maniaControl->commandManager->registerCommandListener('donate', $this, 'command_Donate');
|
||||||
$this->maniaControl->commandManager->registerCommandListener('pay', $this, 'command_Pay');
|
$this->maniaControl->commandManager->registerCommandListener('/pay', $this, 'command_Pay');
|
||||||
$this->maniaControl->commandManager->registerCommandListener('getplanets', $this, 'command_GetPlanets');
|
$this->maniaControl->commandManager->registerCommandListener('/getplanets', $this, 'command_GetPlanets');
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_BILLUPDATED, $this, 'handleBillUpdated');
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MP_BILLUPDATED, $this, 'handleBillUpdated');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,15 +85,15 @@ class DonationPlugin extends Plugin implements CallbackListener, CommandListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle /pay command
|
* Handle //pay command
|
||||||
*
|
*
|
||||||
* @param array $chatCallback
|
* @param array $chatCallback
|
||||||
* @param Player $player
|
* @param Player $player
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function command_Pay(array $chatCallback, Player $player) {
|
public function command_Pay(array $chatCallback, Player $player) {
|
||||||
if (!$this->maniaControl->authentication->checkRight($player, Authentication::AUTH_LEVEL_SUPERADMIN)) {
|
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_SUPERADMIN)) {
|
||||||
$this->maniaControl->authentication->sendNotAllowed($player);
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$text = $chatCallback[1][2];
|
$text = $chatCallback[1][2];
|
||||||
@ -127,15 +127,15 @@ class DonationPlugin extends Plugin implements CallbackListener, CommandListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle /getplanets command
|
* Handle //getplanets command
|
||||||
*
|
*
|
||||||
* @param array $chat
|
* @param array $chat
|
||||||
* @param Player $player
|
* @param Player $player
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function command_GetPlanets(array $chatCallback, Player $player) {
|
public function command_GetPlanets(array $chatCallback, Player $player) {
|
||||||
if (!$this->maniaControl->authentication->checkRight($player, Authentication::AUTH_LEVEL_ADMIN)) {
|
if (!$this->maniaControl->authenticationManager->checkRight($player, AuthenticationManager::AUTH_LEVEL_ADMIN)) {
|
||||||
$this->maniaControl->authentication->sendNotAllowed($player);
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!$this->maniaControl->client->query('GetServerPlanets')) {
|
if (!$this->maniaControl->client->query('GetServerPlanets')) {
|
||||||
@ -220,8 +220,8 @@ class DonationPlugin extends Plugin implements CallbackListener, CommandListener
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
private function sendDonateUsageExample(Player $player) {
|
private function sendDonateUsageExample(Player $player) {
|
||||||
$colorCode = '$f80';
|
$message = "Usage Example: '/donate 100'";
|
||||||
return $this->maniaControl->chat->sendChat("{$colorCode}Usage Example: '/donate 100'", $player->login);
|
return $this->maniaControl->chat->sendChat($message, $player->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -231,8 +231,8 @@ class DonationPlugin extends Plugin implements CallbackListener, CommandListener
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
private function sendPayUsageExample(Player $player) {
|
private function sendPayUsageExample(Player $player) {
|
||||||
$colorCode = '$f80';
|
$message = "Usage Example: '/pay 100 login'";
|
||||||
return $this->maniaControl->chat->sendChat("{$colorCode}Usage Example: '/pay 100 login'", $player->login);
|
return $this->maniaControl->chat->sendChat($message, $player->login);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user