added new communication methods
This commit is contained in:
parent
6c1d0658fe
commit
f9fd1ad90b
@ -272,6 +272,7 @@ class CommunicationManager implements CallbackListener {
|
|||||||
|
|
||||||
//Encode, Encrypt and Send Response
|
//Encode, Encrypt and Send Response
|
||||||
$data = json_encode($data);
|
$data = json_encode($data);
|
||||||
|
|
||||||
$data = openssl_encrypt($data, self::ENCRYPTION_METHOD, $password, OPENSSL_RAW_DATA, self::ENCRYPTION_IV);
|
$data = openssl_encrypt($data, self::ENCRYPTION_METHOD, $password, OPENSSL_RAW_DATA, self::ENCRYPTION_IV);
|
||||||
$connection->write(strlen($data) . "\n" . $data);
|
$connection->write(strlen($data) . "\n" . $data);
|
||||||
|
|
||||||
|
@ -16,6 +16,42 @@ interface CommunicationMethods {
|
|||||||
*/
|
*/
|
||||||
const RESTART_MANIA_CONTROL = "ManiaControl.Restart";
|
const RESTART_MANIA_CONTROL = "ManiaControl.Restart";
|
||||||
|
|
||||||
|
/** Gets Mania Control PlayerList
|
||||||
|
* no Parameters
|
||||||
|
*/
|
||||||
|
const GET_PLAYER_LIST = "PlayerManager.GetPlayerList";
|
||||||
|
|
||||||
|
/** Warns a Player
|
||||||
|
* Required Params
|
||||||
|
* - login
|
||||||
|
*/
|
||||||
|
const WARN_PLAYER = "PlayerActions.WarnPlayer";
|
||||||
|
|
||||||
|
/** Mutes a Player
|
||||||
|
* Required Params
|
||||||
|
* - login
|
||||||
|
*/
|
||||||
|
const MUTE_PLAYER = "PlayerActions.MutePlayer";
|
||||||
|
|
||||||
|
/** UnMutes a Player
|
||||||
|
* Required Params
|
||||||
|
* - login
|
||||||
|
*/
|
||||||
|
const UNMUTE_PLAYER = "PlayerActions.UnMutePlayer";
|
||||||
|
|
||||||
|
/** UnMutes a Player
|
||||||
|
* Required Params
|
||||||
|
* - login
|
||||||
|
* Optional Params
|
||||||
|
* - message
|
||||||
|
*/
|
||||||
|
const KICK_PLAYER = "PlayerActions.KickPlayer";
|
||||||
|
|
||||||
|
//TODO implement
|
||||||
|
const FORCE_PLAYER_TO_SPEC = "PlayerActions.ForcePlayerToSpec";
|
||||||
|
//TODO implement
|
||||||
|
const FORCE_PLAYER_TO_PLAY = "PlayerActions.ForcePlayerToPlay";
|
||||||
|
|
||||||
/** Returns the last 200 lines of the chat (inclusive player logins and nicknames)
|
/** Returns the last 200 lines of the chat (inclusive player logins and nicknames)
|
||||||
* No Params
|
* No Params
|
||||||
*/
|
*/
|
||||||
|
@ -8,6 +8,9 @@ use FML\Controls\Quad;
|
|||||||
use FML\Controls\Quads\Quad_Icons64x64_1;
|
use FML\Controls\Quads\Quad_Icons64x64_1;
|
||||||
use FML\ManiaLink;
|
use FML\ManiaLink;
|
||||||
use ManiaControl\Admin\AuthenticationManager;
|
use ManiaControl\Admin\AuthenticationManager;
|
||||||
|
use ManiaControl\Callbacks\EchoListener;
|
||||||
|
use ManiaControl\Communication\CommunicationListener;
|
||||||
|
use ManiaControl\Communication\CommunicationMethods;
|
||||||
use ManiaControl\Logger;
|
use ManiaControl\Logger;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Manialinks\ManialinkManager;
|
use ManiaControl\Manialinks\ManialinkManager;
|
||||||
@ -26,7 +29,7 @@ use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
|
|||||||
* @copyright 2014-2015 ManiaControl Team
|
* @copyright 2014-2015 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 PlayerActions {
|
class PlayerActions implements EchoListener, CommunicationListener {
|
||||||
/*
|
/*
|
||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -36,6 +39,7 @@ class PlayerActions {
|
|||||||
const SPECTATOR_SPECTATOR = 1;
|
const SPECTATOR_SPECTATOR = 1;
|
||||||
const SPECTATOR_PLAYER = 2;
|
const SPECTATOR_PLAYER = 2;
|
||||||
const SPECTATOR_BUT_KEEP_SELECTABLE = 3;
|
const SPECTATOR_BUT_KEEP_SELECTABLE = 3;
|
||||||
|
const ECHO_WARN_PLAYER = 'ManiaControl.PlayerManager.WarnPlayer';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Permission Setting Constants
|
* Permission Setting Constants
|
||||||
@ -48,6 +52,7 @@ class PlayerActions {
|
|||||||
const SETTING_PERMISSION_KICK_PLAYER = 'Kick Player';
|
const SETTING_PERMISSION_KICK_PLAYER = 'Kick Player';
|
||||||
const SETTING_PERMISSION_BAN_PLAYER = 'Ban Player';
|
const SETTING_PERMISSION_BAN_PLAYER = 'Ban Player';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Private properties
|
* Private properties
|
||||||
*/
|
*/
|
||||||
@ -70,6 +75,50 @@ class PlayerActions {
|
|||||||
$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_FORCE_PLAYER_PLAY, AuthenticationManager::AUTH_LEVEL_MODERATOR);
|
$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_FORCE_PLAYER_PLAY, AuthenticationManager::AUTH_LEVEL_MODERATOR);
|
||||||
$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_FORCE_PLAYER_TEAM, AuthenticationManager::AUTH_LEVEL_MODERATOR);
|
$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_FORCE_PLAYER_TEAM, AuthenticationManager::AUTH_LEVEL_MODERATOR);
|
||||||
$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_FORCE_PLAYER_SPEC, AuthenticationManager::AUTH_LEVEL_MODERATOR);
|
$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_FORCE_PLAYER_SPEC, AuthenticationManager::AUTH_LEVEL_MODERATOR);
|
||||||
|
|
||||||
|
// Echo Warn Command (Usage: sendEcho json_encode("player" => "loginName")
|
||||||
|
$this->maniaControl->getEchoManager()->registerEchoListener(self::ECHO_WARN_PLAYER, $this, function ($params) {
|
||||||
|
$this->warnPlayer(null, $params->player, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
//Communication Manager Methods
|
||||||
|
$this->maniaControl->getCommunicationManager()->registerCommunicationListener(CommunicationMethods::WARN_PLAYER, $this, function ($data) {
|
||||||
|
if (!is_object($data) || !property_exists($data, "login")) {
|
||||||
|
return array("error" => true, "data" => "You have to provide a valid player Login");
|
||||||
|
}
|
||||||
|
$success = $this->warnPlayer(null, $data->login, false);
|
||||||
|
return array("error" => false, "data" => array("success" => $success));
|
||||||
|
});
|
||||||
|
|
||||||
|
$this->maniaControl->getCommunicationManager()->registerCommunicationListener(CommunicationMethods::MUTE_PLAYER, $this, function ($data) {
|
||||||
|
if (!is_object($data) || !property_exists($data, "login")) {
|
||||||
|
return array("error" => true, "data" => "You have to provide a valid player Login");
|
||||||
|
}
|
||||||
|
$success = $this->mutePlayer(null, $data->login, false);
|
||||||
|
return array("error" => false, "data" => array("success" => $success));
|
||||||
|
});
|
||||||
|
|
||||||
|
$this->maniaControl->getCommunicationManager()->registerCommunicationListener(CommunicationMethods::UNMUTE_PLAYER, $this, function ($data) {
|
||||||
|
if (!is_object($data) || !property_exists($data, "login")) {
|
||||||
|
return array("error" => true, "data" => "You have to provide a valid player Login");
|
||||||
|
}
|
||||||
|
$success = $this->unMutePlayer(null, $data->login, false);
|
||||||
|
return array("error" => false, "data" => array("success" => $success));
|
||||||
|
});
|
||||||
|
|
||||||
|
$this->maniaControl->getCommunicationManager()->registerCommunicationListener(CommunicationMethods::KICK_PLAYER, $this, function ($data) {
|
||||||
|
if (!is_object($data) || !property_exists($data, "login")) {
|
||||||
|
return array("error" => true, "data" => "You have to provide a valid player Login");
|
||||||
|
}
|
||||||
|
|
||||||
|
$message = "";
|
||||||
|
if (property_exists($data, "message")) {
|
||||||
|
$message = $data->message;
|
||||||
|
}
|
||||||
|
|
||||||
|
$success = $this->kickPlayer(null, $data->login, $message, false);
|
||||||
|
return array("error" => false, "data" => array("success" => $success));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -220,34 +269,44 @@ class PlayerActions {
|
|||||||
/**
|
/**
|
||||||
* UnMute a Player
|
* UnMute a Player
|
||||||
*
|
*
|
||||||
* @param string $adminLogin
|
* @param $adminLogin
|
||||||
* @param string $targetLogin
|
* @param $targetLogin
|
||||||
|
* @param bool $calledByAdmin
|
||||||
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function unMutePlayer($adminLogin, $targetLogin) {
|
public function unMutePlayer($adminLogin, $targetLogin, $calledByAdmin = true) {
|
||||||
|
if ($calledByAdmin) {
|
||||||
$admin = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin);
|
$admin = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin);
|
||||||
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_MUTE_PLAYER)
|
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_MUTE_PLAYER)
|
||||||
) {
|
) {
|
||||||
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin);
|
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin);
|
||||||
return;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin);
|
$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin);
|
||||||
|
|
||||||
if (!$target) {
|
if (!$target) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->getClient()->unIgnore($targetLogin);
|
$this->maniaControl->getClient()->unIgnore($targetLogin);
|
||||||
} catch (NotInListException $e) {
|
} catch (NotInListException $e) {
|
||||||
$this->maniaControl->getChat()->sendError('Player is not ignored!', $adminLogin);
|
$this->maniaControl->getChat()->sendError('Player is not ignored!', $adminLogin);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($calledByAdmin) {
|
||||||
$title = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel);
|
$title = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel);
|
||||||
$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' un-muted ' . $target->getEscapedNickname() . '!';
|
$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' un-muted ' . $target->getEscapedNickname() . '!';
|
||||||
|
} else {
|
||||||
|
$chatMessage = $target->getEscapedNickname() . ' got un-muted!';
|
||||||
|
}
|
||||||
|
|
||||||
$this->maniaControl->getChat()->sendInformation($chatMessage);
|
$this->maniaControl->getChat()->sendInformation($chatMessage);
|
||||||
Logger::logInfo($chatMessage, true);
|
Logger::logInfo($chatMessage, true);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -255,32 +314,43 @@ class PlayerActions {
|
|||||||
*
|
*
|
||||||
* @param string $adminLogin
|
* @param string $adminLogin
|
||||||
* @param string $targetLogin
|
* @param string $targetLogin
|
||||||
|
* @param bool $calledByAdmin
|
||||||
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function mutePlayer($adminLogin, $targetLogin) {
|
public function mutePlayer($adminLogin, $targetLogin, $calledByAdmin = true) {
|
||||||
|
if ($calledByAdmin) {
|
||||||
$admin = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin);
|
$admin = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin);
|
||||||
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_MUTE_PLAYER)
|
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_MUTE_PLAYER)
|
||||||
) {
|
) {
|
||||||
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin);
|
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin);
|
||||||
return;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin);
|
$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin);
|
||||||
|
|
||||||
if (!$target) {
|
if (!$target) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->getClient()->ignore($targetLogin);
|
$this->maniaControl->getClient()->ignore($targetLogin);
|
||||||
} catch (AlreadyInListException $e) {
|
} catch (AlreadyInListException $e) {
|
||||||
$this->maniaControl->getChat()->sendError("Player already ignored!", $adminLogin);
|
$this->maniaControl->getChat()->sendError("Player already ignored!", $adminLogin);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Announce warning
|
||||||
|
if ($calledByAdmin) {
|
||||||
$title = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel);
|
$title = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel);
|
||||||
$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' muted ' . $target->getEscapedNickname() . '!';
|
$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' muted ' . $target->getEscapedNickname() . '!';
|
||||||
|
} else {
|
||||||
|
$chatMessage = $target->getEscapedNickname() . ' got muted!';
|
||||||
|
}
|
||||||
|
|
||||||
$this->maniaControl->getChat()->sendInformation($chatMessage);
|
$this->maniaControl->getChat()->sendInformation($chatMessage);
|
||||||
Logger::logInfo($chatMessage, true);
|
Logger::logInfo($chatMessage, true);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -289,6 +359,7 @@ class PlayerActions {
|
|||||||
* @param string $adminLogin
|
* @param string $adminLogin
|
||||||
* @param string $targetLogin
|
* @param string $targetLogin
|
||||||
* @param bool $calledByAdmin
|
* @param bool $calledByAdmin
|
||||||
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function warnPlayer($adminLogin, $targetLogin, $calledByAdmin = true) {
|
public function warnPlayer($adminLogin, $targetLogin, $calledByAdmin = true) {
|
||||||
if ($calledByAdmin) {
|
if ($calledByAdmin) {
|
||||||
@ -296,14 +367,14 @@ class PlayerActions {
|
|||||||
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_WARN_PLAYER)
|
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_WARN_PLAYER)
|
||||||
) {
|
) {
|
||||||
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin);
|
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin);
|
$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin);
|
||||||
|
|
||||||
if (!$target) {
|
if (!$target) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display warning message
|
// Display warning message
|
||||||
@ -372,51 +443,70 @@ class PlayerActions {
|
|||||||
|
|
||||||
$this->maniaControl->getChat()->sendInformation($chatMessage);
|
$this->maniaControl->getChat()->sendInformation($chatMessage);
|
||||||
Logger::log($chatMessage, true);
|
Logger::log($chatMessage, true);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kick a Player
|
* Kick a Player
|
||||||
*
|
*
|
||||||
* @param string $adminLogin
|
* @param $adminLogin
|
||||||
* @param string $targetLogin
|
* @param $targetLogin
|
||||||
* @param string $message
|
* @param string $message
|
||||||
|
* @param bool $calledByAdmin
|
||||||
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function kickPlayer($adminLogin, $targetLogin, $message = '') {
|
public function kickPlayer($adminLogin, $targetLogin, $message = '', $calledByAdmin = true) {
|
||||||
|
if ($calledByAdmin) {
|
||||||
$admin = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin);
|
$admin = $this->maniaControl->getPlayerManager()->getPlayer($adminLogin);
|
||||||
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_KICK_PLAYER)
|
if (!$this->maniaControl->getAuthenticationManager()->checkPermission($admin, self::SETTING_PERMISSION_KICK_PLAYER)
|
||||||
) {
|
) {
|
||||||
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin);
|
$this->maniaControl->getAuthenticationManager()->sendNotAllowed($admin);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin);
|
|
||||||
if (!$target) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$target = $this->maniaControl->getPlayerManager()->getPlayer($targetLogin);
|
||||||
|
if (!$target) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if ($target->isFakePlayer()) {
|
if ($target->isFakePlayer()) {
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->getClient()->disconnectFakePlayer($target->login);
|
$this->maniaControl->getClient()->disconnectFakePlayer($target->login);
|
||||||
} catch (PlayerStateException $e) {
|
} catch (PlayerStateException $e) {
|
||||||
|
if ($calledByAdmin) {
|
||||||
$this->maniaControl->getChat()->sendException($e, $admin);
|
$this->maniaControl->getChat()->sendException($e, $admin);
|
||||||
return;
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->getClient()->kick($target->login, $message);
|
$this->maniaControl->getClient()->kick($target->login, $message);
|
||||||
} catch (UnknownPlayerException $e) {
|
} catch (UnknownPlayerException $e) {
|
||||||
|
if ($calledByAdmin) {
|
||||||
$this->maniaControl->getChat()->sendException($e, $admin);
|
$this->maniaControl->getChat()->sendException($e, $admin);
|
||||||
return;
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Announce kick
|
// Announce kick
|
||||||
|
if ($calledByAdmin) {
|
||||||
$title = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel);
|
$title = $this->maniaControl->getAuthenticationManager()->getAuthLevelName($admin->authLevel);
|
||||||
$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' kicked ' . $target->getEscapedNickname() . '!';
|
$chatMessage = $title . ' ' . $admin->getEscapedNickname() . ' kicked ' . $target->getEscapedNickname() . '!';
|
||||||
|
} else {
|
||||||
|
$chatMessage = $target->getEscapedNickname() . ' got kicked!';
|
||||||
|
}
|
||||||
|
|
||||||
$this->maniaControl->getChat()->sendInformation($chatMessage);
|
$this->maniaControl->getChat()->sendInformation($chatMessage);
|
||||||
Logger::logInfo($chatMessage, true);
|
Logger::logInfo($chatMessage, true);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ban a Player
|
* Ban a Player
|
||||||
*
|
*
|
||||||
|
@ -6,8 +6,9 @@ use ManiaControl\Admin\AdminLists;
|
|||||||
use ManiaControl\Callbacks\CallbackListener;
|
use ManiaControl\Callbacks\CallbackListener;
|
||||||
use ManiaControl\Callbacks\CallbackManager;
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
use ManiaControl\Callbacks\Callbacks;
|
use ManiaControl\Callbacks\Callbacks;
|
||||||
use ManiaControl\Callbacks\EchoListener;
|
|
||||||
use ManiaControl\Callbacks\TimerListener;
|
use ManiaControl\Callbacks\TimerListener;
|
||||||
|
use ManiaControl\Communication\CommunicationListener;
|
||||||
|
use ManiaControl\Communication\CommunicationMethods;
|
||||||
use ManiaControl\Logger;
|
use ManiaControl\Logger;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Statistics\StatisticManager;
|
use ManiaControl\Statistics\StatisticManager;
|
||||||
@ -21,7 +22,7 @@ use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
|
|||||||
* @copyright 2014-2015 ManiaControl Team
|
* @copyright 2014-2015 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 PlayerManager implements CallbackListener, TimerListener, EchoListener {
|
class PlayerManager implements CallbackListener, TimerListener, CommunicationListener {
|
||||||
/*
|
/*
|
||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
@ -35,8 +36,6 @@ class PlayerManager implements CallbackListener, TimerListener, EchoListener {
|
|||||||
const STAT_JOIN_COUNT = 'Joins';
|
const STAT_JOIN_COUNT = 'Joins';
|
||||||
const STAT_SERVERTIME = 'Servertime';
|
const STAT_SERVERTIME = 'Servertime';
|
||||||
|
|
||||||
const ECHO_WARN_PLAYER = 'ManiaControl.PlayerManager.WarnPlayer';
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Public properties
|
* Public properties
|
||||||
*/
|
*/
|
||||||
@ -109,9 +108,10 @@ class PlayerManager implements CallbackListener, TimerListener, EchoListener {
|
|||||||
$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_JOIN_COUNT);
|
$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_JOIN_COUNT);
|
||||||
$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_SERVERTIME, StatisticManager::STAT_TYPE_TIME);
|
$this->maniaControl->getStatisticManager()->defineStatMetaData(self::STAT_SERVERTIME, StatisticManager::STAT_TYPE_TIME);
|
||||||
|
|
||||||
// Echo Warn Command (Usage: sendEcho json_encode("player" => "loginName")
|
|
||||||
$this->maniaControl->getEchoManager()->registerEchoListener(self::ECHO_WARN_PLAYER, $this, function ($params) {
|
// Communication Listenings
|
||||||
$this->playerActions->warnPlayer(null, $params->player, false);
|
$this->maniaControl->getCommunicationManager()->registerCommunicationListener(CommunicationMethods::GET_PLAYER_LIST, $this, function ($data) {
|
||||||
|
return array("error" => false, "data" => $this->players);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,6 +192,7 @@ class PlayerManager implements CallbackListener, TimerListener, EchoListener {
|
|||||||
return $this->adminLists;
|
return $this->adminLists;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle OnInit callback
|
* Handle OnInit callback
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user