changed arguments of the modescripptevents to strings
This commit is contained in:
parent
cffbc6cd89
commit
7835f89eae
@ -215,7 +215,7 @@ class ModeScriptEventManager implements UsageInformationAble {
|
|||||||
* @param $seconds < the duration of the extension in seconds.
|
* @param $seconds < the duration of the extension in seconds.
|
||||||
*/
|
*/
|
||||||
public function extendManiaPlanetWarmup($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.
|
* @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) {
|
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.
|
* @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) {
|
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() {
|
public function startPause() {
|
||||||
$responseId = $this->generateResponseId();
|
$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);
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::MP_PAUSE_STATUS, $responseId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ class ModeScriptEventManager implements UsageInformationAble {
|
|||||||
*/
|
*/
|
||||||
public function endPause() {
|
public function endPause() {
|
||||||
$responseId = $this->generateResponseId();
|
$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);
|
return new InvokeScriptCallback($this->maniaControl, Callbacks::MP_PAUSE_STATUS, $responseId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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_CANCEL_VOTE, AuthenticationManager::AUTH_LEVEL_MODERATOR);
|
||||||
$this->maniaControl->getAuthenticationManager()->definePermissionLevel(self::SETTING_PERMISSION_HANDLE_WARMUP, 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->updateCancelVoteMenuItem();
|
||||||
$this->updateWarmUpMenuItems();
|
$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
|
* 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) {
|
public function handleWarmUpStatus(StatusCallbackStructure $structure) {
|
||||||
if ($structure->isAvailable()) {
|
if ($structure->isAvailable()) {
|
||||||
|
@ -142,7 +142,7 @@ class Connection
|
|||||||
* @param bool|callable $multicall True to queue the request or false to execute it immediately
|
* @param bool|callable $multicall True to queue the request or false to execute it immediately
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
protected function execute($methodName, $params=array(), $multicall=false)
|
public function execute($methodName, $params=array(), $multicall=false)
|
||||||
{
|
{
|
||||||
if($multicall)
|
if($multicall)
|
||||||
{
|
{
|
||||||
@ -2687,14 +2687,22 @@ class Connection
|
|||||||
function triggerModeScriptEvent($event, $params='', $multicall=false)
|
function triggerModeScriptEvent($event, $params='', $multicall=false)
|
||||||
{
|
{
|
||||||
if(!is_string($event))
|
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))
|
if(is_string($params))
|
||||||
return $this->execute(ucfirst(__FUNCTION__), array($event, $params), $multicall);
|
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);
|
return $this->execute(ucfirst(__FUNCTION__).'Array', array($event, $params), $multicall);
|
||||||
|
}
|
||||||
|
|
||||||
// else
|
// else
|
||||||
throw new InvalidArgumentException('params = '.print_r($params, true));
|
throw new InvalidArgumentException('argument must be string or string[]: params = '.print_r($params, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user