diff --git a/core/Script/ModeScriptEventManager.php b/core/Script/ModeScriptEventManager.php index 126dd80c..d76a5fd5 100644 --- a/core/Script/ModeScriptEventManager.php +++ b/core/Script/ModeScriptEventManager.php @@ -215,7 +215,7 @@ class ModeScriptEventManager implements UsageInformationAble { * @param $seconds < the duration of the extension in seconds. */ public function extendManiaPlanetWarmup($seconds) { - $this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.WarmUp.Extend', array($seconds * 1000)); + $this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.WarmUp.Extend', array(strval($seconds * 1000))); } /** @@ -233,7 +233,7 @@ class ModeScriptEventManager implements UsageInformationAble { * @param int $time Timer before the end of the warmup when all players are ready. Use a negative value to prevent the warmup from ending even if all players are ready. */ public function blockEndWarmUp($time = -1) { - $this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.WarmUp.BlockEndWarmUp', array(true, $time)); + $this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.WarmUp.BlockEndWarmUp', array("True", strval($time))); } /** @@ -242,7 +242,7 @@ class ModeScriptEventManager implements UsageInformationAble { * @param int $time Timer before the end of the warmup when all players are ready. Use a negative value to prevent the warmup from ending even if all players are ready. */ public function unBlockEndWarmUp($time = -1) { - $this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.WarmUp.BlockEndWarmUp', array(false, $time)); + $this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.WarmUp.BlockEndWarmUp', array("False", strval($time))); } /** @@ -277,7 +277,7 @@ class ModeScriptEventManager implements UsageInformationAble { */ public function startPause() { $responseId = $this->generateResponseId(); - $this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.Pause.SetActive', array(true, $responseId)); + $this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.Pause.SetActive', array("True", $responseId)); return new InvokeScriptCallback($this->maniaControl, Callbacks::MP_PAUSE_STATUS, $responseId); } @@ -289,7 +289,7 @@ class ModeScriptEventManager implements UsageInformationAble { */ public function endPause() { $responseId = $this->generateResponseId(); - $this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.Pause.SetActive', array(false, $responseId)); + $this->maniaControl->getClient()->triggerModeScriptEvent('Maniaplanet.Pause.SetActive', array("False", $responseId)); return new InvokeScriptCallback($this->maniaControl, Callbacks::MP_PAUSE_STATUS, $responseId); } diff --git a/core/Server/Commands.php b/core/Server/Commands.php index 0a626635..32ab827e 100644 --- a/core/Server/Commands.php +++ b/core/Server/Commands.php @@ -90,6 +90,9 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer $this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_CANCEL_VOTE, AuthenticationManager::AUTH_LEVEL_MODERATOR); $this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_HANDLE_WARMUP, AuthenticationManager::AUTH_LEVEL_MODERATOR); + //Triggers a WarmUp Status Callback + $this->maniaControl->getModeScriptEventManager()->getWarmupStatus(); + $this->updateCancelVoteMenuItem(); $this->updateWarmUpMenuItems(); } @@ -121,7 +124,7 @@ class Commands implements CallbackListener, CommandListener, ManialinkPageAnswer /** * Handle the WarmupStatus Callback, and removes or adds the Menu Items for extending / Stopping warmup * - * @param $warmupEnabled + * @param \ManiaControl\Callbacks\Structures\Common\StatusCallbackStructure $structure */ public function handleWarmUpStatus(StatusCallbackStructure $structure) { if ($structure->isAvailable()) { diff --git a/libs/Maniaplanet/DedicatedServer/Connection.php b/libs/Maniaplanet/DedicatedServer/Connection.php index 00adf71b..4e067a04 100755 --- a/libs/Maniaplanet/DedicatedServer/Connection.php +++ b/libs/Maniaplanet/DedicatedServer/Connection.php @@ -142,7 +142,7 @@ class Connection * @param bool|callable $multicall True to queue the request or false to execute it immediately * @return mixed */ - protected function execute($methodName, $params=array(), $multicall=false) + public function execute($methodName, $params=array(), $multicall=false) { if($multicall) { @@ -2687,14 +2687,22 @@ class Connection function triggerModeScriptEvent($event, $params='', $multicall=false) { if(!is_string($event)) - throw new InvalidArgumentException('event = '.print_r($event, true)); + throw new InvalidArgumentException('event name must be a string: event = '.print_r($event, true)); if(is_string($params)) return $this->execute(ucfirst(__FUNCTION__), array($event, $params), $multicall); - if(is_array($params)) + + if(is_array($params)){ + foreach($params as $param){ + if(!is_string($param)){ + throw new InvalidArgumentException('argument must be a string: param = '.print_r($param, true)); + } + } return $this->execute(ucfirst(__FUNCTION__).'Array', array($event, $params), $multicall); + } + // else - throw new InvalidArgumentException('params = '.print_r($params, true)); + throw new InvalidArgumentException('argument must be string or string[]: params = '.print_r($params, true)); } /**