mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-11 00:09:39 +00:00
phpdoc: populate missing parameter typeinfo
This commit is contained in:
parent
c329ff7d4f
commit
17720041a3
@ -343,10 +343,16 @@ class CrashDump{
|
||||
$this->addLine("OS : " . PHP_OS . ", " . Utils::getOS());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $line
|
||||
*/
|
||||
public function addLine($line = ""){
|
||||
fwrite($this->fp, $line . PHP_EOL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $str
|
||||
*/
|
||||
public function add($str){
|
||||
fwrite($this->fp, $str);
|
||||
}
|
||||
|
@ -2204,6 +2204,9 @@ class Server{
|
||||
$this->forceShutdown();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $signo
|
||||
*/
|
||||
public function handleSignal($signo){
|
||||
if($signo === SIGTERM or $signo === SIGINT or $signo === SIGHUP){
|
||||
$this->shutdown();
|
||||
@ -2470,6 +2473,9 @@ class Server{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $type
|
||||
*/
|
||||
public function sendUsage($type = SendUsageTask::TYPE_STATUS){
|
||||
if((bool) $this->getProperty("anonymous-statistics.enabled", true)){
|
||||
$this->asyncPool->submitTask(new SendUsageTask($this, $type, $this->uniquePlayers));
|
||||
|
@ -58,6 +58,11 @@ class AttributeMap implements \ArrayAccess{
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $offset
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function offsetExists($offset) : bool{
|
||||
return isset($this->attributes[$offset]);
|
||||
}
|
||||
@ -79,6 +84,9 @@ class AttributeMap implements \ArrayAccess{
|
||||
$this->attributes[$offset]->setValue($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $offset
|
||||
*/
|
||||
public function offsetUnset($offset) : void{
|
||||
throw new \RuntimeException("Could not unset an attribute from an attribute map");
|
||||
}
|
||||
|
@ -342,6 +342,9 @@ class RegionLoader{
|
||||
fwrite($this->filePointer, pack("N*", ...$write), 4096 * 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $index
|
||||
*/
|
||||
protected function writeLocationIndex($index){
|
||||
fseek($this->filePointer, $index << 2);
|
||||
fwrite($this->filePointer, Binary::writeInt(($this->locationTable[$index]->getFirstSector() << 8) | $this->locationTable[$index]->getSectorCount()), 4);
|
||||
|
@ -66,18 +66,29 @@ abstract class BiomeSelector{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $x
|
||||
* @param float $z
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getTemperature($x, $z){
|
||||
return ($this->temperature->noise2D($x, $z, true) + 1) / 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $x
|
||||
* @param float $z
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getRainfall($x, $z){
|
||||
return ($this->rainfall->noise2D($x, $z, true) + 1) / 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: not sure on types here
|
||||
* @param int|float $x
|
||||
* @param int|float $z
|
||||
* @param int $x
|
||||
* @param int $z
|
||||
*
|
||||
* @return Biome
|
||||
*/
|
||||
|
@ -46,22 +46,62 @@ abstract class Noise{
|
||||
/** @var float */
|
||||
protected $expansion;
|
||||
|
||||
/**
|
||||
* @param float $x
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function floor($x) : int{
|
||||
return $x >= 0 ? (int) $x : (int) ($x - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $x
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function fade($x){
|
||||
return $x * $x * $x * ($x * ($x * 6 - 15) + 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $x
|
||||
* @param float $y
|
||||
* @param float $z
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function lerp($x, $y, $z){
|
||||
return $y + $x * ($z - $y);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $x
|
||||
* @param float $x1
|
||||
* @param float $x2
|
||||
* @param float $q0
|
||||
* @param float $q1
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function linearLerp($x, $x1, $x2, $q0, $q1){
|
||||
return (($x2 - $x) / ($x2 - $x1)) * $q0 + (($x - $x1) / ($x2 - $x1)) * $q1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $x
|
||||
* @param float $y
|
||||
* @param float $q00
|
||||
* @param float $q01
|
||||
* @param float $q10
|
||||
* @param float $q11
|
||||
* @param float $x1
|
||||
* @param float $x2
|
||||
* @param float $y1
|
||||
* @param float $y2
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function bilinearLerp($x, $y, $q00, $q01, $q10, $q11, $x1, $x2, $y1, $y2){
|
||||
$dx1 = (($x2 - $x) / ($x2 - $x1));
|
||||
$dx2 = (($x - $x1) / ($x2 - $x1));
|
||||
@ -73,6 +113,27 @@ abstract class Noise{
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $x
|
||||
* @param float $y
|
||||
* @param float $z
|
||||
* @param float $q000
|
||||
* @param float $q001
|
||||
* @param float $q010
|
||||
* @param float $q011
|
||||
* @param float $q100
|
||||
* @param float $q101
|
||||
* @param float $q110
|
||||
* @param float $q111
|
||||
* @param float $x1
|
||||
* @param float $x2
|
||||
* @param float $y1
|
||||
* @param float $y2
|
||||
* @param float $z1
|
||||
* @param float $z2
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function trilinearLerp($x, $y, $z, $q000, $q001, $q010, $q011, $q100, $q101, $q110, $q111, $x1, $x2, $y1, $y2, $z1, $z2){
|
||||
$dx1 = (($x2 - $x) / ($x2 - $x1));
|
||||
$dx2 = (($x - $x1) / ($x2 - $x1));
|
||||
@ -94,6 +155,14 @@ abstract class Noise{
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $hash
|
||||
* @param float $x
|
||||
* @param float $y
|
||||
* @param float $z
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public static function grad($hash, $x, $y, $z){
|
||||
$hash &= 15;
|
||||
$u = $hash < 8 ? $x : $y;
|
||||
@ -102,10 +171,30 @@ abstract class Noise{
|
||||
return (($hash & 1) === 0 ? $u : -$u) + (($hash & 2) === 0 ? $v : -$v);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $x
|
||||
* @param float $z
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
abstract public function getNoise2D($x, $z);
|
||||
|
||||
/**
|
||||
* @param float $x
|
||||
* @param float $y
|
||||
* @param float $z
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
abstract public function getNoise3D($x, $y, $z);
|
||||
|
||||
/**
|
||||
* @param float $x
|
||||
* @param float $z
|
||||
* @param bool $normalized
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function noise2D($x, $z, $normalized = false){
|
||||
$result = 0;
|
||||
$amp = 1;
|
||||
@ -129,6 +218,14 @@ abstract class Noise{
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $x
|
||||
* @param float $y
|
||||
* @param float $z
|
||||
* @param bool $normalized
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function noise3D($x, $y, $z, $normalized = false){
|
||||
$result = 0;
|
||||
$amp = 1;
|
||||
@ -304,6 +401,11 @@ abstract class Noise{
|
||||
return $noiseArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $x
|
||||
* @param float $y
|
||||
* @param float $z
|
||||
*/
|
||||
public function setOffset($x, $y, $z){
|
||||
$this->offsetX = $x;
|
||||
$this->offsetY = $y;
|
||||
|
@ -34,6 +34,12 @@ class Perlin extends Noise{
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @param Random $random
|
||||
* @param int $octaves
|
||||
* @param float $persistence
|
||||
* @param float $expansion
|
||||
*/
|
||||
public function __construct(Random $random, $octaves, $persistence, $expansion = 1){
|
||||
$this->octaves = $octaves;
|
||||
$this->persistence = $persistence;
|
||||
|
@ -83,6 +83,12 @@ class Simplex extends Perlin{
|
||||
protected $offsetW;
|
||||
|
||||
|
||||
/**
|
||||
* @param Random $random
|
||||
* @param int $octaves
|
||||
* @param float $persistence
|
||||
* @param float $expansion
|
||||
*/
|
||||
public function __construct(Random $random, $octaves, $persistence, $expansion = 1){
|
||||
parent::__construct($random, $octaves, $persistence, $expansion);
|
||||
$this->offsetW = $random->nextFloat() * 256;
|
||||
@ -100,14 +106,38 @@ class Simplex extends Perlin{
|
||||
self::$G44 = self::$G4 * 4.0 - 1.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int[] $g
|
||||
* @param float $x
|
||||
* @param float $y
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
protected static function dot2D($g, $x, $y){
|
||||
return $g[0] * $x + $g[1] * $y;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int[] $g
|
||||
* @param float $x
|
||||
* @param float $y
|
||||
* @param float $z
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
protected static function dot3D($g, $x, $y, $z){
|
||||
return $g[0] * $x + $g[1] * $y + $g[2] * $z;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int[] $g
|
||||
* @param float $x
|
||||
* @param float $y
|
||||
* @param float $z
|
||||
* @param float $w
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
protected static function dot4D($g, $x, $y, $z, $w){
|
||||
return $g[0] * $x + $g[1] * $y + $g[2] * $z + $g[3] * $w;
|
||||
}
|
||||
|
@ -35,10 +35,16 @@ class TallGrass extends Populator{
|
||||
/** @var int */
|
||||
private $baseAmount = 0;
|
||||
|
||||
/**
|
||||
* @param int $amount
|
||||
*/
|
||||
public function setRandomAmount($amount){
|
||||
$this->randomAmount = $amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $amount
|
||||
*/
|
||||
public function setBaseAmount($amount){
|
||||
$this->baseAmount = $amount;
|
||||
}
|
||||
|
@ -40,14 +40,23 @@ class Tree extends Populator{
|
||||
/** @var int */
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* @param int $type
|
||||
*/
|
||||
public function __construct($type = Sapling::OAK){
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $amount
|
||||
*/
|
||||
public function setRandomAmount($amount){
|
||||
$this->randomAmount = $amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $amount
|
||||
*/
|
||||
public function setBaseAmount($amount){
|
||||
$this->baseAmount = $amount;
|
||||
}
|
||||
|
@ -61,6 +61,10 @@ class Network{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param float $upload
|
||||
* @param float $download
|
||||
*/
|
||||
public function addStatistics($upload, $download){
|
||||
$this->upload += $upload;
|
||||
$this->download += $download;
|
||||
|
@ -217,6 +217,9 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $name
|
||||
*/
|
||||
public function setPortCheck($name){
|
||||
$this->interface->sendOption("portChecking", (bool) $name);
|
||||
}
|
||||
|
@ -162,6 +162,13 @@ class CraftingDataPacket extends DataPacket{
|
||||
$this->cleanRecipes = $this->getBool();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $entry
|
||||
* @param NetworkBinaryStream $stream
|
||||
* @param int $pos
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private static function writeEntry($entry, NetworkBinaryStream $stream, int $pos){
|
||||
if($entry instanceof ShapelessRecipe){
|
||||
return self::writeShapelessRecipe($entry, $stream, $pos);
|
||||
|
@ -156,10 +156,17 @@ abstract class DataPacket extends NetworkBinaryStream{
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*/
|
||||
public function __get($name){
|
||||
throw new \Error("Undefined property: " . get_class($this) . "::\$" . $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function __set($name, $value){
|
||||
throw new \Error("Undefined property: " . get_class($this) . "::\$" . $name);
|
||||
}
|
||||
|
@ -95,6 +95,14 @@ class RCONInstance extends Thread{
|
||||
$this->start(PTHREADS_INHERIT_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param resource $client
|
||||
* @param int $requestID
|
||||
* @param int $packetType
|
||||
* @param string $payload
|
||||
*
|
||||
* @return int|false
|
||||
*/
|
||||
private function writePacket($client, int $requestID, int $packetType, string $payload){
|
||||
$pk = Binary::writeLInt($requestID)
|
||||
. Binary::writeLInt($packetType)
|
||||
@ -103,6 +111,14 @@ class RCONInstance extends Thread{
|
||||
return socket_write($client, Binary::writeLInt(strlen($pk)) . $pk);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param resource $client
|
||||
* @param int $requestID reference parameter
|
||||
* @param int $packetType reference parameter
|
||||
* @param string $payload reference parameter
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function readPacket($client, ?int &$requestID, ?int &$packetType, ?string &$payload){
|
||||
$d = @socket_read($client, 4);
|
||||
|
||||
@ -251,6 +267,9 @@ class RCONInstance extends Thread{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param resource $client
|
||||
*/
|
||||
private function disconnectClient($client) : void{
|
||||
socket_getpeername($client, $ip, $port);
|
||||
@socket_set_option($client, SOL_SOCKET, SO_LINGER, ["l_onoff" => 1, "l_linger" => 1]);
|
||||
|
@ -31,6 +31,9 @@ class MethodEventExecutor implements EventExecutor{
|
||||
/** @var string */
|
||||
private $method;
|
||||
|
||||
/**
|
||||
* @param string $method
|
||||
*/
|
||||
public function __construct($method){
|
||||
$this->method = $method;
|
||||
}
|
||||
@ -39,6 +42,9 @@ class MethodEventExecutor implements EventExecutor{
|
||||
$listener->{$this->getMethod()}($event);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMethod(){
|
||||
return $this->method;
|
||||
}
|
||||
|
@ -286,6 +286,12 @@ class MainLogger extends \AttachableThreadedLogger{
|
||||
$this->notify();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
* @param string $level
|
||||
* @param string $prefix
|
||||
* @param string $color
|
||||
*/
|
||||
protected function send($message, $level, $prefix, $color){
|
||||
/** @var \DateTime|null $time */
|
||||
static $time = null;
|
||||
|
@ -25,7 +25,14 @@ namespace pocketmine\utils;
|
||||
|
||||
class ReversePriorityQueue extends \SplPriorityQueue{
|
||||
|
||||
/**
|
||||
* @param mixed $priority1
|
||||
* @param mixed $priority2
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function compare($priority1, $priority2){
|
||||
//TODO: this will crash if non-numeric priorities are used
|
||||
return (int) -($priority1 - $priority2);
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,9 @@ class ServerKiller extends Thread{
|
||||
/** @var bool */
|
||||
private $stopped = false;
|
||||
|
||||
/**
|
||||
* @param int $time
|
||||
*/
|
||||
public function __construct($time = 15){
|
||||
$this->time = $time;
|
||||
}
|
||||
|
@ -554,6 +554,9 @@ class Utils{
|
||||
return json_decode(base64_decode(strtr($payloadB64, '-_', '+/'), true), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $pid
|
||||
*/
|
||||
public static function kill($pid) : void{
|
||||
if(MainLogger::isRegisteredStatic()){
|
||||
MainLogger::getLogger()->syncFlushBuffer();
|
||||
@ -654,6 +657,11 @@ class Utils{
|
||||
return self::printableTrace(self::currentTrace(++$skipFrames));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function cleanPath($path){
|
||||
$result = str_replace(["\\", ".php", "phar://"], ["/", "", ""], $path);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user