mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
and more typehints
This commit is contained in:
@ -1042,12 +1042,12 @@ class Server{
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function generateLevel(string $name, $seed = null, $generator = null, array $options = []){
|
||||
public function generateLevel(string $name, int $seed = null, $generator = null, array $options = []) : bool{
|
||||
if(trim($name) === "" or $this->isLevelGenerated($name)){
|
||||
return false;
|
||||
}
|
||||
|
||||
$seed = $seed === null ? Binary::readInt(random_bytes(4)) : (int) $seed;
|
||||
$seed = $seed ?? Binary::readInt(random_bytes(4));
|
||||
|
||||
if(!isset($options["preset"])){
|
||||
$options["preset"] = $this->getConfigString("generator-settings", "");
|
||||
@ -1327,7 +1327,7 @@ class Server{
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isWhitelisted(string $name){
|
||||
public function isWhitelisted(string $name) : bool{
|
||||
return !$this->hasWhitelist() or $this->operators->exists($name, true) or $this->whitelist->exists($name, true);
|
||||
}
|
||||
|
||||
@ -1336,7 +1336,7 @@ class Server{
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isOp(string $name){
|
||||
public function isOp(string $name) : bool{
|
||||
return $this->operators->exists($name, true);
|
||||
}
|
||||
|
||||
@ -1764,7 +1764,7 @@ class Server{
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function broadcastTitle(string $title, string $subtitle = "", int $fadeIn = -1, int $stay = -1, int $fadeOut = -1, $recipients = null){
|
||||
public function broadcastTitle(string $title, string $subtitle = "", int $fadeIn = -1, int $stay = -1, int $fadeOut = -1, array $recipients = null) : int{
|
||||
if(!is_array($recipients)){
|
||||
/** @var Player[] $recipients */
|
||||
$recipients = [];
|
||||
@ -1933,7 +1933,7 @@ class Server{
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatchCommand(CommandSender $sender, string $commandLine){
|
||||
public function dispatchCommand(CommandSender $sender, string $commandLine) : bool{
|
||||
if($this->commandMap->dispatch($sender, $commandLine)){
|
||||
return true;
|
||||
}
|
||||
@ -2056,6 +2056,9 @@ class Server{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return QueryRegenerateEvent
|
||||
*/
|
||||
public function getQueryInformation(){
|
||||
return $this->queryRegenerateTask;
|
||||
}
|
||||
@ -2430,7 +2433,7 @@ class Server{
|
||||
/**
|
||||
* Tries to execute a server tick
|
||||
*/
|
||||
private function tick(){
|
||||
private function tick() : bool{
|
||||
$tickTime = microtime(true);
|
||||
if(($tickTime - $this->nextTick) < -0.025){ //Allow half a tick of diff
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user