Fixed some doc problems

This commit is contained in:
Dylan K. Taylor 2017-06-25 12:07:28 +01:00
parent c0377fc63a
commit a365c831a8
28 changed files with 50 additions and 33 deletions

View File

@ -291,7 +291,7 @@ namespace pocketmine {
/** /**
* @param string $offset In the format of +09:00, +02:00, -04:00 etc. * @param string $offset In the format of +09:00, +02:00, -04:00 etc.
* *
* @return string * @return string|bool
*/ */
function parse_offset($offset){ function parse_offset($offset){
//Make signed offsets unsigned for date_parse //Make signed offsets unsigned for date_parse

View File

@ -680,7 +680,7 @@ class Block extends Position implements BlockIds, Metadatable{
* @param Vector3 $pos1 * @param Vector3 $pos1
* @param Vector3 $pos2 * @param Vector3 $pos2
* *
* @return MovingObjectPosition * @return MovingObjectPosition|null
*/ */
public function calculateIntercept(Vector3 $pos1, Vector3 $pos2){ public function calculateIntercept(Vector3 $pos1, Vector3 $pos2){
$bb = $this->getBoundingBox(); $bb = $this->getBoundingBox();

View File

@ -139,7 +139,7 @@ abstract class Command{
} }
/** /**
* @return string * @return string|null
*/ */
public function getPermission(){ public function getPermission(){
return $this->commandData["pocketminePermission"] ?? null; return $this->commandData["pocketminePermission"] ?? null;

View File

@ -160,7 +160,7 @@ class CommandReader extends Thread{
*/ */
public function getLine(){ public function getLine(){
if($this->buffer->count() !== 0){ if($this->buffer->count() !== 0){
return $this->buffer->shift(); return (string) $this->buffer->shift();
} }
return null; return null;

View File

@ -133,7 +133,7 @@ class ParticleCommand extends VanillaCommand{
* @param float $zd * @param float $zd
* @param int|null $data * @param int|null $data
* *
* @return Particle * @return Particle|null
*/ */
private function getParticle($name, Vector3 $pos, $xd, $yd, $zd, $data){ private function getParticle($name, Vector3 $pos, $xd, $yd, $zd, $data){
switch($name){ switch($name){

View File

@ -698,7 +698,7 @@ abstract class Entity extends Location implements Metadatable{
* @param CompoundTag $nbt * @param CompoundTag $nbt
* @param $args * @param $args
* *
* @return Entity * @return Entity|null
*/ */
public static function createEntity($type, Level $level, CompoundTag $nbt, ...$args){ public static function createEntity($type, Level $level, CompoundTag $nbt, ...$args){
if(isset(self::$knownEntities[$type])){ if(isset(self::$knownEntities[$type])){
@ -1897,7 +1897,7 @@ abstract class Entity extends Location implements Metadatable{
/** /**
* @param int $id * @param int $id
* *
* @return int * @return int|null
*/ */
public function getDataPropertyType($id){ public function getDataPropertyType($id){
return isset($this->dataProperties[$id]) ? $this->dataProperties[$id][0] : null; return isset($this->dataProperties[$id]) ? $this->dataProperties[$id][0] : null;

View File

@ -328,7 +328,7 @@ abstract class Living extends Entity implements Damageable{
* @param int $maxDistance * @param int $maxDistance
* @param array $transparent * @param array $transparent
* *
* @return Block * @return Block|null
*/ */
public function getTargetBlock($maxDistance, array $transparent = []){ public function getTargetBlock($maxDistance, array $transparent = []){
try{ try{

View File

@ -36,7 +36,9 @@ abstract class Event{
* Not doing so will deny the proper event initialization * Not doing so will deny the proper event initialization
*/ */
/** @var string|null */
protected $eventName = null; protected $eventName = null;
/** @var bool */
private $isCancelled = false; private $isCancelled = false;
/** /**

View File

@ -48,7 +48,7 @@ class TranslationContainer extends TextContainer{
/** /**
* @param int $i * @param int $i
* *
* @return string * @return string|null
*/ */
public function getParameter($i){ public function getParameter($i){
return isset($this->params[$i]) ? $this->params[$i] : null; return isset($this->params[$i]) ? $this->params[$i] : null;

View File

@ -36,6 +36,7 @@ use pocketmine\entity\Vehicle;
class EntityDespawnEvent extends EntityEvent{ class EntityDespawnEvent extends EntityEvent{
public static $handlerList = null; public static $handlerList = null;
/** @var int */
private $entityType; private $entityType;
/** /**

View File

@ -36,6 +36,7 @@ use pocketmine\entity\Vehicle;
class EntitySpawnEvent extends EntityEvent{ class EntitySpawnEvent extends EntityEvent{
public static $handlerList = null; public static $handlerList = null;
/** @var int */
private $entityType; private $entityType;
/** /**

View File

@ -33,7 +33,9 @@ use pocketmine\utils\Utils;
class LowMemoryEvent extends ServerEvent{ class LowMemoryEvent extends ServerEvent{
public static $handlerList = null; public static $handlerList = null;
/** @var int */
private $memory; private $memory;
/** @var int */
private $memoryLimit; private $memoryLimit;
private $triggerCount; private $triggerCount;
private $global; private $global;
@ -60,7 +62,7 @@ class LowMemoryEvent extends ServerEvent{
* @return int * @return int
*/ */
public function getMemoryLimit(){ public function getMemoryLimit(){
return $this->memory; return $this->memoryLimit;
} }
/** /**

View File

@ -151,7 +151,7 @@ class CraftingManager{
/** /**
* @param UUID $id * @param UUID $id
* @return Recipe * @return Recipe|null
*/ */
public function getRecipe(UUID $id){ public function getRecipe(UUID $id){
$index = $id->toBinary(); $index = $id->toBinary();
@ -175,7 +175,7 @@ class CraftingManager{
/** /**
* @param Item $input * @param Item $input
* *
* @return FurnaceRecipe * @return FurnaceRecipe|null
*/ */
public function matchFurnaceRecipe(Item $input){ public function matchFurnaceRecipe(Item $input){
if(isset($this->furnaceRecipes[$input->getId() . ":" . $input->getDamage()])){ if(isset($this->furnaceRecipes[$input->getId() . ":" . $input->getDamage()])){

View File

@ -51,7 +51,7 @@ class InventoryType{
/** /**
* @param $index * @param $index
* *
* @return InventoryType * @return InventoryType|null
*/ */
public static function get($index){ public static function get($index){
return static::$default[$index] ?? null; return static::$default[$index] ?? null;

View File

@ -294,7 +294,7 @@ class Item implements ItemIds, \JsonSerializable{
/** /**
* @param $index * @param $index
* *
* @return Item * @return Item|null
*/ */
public static function getCreativeItem(int $index){ public static function getCreativeItem(int $index){
return Item::$creative[$index] ?? null; return Item::$creative[$index] ?? null;

View File

@ -1848,7 +1848,7 @@ class Level implements ChunkManager, Metadatable{
/** /**
* @param int $entityId * @param int $entityId
* *
* @return Entity * @return Entity|null
*/ */
public function getEntity(int $entityId){ public function getEntity(int $entityId){
return $this->entities[$entityId] ?? null; return $this->entities[$entityId] ?? null;
@ -1935,7 +1935,7 @@ class Level implements ChunkManager, Metadatable{
/** /**
* @param $tileId * @param $tileId
* *
* @return Tile * @return Tile|null
*/ */
public function getTileById(int $tileId){ public function getTileById(int $tileId){
return $this->tiles[$tileId] ?? null; return $this->tiles[$tileId] ?? null;
@ -1962,7 +1962,7 @@ class Level implements ChunkManager, Metadatable{
* *
* @param Vector3 $pos * @param Vector3 $pos
* *
* @return Tile * @return Tile|null
*/ */
public function getTile(Vector3 $pos){ public function getTile(Vector3 $pos){
$chunk = $this->getChunk($pos->x >> 4, $pos->z >> 4, false); $chunk = $this->getChunk($pos->x >> 4, $pos->z >> 4, false);
@ -2196,7 +2196,7 @@ class Level implements ChunkManager, Metadatable{
* @param int $z * @param int $z
* @param bool $create Whether to generate the chunk if it does not exist * @param bool $create Whether to generate the chunk if it does not exist
* *
* @return Chunk * @return Chunk|null
*/ */
public function getChunk(int $x, int $z, bool $create = false){ public function getChunk(int $x, int $z, bool $create = false){
if(isset($this->chunks[$index = Level::chunkHash($x, $z)])){ if(isset($this->chunks[$index = Level::chunkHash($x, $z)])){

View File

@ -33,6 +33,12 @@ class SimpleChunkManager implements ChunkManager{
protected $seed; protected $seed;
protected $worldHeight; protected $worldHeight;
/**
* SimpleChunkManager constructor.
*
* @param int $seed
* @param int $worldHeight
*/
public function __construct($seed, int $worldHeight = Level::Y_MAX){ public function __construct($seed, int $worldHeight = Level::Y_MAX){
$this->seed = $seed; $this->seed = $seed;
$this->worldHeight = $worldHeight; $this->worldHeight = $worldHeight;

View File

@ -67,12 +67,13 @@ class Chunk{
/** @var Entity[] */ /** @var Entity[] */
protected $entities = []; protected $entities = [];
/** @var int[256] */ /** @var int[] */
protected $heightMap = []; protected $heightMap = [];
/** @var string */ /** @var string */
protected $biomeIds; protected $biomeIds;
/** @var int[] */
protected $extraData = []; protected $extraData = [];
/** @var CompoundTag[] */ /** @var CompoundTag[] */

View File

@ -430,7 +430,7 @@ class McRegion extends BaseLevelProvider{
* @param int $x * @param int $x
* @param int $z * @param int $z
* *
* @return RegionLoader * @return RegionLoader|null
*/ */
protected function getRegion(int $x, int $z){ protected function getRegion(int $x, int $z){
return $this->regions[Level::chunkHash($x, $z)] ?? null; return $this->regions[Level::chunkHash($x, $z)] ?? null;

View File

@ -245,7 +245,7 @@ class Vector3{
* @param Vector3 $v * @param Vector3 $v
* @param float $x * @param float $x
* *
* @return Vector3 * @return Vector3|null
*/ */
public function getIntermediateWithXValue(Vector3 $v, $x){ public function getIntermediateWithXValue(Vector3 $v, $x){
$xDiff = $v->x - $this->x; $xDiff = $v->x - $this->x;
@ -272,7 +272,7 @@ class Vector3{
* @param Vector3 $v * @param Vector3 $v
* @param float $y * @param float $y
* *
* @return Vector3 * @return Vector3|null
*/ */
public function getIntermediateWithYValue(Vector3 $v, $y){ public function getIntermediateWithYValue(Vector3 $v, $y){
$xDiff = $v->x - $this->x; $xDiff = $v->x - $this->x;
@ -299,7 +299,7 @@ class Vector3{
* @param Vector3 $v * @param Vector3 $v
* @param float $z * @param float $z
* *
* @return Vector3 * @return Vector3|null
*/ */
public function getIntermediateWithZValue(Vector3 $v, $z){ public function getIntermediateWithZValue(Vector3 $v, $z){
$xDiff = $v->x - $this->x; $xDiff = $v->x - $this->x;

View File

@ -104,9 +104,9 @@ class BanEntry{
/** /**
* @param string $str * @param string $str
* *
* @return BanEntry * @return BanEntry|null
*/ */
public static function fromString($str){ public static function fromString(string $str){
if(strlen($str) < 2){ if(strlen($str) < 2){
return null; return null;
}else{ }else{

View File

@ -47,7 +47,7 @@ class PharPluginLoader implements PluginLoader{
* *
* @param string $file * @param string $file
* *
* @return Plugin * @return Plugin|null
* *
* @throws \Exception * @throws \Exception
*/ */
@ -80,7 +80,7 @@ class PharPluginLoader implements PluginLoader{
* *
* @param string $file * @param string $file
* *
* @return PluginDescription * @return PluginDescription|null
*/ */
public function getPluginDescription($file){ public function getPluginDescription($file){
$phar = new \Phar($file); $phar = new \Phar($file);

View File

@ -45,6 +45,9 @@ interface Plugin extends CommandExecutor{
*/ */
public function onEnable(); public function onEnable();
/**
* @return bool
*/
public function isEnabled(); public function isEnabled();
/** /**

View File

@ -137,7 +137,7 @@ abstract class PluginBase implements Plugin{
/** /**
* @param string $name * @param string $name
* *
* @return Command|PluginIdentifiableCommand * @return Command|PluginIdentifiableCommand|null
*/ */
public function getCommand($name){ public function getCommand($name){
$command = $this->getServer()->getPluginCommand($name); $command = $this->getServer()->getPluginCommand($name);
@ -177,7 +177,7 @@ abstract class PluginBase implements Plugin{
* *
* @param string $filename * @param string $filename
* *
* @return resource Resource data, or null * @return resource|null Resource data, or null
*/ */
public function getResource($filename){ public function getResource($filename){
$filename = rtrim(str_replace("\\", "/", $filename), "/"); $filename = rtrim(str_replace("\\", "/", $filename), "/");

View File

@ -48,7 +48,7 @@ class ScriptPluginLoader implements PluginLoader{
* *
* @param string $file * @param string $file
* *
* @return Plugin * @return Plugin|null
* *
* @throws \Exception * @throws \Exception
*/ */
@ -82,7 +82,7 @@ class ScriptPluginLoader implements PluginLoader{
* *
* @param string $file * @param string $file
* *
* @return PluginDescription * @return PluginDescription|null
*/ */
public function getPluginDescription($file){ public function getPluginDescription($file){
$content = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); $content = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);

View File

@ -225,7 +225,7 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
} }
/** /**
* @return Chest * @return Chest|null
*/ */
public function getPair(){ public function getPair(){
if($this->isPaired()){ if($this->isPaired()){

View File

@ -82,7 +82,7 @@ abstract class Tile extends Position{
* @param CompoundTag $nbt * @param CompoundTag $nbt
* @param $args * @param $args
* *
* @return Tile * @return Tile|null
*/ */
public static function createTile($type, Level $level, CompoundTag $nbt, ...$args){ public static function createTile($type, Level $level, CompoundTag $nbt, ...$args){
if(isset(self::$knownTiles[$type])){ if(isset(self::$knownTiles[$type])){

View File

@ -36,6 +36,7 @@ class Utils{
public static $online = true; public static $online = true;
public static $ip = false; public static $ip = false;
public static $os; public static $os;
/** @var UUID|null */
private static $serverUniqueId = null; private static $serverUniqueId = null;
/** /**