deprecated getSetting method to keep third-party plugin compatibility
This commit is contained in:
parent
23c58b47ff
commit
55a3ac446a
@ -44,14 +44,14 @@ class ErrorHandler {
|
|||||||
/**
|
/**
|
||||||
* ManiaControl Exception Handler
|
* ManiaControl Exception Handler
|
||||||
*
|
*
|
||||||
* @param \Exception $ex
|
* @param \Exception $exception
|
||||||
* @param bool $shutdown
|
* @param bool $shutdown
|
||||||
*/
|
*/
|
||||||
public function handleException(\Exception $ex, $shutdown = true) {
|
public function handleException(\Exception $exception, $shutdown = true) {
|
||||||
$message = "[ManiaControl EXCEPTION]: {$ex->getMessage()}";
|
$message = "[ManiaControl EXCEPTION]: {$exception->getMessage()}";
|
||||||
|
|
||||||
$exceptionClass = get_class($ex);
|
$exceptionClass = get_class($exception);
|
||||||
$traceString = $ex->getTraceAsString();
|
$traceString = $exception->getTraceAsString();
|
||||||
|
|
||||||
$logMessage = $message . PHP_EOL . 'Class: ' . $exceptionClass . PHP_EOL . 'Trace:' . PHP_EOL . $traceString;
|
$logMessage = $message . PHP_EOL . 'Class: ' . $exceptionClass . PHP_EOL . 'Trace:' . PHP_EOL . $traceString;
|
||||||
logMessage($logMessage);
|
logMessage($logMessage);
|
||||||
@ -61,7 +61,7 @@ class ErrorHandler {
|
|||||||
$error['Type'] = 'Exception';
|
$error['Type'] = 'Exception';
|
||||||
$error['Message'] = $message;
|
$error['Message'] = $message;
|
||||||
$error['Class'] = $exceptionClass;
|
$error['Class'] = $exceptionClass;
|
||||||
$error['FileLine'] = $ex->getFile() . ': ' . $ex->getLine();
|
$error['FileLine'] = $exception->getFile() . ': ' . $exception->getLine();
|
||||||
$error['Backtrace'] = $traceString;
|
$error['Backtrace'] = $traceString;
|
||||||
$error['OperatingSystem'] = php_uname();
|
$error['OperatingSystem'] = php_uname();
|
||||||
$error['PHPVersion'] = phpversion();
|
$error['PHPVersion'] = phpversion();
|
||||||
|
@ -105,14 +105,14 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
|||||||
* @param array $chat
|
* @param array $chat
|
||||||
* @param Player $player
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function command_ShowNextMap(array $chat, Player $player) {
|
public function command_ShowNextMap(array $chatCallback, Player $player) {
|
||||||
$nextQueued = $this->maniaControl->mapManager->mapQueue->getNextQueuedMap();
|
$nextQueued = $this->maniaControl->mapManager->mapQueue->getNextQueuedMap();
|
||||||
if ($nextQueued) {
|
if ($nextQueued) {
|
||||||
/** @var Player $requester */
|
/** @var Player $requester */
|
||||||
$requester = $nextQueued[0];
|
$requester = $nextQueued[0];
|
||||||
/** @var Map $map */
|
/** @var Map $map */
|
||||||
$map = $nextQueued[1];
|
$map = $nextQueued[1];
|
||||||
$this->maniaControl->chat->sendInformation("Next map is $<" . $map->name . "$> from $<" . $map->authorNick . "$> requested by $<" . $requester->nickname . "$>.", $player->login);
|
$this->maniaControl->chat->sendInformation("Next map is $<" . $map->name . "$> from $<" . $map->authorNick . "$> requested by $<" . $requester->nickname . "$>.", $player);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$mapIndex = $this->maniaControl->client->getNextMapIndex();
|
$mapIndex = $this->maniaControl->client->getNextMapIndex();
|
||||||
@ -125,10 +125,10 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
|||||||
/**
|
/**
|
||||||
* Handle removemap command
|
* Handle removemap command
|
||||||
*
|
*
|
||||||
* @param array $chat
|
* @param array $chat
|
||||||
* @param \ManiaControl\Players\Player $player
|
* @param Player $player
|
||||||
*/
|
*/
|
||||||
public function command_RemoveMap(array $chat, Player $player) {
|
public function command_RemoveMap(array $chatCallback, Player $player) {
|
||||||
if (!$this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_REMOVE_MAP)) {
|
if (!$this->maniaControl->authenticationManager->checkPermission($player, MapManager::SETTING_PERMISSION_REMOVE_MAP)) {
|
||||||
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
$this->maniaControl->authenticationManager->sendNotAllowed($player);
|
||||||
return;
|
return;
|
||||||
@ -136,7 +136,7 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
|||||||
// Get map
|
// Get map
|
||||||
$map = $this->maniaControl->mapManager->getCurrentMap();
|
$map = $this->maniaControl->mapManager->getCurrentMap();
|
||||||
if (!$map) {
|
if (!$map) {
|
||||||
$this->maniaControl->chat->sendError("Couldn't remove map.", $player->login);
|
$this->maniaControl->chat->sendError("Couldn't remove map.", $player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ class SettingManager implements CallbackListener {
|
|||||||
public function setSetting($object, $settingName, $value) {
|
public function setSetting($object, $settingName, $value) {
|
||||||
$className = ClassUtil::getClass($object);
|
$className = ClassUtil::getClass($object);
|
||||||
|
|
||||||
$setting = $this->getSetting($object, $settingName);
|
$setting = $this->getSettingObject($object, $settingName);
|
||||||
if ($setting) {
|
if ($setting) {
|
||||||
$setting->value = $value;
|
$setting->value = $value;
|
||||||
if (!$this->saveSetting($setting)) {
|
if (!$this->saveSetting($setting)) {
|
||||||
@ -162,7 +162,7 @@ class SettingManager implements CallbackListener {
|
|||||||
* @param mixed $default
|
* @param mixed $default
|
||||||
* @return Setting
|
* @return Setting
|
||||||
*/
|
*/
|
||||||
public function getSetting($object, $settingName, $default = null) {
|
public function getSettingObject($object, $settingName, $default = null) {
|
||||||
$settingClass = ClassUtil::getClass($object);
|
$settingClass = ClassUtil::getClass($object);
|
||||||
|
|
||||||
// Retrieve from Storage if possible
|
// Retrieve from Storage if possible
|
||||||
@ -262,6 +262,14 @@ class SettingManager implements CallbackListener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
* @see SettingManager::getSettingValue()
|
||||||
|
*/
|
||||||
|
public function getSetting($object, $settingName, $default = null) {
|
||||||
|
return $this->getSettingValue($object, $settingName, $default);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the Setting Value directly
|
* Get the Setting Value directly
|
||||||
*
|
*
|
||||||
@ -271,7 +279,7 @@ class SettingManager implements CallbackListener {
|
|||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getSettingValue($object, $settingName, $default = null) {
|
public function getSettingValue($object, $settingName, $default = null) {
|
||||||
$setting = $this->getSetting($object, $settingName, $default);
|
$setting = $this->getSettingObject($object, $settingName, $default);
|
||||||
if ($setting) {
|
if ($setting) {
|
||||||
return $setting->value;
|
return $setting->value;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user