dedicated-server-api update

This commit is contained in:
Steffen Schröder
2014-05-20 15:20:16 +02:00
parent 33b86cdca0
commit 18cd71818a
6 changed files with 141 additions and 65 deletions

View File

@ -71,4 +71,35 @@ class ServerOptions extends AbstractStructure
public $disableHorns;
/** @var bool */
public $disableServiceAnnounces;
/**
* @internal
* @return bool
*/
function isValid()
{
return is_string($this->name)
&& is_string($this->comment)
&& is_string($this->password)
&& is_string($this->passwordForSpectator)
&& VoteRatio::isRatio($this->callVoteRatio);
}
/**
* @internal
* @return mixed[]
*/
function toSetterArray()
{
$out = array();
foreach(get_object_vars($this) as $key => $value)
{
if(substr($key, 0, 7) == 'current' || $value === null)
continue;
if($key == 'nextUseChangingValidationSeed')
$key = 'useChangingValidationSeed';
$out[ucfirst($key)] = $value;
}
return $out;
}
}

View File

@ -15,6 +15,7 @@ class Status extends AbstractStructure
const SYNCHRONIZATION = 3;
const PLAY = 4;
const EXITING = 6;
const LOCAL = 7;
/** @var int */
public $code;

View File

@ -34,6 +34,7 @@ class Vote extends AbstractStructure
}
/**
* @internal
* @return bool
*/
function isValid()

View File

@ -37,6 +37,7 @@ class VoteRatio extends AbstractStructure
}
/**
* @internal
* @return bool
*/
function isValid()
@ -47,6 +48,7 @@ class VoteRatio extends AbstractStructure
}
/**
* @internal
* @param float $ratio
* @return bool
*/