- adjustment for dedicated-api update
- minor changes
This commit is contained in:
parent
18cd71818a
commit
63981d8002
@ -17,6 +17,7 @@ use ManiaControl\Callbacks\CallbackListener;
|
|||||||
use ManiaControl\Callbacks\CallbackManager;
|
use ManiaControl\Callbacks\CallbackManager;
|
||||||
use ManiaControl\ManiaControl;
|
use ManiaControl\ManiaControl;
|
||||||
use ManiaControl\Players\Player;
|
use ManiaControl\Players\Player;
|
||||||
|
use Maniaplanet\DedicatedServer\Structures\ServerOptions;
|
||||||
use Maniaplanet\DedicatedServer\Xmlrpc\ServerOptionsException;
|
use Maniaplanet\DedicatedServer\Xmlrpc\ServerOptionsException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,15 +108,16 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
trigger_error($mysqli->error);
|
trigger_error($mysqli->error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$serverSettings = $this->maniaControl->client->getServerOptions()->toArray();
|
$serverSettings = $this->maniaControl->client->getServerOptions();
|
||||||
$applySettings = false;
|
$applySettings = false;
|
||||||
while ($row = $result->fetch_object()) {
|
while ($row = $result->fetch_object()) {
|
||||||
if (!isset($serverSettings[$row->settingName])) {
|
$settingName = $row->settingName;
|
||||||
|
if (!property_exists($serverSettings, $settingName)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$oldType = gettype($serverSettings[$row->settingName]);
|
$oldType = gettype($serverSettings->$settingName);
|
||||||
$serverSettings[$row->settingName] = $row->settingValue;
|
$serverSettings->$settingName = $row->settingValue;
|
||||||
settype($serverSettings[$row->settingName], $oldType);
|
settype($serverSettings->$settingName, $oldType);
|
||||||
$applySettings = true;
|
$applySettings = true;
|
||||||
}
|
}
|
||||||
$result->free();
|
$result->free();
|
||||||
@ -278,24 +280,15 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
/**
|
/**
|
||||||
* Apply the Array of new Server Settings
|
* Apply the Array of new Server Settings
|
||||||
*
|
*
|
||||||
* @param array $newSettings
|
* @param ServerOptions $newSettings
|
||||||
* @param Player $player
|
* @param Player $player
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function applyNewServerSettings(array $newSettings, Player $player) {
|
private function applyNewServerSettings(ServerOptions $newSettings, Player $player) {
|
||||||
if (!$newSettings) {
|
if (!$newSettings) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$rewriteSettings = array('NextUseChangingValidationSeed' => 'UseChangingValidationSeed');
|
|
||||||
foreach ($rewriteSettings as $oldName => $newName) {
|
|
||||||
if (array_key_exists($oldName, $newSettings)) {
|
|
||||||
$setting = $newSettings[$oldName];
|
|
||||||
unset($newSettings[$oldName]);
|
|
||||||
$newSettings[$newName] = $setting;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->maniaControl->client->setServerOptions($newSettings);
|
$this->maniaControl->client->setServerOptions($newSettings);
|
||||||
} catch (ServerOptionsException $e) {
|
} catch (ServerOptionsException $e) {
|
||||||
@ -320,7 +313,8 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($newSettings as $setting => $value) {
|
$settingsArray = $newSettings->toArray();
|
||||||
|
foreach ($settingsArray as $setting => $value) {
|
||||||
if ($value === null) {
|
if ($value === null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ class MapQueue implements CallbackListener, CommandListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the map-queue via admin command clearmap queue
|
* Clears the map-queue via admin command clear map queue
|
||||||
*
|
*
|
||||||
* @param array $chatCallback
|
* @param array $chatCallback
|
||||||
* @param Player $admin
|
* @param Player $admin
|
||||||
|
@ -137,8 +137,8 @@ class PlayerActions {
|
|||||||
try {
|
try {
|
||||||
$this->maniaControl->client->forceSpectator($target->login, self::SPECTATOR_PLAYER);
|
$this->maniaControl->client->forceSpectator($target->login, self::SPECTATOR_PLAYER);
|
||||||
} catch (FaultException $e) {
|
} catch (FaultException $e) {
|
||||||
//TODO exception 'There are too many players' appeared 28.04.2014, wait for more before add to faultexception
|
//TODO exception 'There are too many players' appeared 28.04.2014, wait for more before add to fault exception
|
||||||
$this->maniaControl->chat->sendException($e, $admin->login);
|
$this->maniaControl->chat->sendException($e, $admin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ class PlayerActions {
|
|||||||
try {
|
try {
|
||||||
$this->maniaControl->client->forceSpectator($target->login, self::SPECTATOR_USER_SELECTABLE);
|
$this->maniaControl->client->forceSpectator($target->login, self::SPECTATOR_USER_SELECTABLE);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->maniaControl->chat->sendException($e, $admin->login);
|
$this->maniaControl->chat->sendException($e, $admin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ class PlayerCommands implements CommandListener, ManialinkPageAnswerListener, Ca
|
|||||||
$this->maniaControl->commandManager->registerCommandListener(array('addbots', 'addbot'), $this, 'command_AddFakePlayers', true, 'Adds bots to the game.');
|
$this->maniaControl->commandManager->registerCommandListener(array('addbots', 'addbot'), $this, 'command_AddFakePlayers', true, 'Adds bots to the game.');
|
||||||
$this->maniaControl->commandManager->registerCommandListener(array('removebot', 'removebots'), $this, 'command_RemoveFakePlayers', true, 'Removes bots from the game.');
|
$this->maniaControl->commandManager->registerCommandListener(array('removebot', 'removebots'), $this, 'command_RemoveFakePlayers', true, 'Removes bots from the game.');
|
||||||
$this->maniaControl->commandManager->registerCommandListener('mute', $this, 'command_MutePlayer', true, 'Mutes a player (prevents player from chatting).');
|
$this->maniaControl->commandManager->registerCommandListener('mute', $this, 'command_MutePlayer', true, 'Mutes a player (prevents player from chatting).');
|
||||||
$this->maniaControl->commandManager->registerCommandListener('unmute', $this, 'command_UnmutePlayer', true, 'Unmutes a player (enables player to chat again).');
|
$this->maniaControl->commandManager->registerCommandListener('unmute', $this, 'command_UnmutePlayer', true, 'Unmute a player (enables player to chat again).');
|
||||||
|
|
||||||
// Register for player chat commands
|
// Register for player chat commands
|
||||||
$this->maniaControl->commandManager->registerCommandListener(array('player', 'players'), $this, 'command_playerList', false, 'Shows players currently on the server.');
|
$this->maniaControl->commandManager->registerCommandListener(array('player', 'players'), $this, 'command_playerList', false, 'Shows players currently on the server.');
|
||||||
|
@ -55,7 +55,7 @@ class KarmaPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
*/
|
*/
|
||||||
const SETTING_WIDGET_DISPLAY_MX = 'Display MX-Karma in Widget';
|
const SETTING_WIDGET_DISPLAY_MX = 'Display MX-Karma in Widget';
|
||||||
const SETTING_MX_KARMA_ACTIVATED = 'Activate MX-Karma';
|
const SETTING_MX_KARMA_ACTIVATED = 'Activate MX-Karma';
|
||||||
const SETTING_MX_KARMA_IMPORTING = 'Import old MX-Karmas';
|
const SETTING_MX_KARMA_IMPORTING = 'Import old MX-Karma';
|
||||||
const MX_IMPORT_TABLE = 'mc_karma_mximport';
|
const MX_IMPORT_TABLE = 'mc_karma_mximport';
|
||||||
const MX_KARMA_URL = 'http://karma.mania-exchange.com/api2/';
|
const MX_KARMA_URL = 'http://karma.mania-exchange.com/api2/';
|
||||||
const MX_KARMA_STARTSESSION = 'startSession';
|
const MX_KARMA_STARTSESSION = 'startSession';
|
||||||
|
Loading…
Reference in New Issue
Block a user