Mass removal of useless @param/@return PHPDoc annotations, pass 1

This commit is contained in:
Dylan K. Taylor 2020-01-21 15:10:18 +00:00
parent 7532c609fb
commit c4793241f5
322 changed files with 0 additions and 5360 deletions

View File

@ -106,13 +106,6 @@ abstract class Achievement{
]; ];
/**
* @param Player $player
* @param string $achievementId
*
* @return bool
*/
public static function broadcast(Player $player, string $achievementId) : bool{ public static function broadcast(Player $player, string $achievementId) : bool{
if(isset(Achievement::$list[$achievementId])){ if(isset(Achievement::$list[$achievementId])){
$translation = new TranslationContainer("chat.type.achievement", [$player->getDisplayName(), TextFormat::GREEN . Achievement::$list[$achievementId]["name"] . TextFormat::RESET]); $translation = new TranslationContainer("chat.type.achievement", [$player->getDisplayName(), TextFormat::GREEN . Achievement::$list[$achievementId]["name"] . TextFormat::RESET]);
@ -128,13 +121,6 @@ abstract class Achievement{
return false; return false;
} }
/**
* @param string $achievementId
* @param string $achievementName
* @param array $requires
*
* @return bool
*/
public static function add(string $achievementId, string $achievementName, array $requires = []) : bool{ public static function add(string $achievementId, string $achievementName, array $requires = []) : bool{
if(!isset(Achievement::$list[$achievementId])){ if(!isset(Achievement::$list[$achievementId])){
Achievement::$list[$achievementId] = [ Achievement::$list[$achievementId] = [

View File

@ -27,36 +27,20 @@ use pocketmine\permission\ServerOperator;
interface IPlayer extends ServerOperator{ interface IPlayer extends ServerOperator{
/**
* @return bool
*/
public function isOnline() : bool; public function isOnline() : bool;
/**
* @return string
*/
public function getName() : string; public function getName() : string;
/**
* @return bool
*/
public function isBanned() : bool; public function isBanned() : bool;
/** /**
* @param bool $banned
*
* @return void * @return void
*/ */
public function setBanned(bool $banned); public function setBanned(bool $banned);
/**
* @return bool
*/
public function isWhitelisted() : bool; public function isWhitelisted() : bool;
/** /**
* @param bool $value
*
* @return void * @return void
*/ */
public function setWhitelisted(bool $value); public function setWhitelisted(bool $value);
@ -76,9 +60,6 @@ interface IPlayer extends ServerOperator{
*/ */
public function getLastPlayed(); public function getLastPlayed();
/**
* @return bool
*/
public function hasPlayedBefore() : bool; public function hasPlayedBefore() : bool;
} }

View File

@ -169,26 +169,16 @@ class MemoryManager{
gc_enable(); gc_enable();
} }
/**
* @return bool
*/
public function isLowMemory() : bool{ public function isLowMemory() : bool{
return $this->lowMemory; return $this->lowMemory;
} }
/**
* @return bool
*/
public function canUseChunkCache() : bool{ public function canUseChunkCache() : bool{
return !$this->lowMemory or !$this->lowMemDisableChunkCache; return !$this->lowMemory or !$this->lowMemDisableChunkCache;
} }
/** /**
* Returns the allowed chunk radius based on the current memory usage. * Returns the allowed chunk radius based on the current memory usage.
*
* @param int $distance
*
* @return int
*/ */
public function getViewDistance(int $distance) : int{ public function getViewDistance(int $distance) : int{
return ($this->lowMemory and $this->lowMemChunkRadiusOverride > 0) ? (int) min($this->lowMemChunkRadiusOverride, $distance) : $distance; return ($this->lowMemory and $this->lowMemChunkRadiusOverride > 0) ? (int) min($this->lowMemChunkRadiusOverride, $distance) : $distance;
@ -197,11 +187,6 @@ class MemoryManager{
/** /**
* Triggers garbage collection and cache cleanup to try and free memory. * Triggers garbage collection and cache cleanup to try and free memory.
* *
* @param int $memory
* @param int $limit
* @param bool $global
* @param int $triggerCount
*
* @return void * @return void
*/ */
public function trigger(int $memory, int $limit, bool $global = false, int $triggerCount = 0){ public function trigger(int $memory, int $limit, bool $global = false, int $triggerCount = 0){
@ -272,9 +257,6 @@ class MemoryManager{
Timings::$memoryManagerTimer->stopTiming(); Timings::$memoryManagerTimer->stopTiming();
} }
/**
* @return int
*/
public function triggerGarbageCollector() : int{ public function triggerGarbageCollector() : int{
Timings::$garbageCollectorTimer->startTiming(); Timings::$garbageCollectorTimer->startTiming();
@ -298,10 +280,6 @@ class MemoryManager{
/** /**
* Dumps the server memory into the specified output folder. * Dumps the server memory into the specified output folder.
* *
* @param string $outputFolder
* @param int $maxNesting
* @param int $maxStringSize
*
* @return void * @return void
*/ */
public function dumpServerMemory(string $outputFolder, int $maxNesting, int $maxStringSize){ public function dumpServerMemory(string $outputFolder, int $maxNesting, int $maxStringSize){
@ -320,10 +298,6 @@ class MemoryManager{
* Static memory dumper accessible from any thread. * Static memory dumper accessible from any thread.
* *
* @param mixed $startingObject * @param mixed $startingObject
* @param string $outputFolder
* @param int $maxNesting
* @param int $maxStringSize
* @param \Logger $logger
* *
* @return void * @return void
* @throws \ReflectionException * @throws \ReflectionException
@ -482,9 +456,6 @@ class MemoryManager{
* @param mixed $data reference parameter * @param mixed $data reference parameter
* @param object[] $objects reference parameter * @param object[] $objects reference parameter
* @param int[] $refCounts reference parameter * @param int[] $refCounts reference parameter
* @param int $recursion
* @param int $maxNesting
* @param int $maxStringSize
*/ */
private static function continueDump($from, &$data, array &$objects, array &$refCounts, int $recursion, int $maxNesting, int $maxStringSize) : void{ private static function continueDump($from, &$data, array &$objects, array &$refCounts, int $recursion, int $maxNesting, int $maxStringSize) : void{
if($maxNesting <= 0){ if($maxNesting <= 0){

View File

@ -37,10 +37,6 @@ class OfflinePlayer implements IPlayer, Metadatable{
/** @var CompoundTag|null */ /** @var CompoundTag|null */
private $namedtag = null; private $namedtag = null;
/**
* @param Server $server
* @param string $name
*/
public function __construct(Server $server, string $name){ public function __construct(Server $server, string $name){
$this->server = $server; $this->server = $server;
$this->name = $name; $this->name = $name;

View File

@ -218,8 +218,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
* Validates the given username. * Validates the given username.
* *
* @param string $name * @param string $name
*
* @return bool
*/ */
public static function isValidUserName(?string $name) : bool{ public static function isValidUserName(?string $name) : bool{
if($name === null){ if($name === null){
@ -432,8 +430,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* If the player is logged into Xbox Live, returns their Xbox user ID (XUID) as a string. Returns an empty string if * If the player is logged into Xbox Live, returns their Xbox user ID (XUID) as a string. Returns an empty string if
* the player is not logged into Xbox Live. * the player is not logged into Xbox Live.
*
* @return string
*/ */
public function getXuid() : string{ public function getXuid() : string{
return $this->xuid; return $this->xuid;
@ -453,8 +449,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
* (In the olden days this method used to return a fake UUID computed by the server, which was used by plugins such * (In the olden days this method used to return a fake UUID computed by the server, which was used by plugins such
* as SimpleAuth for authentication. This is NOT SAFE anymore as this UUID is now what was given by the client, NOT * as SimpleAuth for authentication. This is NOT SAFE anymore as this UUID is now what was given by the client, NOT
* a server-computed UUID.) * a server-computed UUID.)
*
* @return UUID|null
*/ */
public function getUniqueId() : ?UUID{ public function getUniqueId() : ?UUID{
return parent::getUniqueId(); return parent::getUniqueId();
@ -477,8 +471,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param bool $value
*
* @return void * @return void
*/ */
public function setAllowFlight(bool $value){ public function setAllowFlight(bool $value){
@ -491,8 +483,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param bool $value
*
* @return void * @return void
*/ */
public function setFlying(bool $value){ public function setFlying(bool $value){
@ -508,8 +498,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param bool $value
*
* @return void * @return void
*/ */
public function setAutoJump(bool $value){ public function setAutoJump(bool $value){
@ -526,17 +514,12 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param bool $value
*
* @return void * @return void
*/ */
public function setAllowMovementCheats(bool $value = true){ public function setAllowMovementCheats(bool $value = true){
$this->allowMovementCheats = $value; $this->allowMovementCheats = $value;
} }
/**
* @param Player $player
*/
public function spawnTo(Player $player) : void{ public function spawnTo(Player $player) : void{
if($this->spawned and $player->spawned and $this->isAlive() and $player->isAlive() and $player->getLevel() === $this->level and $player->canSee($this) and !$this->isSpectator()){ if($this->spawned and $player->spawned and $this->isAlive() and $player->isAlive() and $player->getLevel() === $this->level and $player->canSee($this) and !$this->isSpectator()){
parent::spawnTo($player); parent::spawnTo($player);
@ -550,16 +533,11 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
return $this->server; return $this->server;
} }
/**
* @return bool
*/
public function getRemoveFormat() : bool{ public function getRemoveFormat() : bool{
return $this->removeFormat; return $this->removeFormat;
} }
/** /**
* @param bool $remove
*
* @return void * @return void
*/ */
public function setRemoveFormat(bool $remove = true){ public function setRemoveFormat(bool $remove = true){
@ -577,18 +555,11 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->lineHeight = $height; $this->lineHeight = $height;
} }
/**
* @param Player $player
*
* @return bool
*/
public function canSee(Player $player) : bool{ public function canSee(Player $player) : bool{
return !isset($this->hiddenPlayers[$player->getRawUniqueId()]); return !isset($this->hiddenPlayers[$player->getRawUniqueId()]);
} }
/** /**
* @param Player $player
*
* @return void * @return void
*/ */
public function hidePlayer(Player $player){ public function hidePlayer(Player $player){
@ -600,8 +571,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param Player $player
*
* @return void * @return void
*/ */
public function showPlayer(Player $player){ public function showPlayer(Player $player){
@ -632,8 +601,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param int $distance
*
* @return void * @return void
*/ */
public function setViewDistance(int $distance){ public function setViewDistance(int $distance){
@ -650,23 +617,15 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->server->getLogger()->debug("Setting view distance for " . $this->getName() . " to " . $this->viewDistance . " (requested " . $distance . ")"); $this->server->getLogger()->debug("Setting view distance for " . $this->getName() . " to " . $this->viewDistance . " (requested " . $distance . ")");
} }
/**
* @return bool
*/
public function isOnline() : bool{ public function isOnline() : bool{
return $this->isConnected() and $this->loggedIn; return $this->isConnected() and $this->loggedIn;
} }
/**
* @return bool
*/
public function isOp() : bool{ public function isOp() : bool{
return $this->server->isOp($this->getName()); return $this->server->isOp($this->getName());
} }
/** /**
* @param bool $value
*
* @return void * @return void
*/ */
public function setOp(bool $value){ public function setOp(bool $value){
@ -685,8 +644,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* @param permission\Permission|string $name * @param permission\Permission|string $name
*
* @return bool
*/ */
public function isPermissionSet($name) : bool{ public function isPermissionSet($name) : bool{
return $this->perm->isPermissionSet($name); return $this->perm->isPermissionSet($name);
@ -695,8 +652,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* @param permission\Permission|string $name * @param permission\Permission|string $name
* *
* @return bool
*
* @throws \InvalidStateException if the player is closed * @throws \InvalidStateException if the player is closed
*/ */
public function hasPermission($name) : bool{ public function hasPermission($name) : bool{
@ -707,19 +662,14 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param Plugin $plugin
* @param string $name * @param string $name
* @param bool $value * @param bool $value
*
* @return PermissionAttachment
*/ */
public function addAttachment(Plugin $plugin, string $name = null, bool $value = null) : PermissionAttachment{ public function addAttachment(Plugin $plugin, string $name = null, bool $value = null) : PermissionAttachment{
return $this->perm->addAttachment($plugin, $name, $value); return $this->perm->addAttachment($plugin, $name, $value);
} }
/** /**
* @param PermissionAttachment $attachment
*
* @return void * @return void
*/ */
public function removeAttachment(PermissionAttachment $attachment){ public function removeAttachment(PermissionAttachment $attachment){
@ -797,11 +747,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/**
* @param SourceInterface $interface
* @param string $ip
* @param int $port
*/
public function __construct(SourceInterface $interface, string $ip, int $port){ public function __construct(SourceInterface $interface, string $ip, int $port){
$this->interface = $interface; $this->interface = $interface;
$this->perm = new PermissibleBase($this); $this->perm = new PermissibleBase($this);
@ -823,40 +768,29 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->sessionAdapter = new PlayerNetworkSessionAdapter($this->server, $this); $this->sessionAdapter = new PlayerNetworkSessionAdapter($this->server, $this);
} }
/**
* @return bool
*/
public function isConnected() : bool{ public function isConnected() : bool{
return $this->sessionAdapter !== null; return $this->sessionAdapter !== null;
} }
/** /**
* Gets the username * Gets the username
* @return string
*/ */
public function getName() : string{ public function getName() : string{
return $this->username; return $this->username;
} }
/**
* @return string
*/
public function getLowerCaseName() : string{ public function getLowerCaseName() : string{
return $this->iusername; return $this->iusername;
} }
/** /**
* Returns the "friendly" display name of this player to use in the chat. * Returns the "friendly" display name of this player to use in the chat.
*
* @return string
*/ */
public function getDisplayName() : string{ public function getDisplayName() : string{
return $this->displayName; return $this->displayName;
} }
/** /**
* @param string $name
*
* @return void * @return void
*/ */
public function setDisplayName(string $name){ public function setDisplayName(string $name){
@ -868,7 +802,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Returns the player's locale, e.g. en_US. * Returns the player's locale, e.g. en_US.
* @return string
*/ */
public function getLocale() : string{ public function getLocale() : string{
return $this->locale; return $this->locale;
@ -877,12 +810,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Called when a player changes their skin. * Called when a player changes their skin.
* Plugin developers should not use this, use setSkin() and sendSkin() instead. * Plugin developers should not use this, use setSkin() and sendSkin() instead.
*
* @param Skin $skin
* @param string $newSkinName
* @param string $oldSkinName
*
* @return bool
*/ */
public function changeSkin(Skin $skin, string $newSkinName, string $oldSkinName) : bool{ public function changeSkin(Skin $skin, string $newSkinName, string $oldSkinName) : bool{
if(!$skin->isValid()){ if(!$skin->isValid()){
@ -913,16 +840,11 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Gets the player IP address * Gets the player IP address
*
* @return string
*/ */
public function getAddress() : string{ public function getAddress() : string{
return $this->ip; return $this->ip;
} }
/**
* @return int
*/
public function getPort() : int{ public function getPort() : int{
return $this->port; return $this->port;
} }
@ -930,8 +852,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Returns the last measured latency for this player, in milliseconds. This is measured automatically and reported * Returns the last measured latency for this player, in milliseconds. This is measured automatically and reported
* back by the network interface. * back by the network interface.
*
* @return int
*/ */
public function getPing() : int{ public function getPing() : int{
return $this->lastPingMeasure; return $this->lastPingMeasure;
@ -942,17 +862,12 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
* *
* @internal Plugins should not use this method. * @internal Plugins should not use this method.
* *
* @param int $pingMS
*
* @return void * @return void
*/ */
public function updatePing(int $pingMS){ public function updatePing(int $pingMS){
$this->lastPingMeasure = $pingMS; $this->lastPingMeasure = $pingMS;
} }
/**
* @return Position
*/
public function getNextPosition() : Position{ public function getNextPosition() : Position{
return $this->newPosition !== null ? Position::fromObject($this->newPosition, $this->level) : $this->getPosition(); return $this->newPosition !== null ? Position::fromObject($this->newPosition, $this->level) : $this->getPosition();
} }
@ -963,15 +878,12 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Returns whether the player is currently using an item (right-click and hold). * Returns whether the player is currently using an item (right-click and hold).
* @return bool
*/ */
public function isUsingItem() : bool{ public function isUsingItem() : bool{
return $this->getGenericFlag(self::DATA_FLAG_ACTION) and $this->startAction > -1; return $this->getGenericFlag(self::DATA_FLAG_ACTION) and $this->startAction > -1;
} }
/** /**
* @param bool $value
*
* @return void * @return void
*/ */
public function setUsingItem(bool $value){ public function setUsingItem(bool $value){
@ -982,8 +894,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Returns how long the player has been using their currently-held item for. Used for determining arrow shoot force * Returns how long the player has been using their currently-held item for. Used for determining arrow shoot force
* for bows. * for bows.
*
* @return int
*/ */
public function getItemUseDuration() : int{ public function getItemUseDuration() : int{
return $this->startAction === -1 ? -1 : ($this->server->getTick() - $this->startAction); return $this->startAction === -1 ? -1 : ($this->server->getTick() - $this->startAction);
@ -991,10 +901,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Returns whether the player has a cooldown period left before it can use the given item again. * Returns whether the player has a cooldown period left before it can use the given item again.
*
* @param Item $item
*
* @return bool
*/ */
public function hasItemCooldown(Item $item) : bool{ public function hasItemCooldown(Item $item) : bool{
$this->checkItemCooldowns(); $this->checkItemCooldowns();
@ -1003,8 +909,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Resets the player's cooldown time for the given item back to the maximum. * Resets the player's cooldown time for the given item back to the maximum.
*
* @param Item $item
*/ */
public function resetItemCooldown(Item $item) : void{ public function resetItemCooldown(Item $item) : void{
$ticks = $item->getCooldownTicks(); $ticks = $item->getCooldownTicks();
@ -1044,10 +948,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param int $x
* @param int $z
* @param Level|null $level
*
* @return void * @return void
*/ */
protected function unloadChunk(int $x, int $z, Level $level = null){ protected function unloadChunk(int $x, int $z, Level $level = null){
@ -1067,10 +967,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param int $x
* @param int $z
* @param BatchPacket $payload
*
* @return void * @return void
*/ */
public function sendChunk(int $x, int $z, BatchPacket $payload){ public function sendChunk(int $x, int $z, BatchPacket $payload){
@ -1185,9 +1081,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param Vector3 $pos
* @param int $respawnState
*
* @return void * @return void
*/ */
protected function sendRespawnPacket(Vector3 $pos, int $respawnState = RespawnPacket::SEARCHING_FOR_SPAWN){ protected function sendRespawnPacket(Vector3 $pos, int $respawnState = RespawnPacket::SEARCHING_FOR_SPAWN){
@ -1307,9 +1200,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
} }
/**
* @return bool
*/
public function hasValidSpawnPosition() : bool{ public function hasValidSpawnPosition() : bool{
return $this->spawnPosition !== null and $this->spawnPosition->isValid(); return $this->spawnPosition !== null and $this->spawnPosition->isValid();
} }
@ -1338,18 +1228,10 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->dataPacket($pk); $this->dataPacket($pk);
} }
/**
* @return bool
*/
public function isSleeping() : bool{ public function isSleeping() : bool{
return $this->sleeping !== null; return $this->sleeping !== null;
} }
/**
* @param Vector3 $pos
*
* @return bool
*/
public function sleepOn(Vector3 $pos) : bool{ public function sleepOn(Vector3 $pos) : bool{
if(!$this->isOnline()){ if(!$this->isOnline()){
return false; return false;
@ -1404,11 +1286,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
} }
/**
* @param string $achievementId
*
* @return bool
*/
public function hasAchievement(string $achievementId) : bool{ public function hasAchievement(string $achievementId) : bool{
if(!isset(Achievement::$list[$achievementId])){ if(!isset(Achievement::$list[$achievementId])){
return false; return false;
@ -1417,11 +1294,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
return $this->achievements[$achievementId] ?? false; return $this->achievements[$achievementId] ?? false;
} }
/**
* @param string $achievementId
*
* @return bool
*/
public function awardAchievement(string $achievementId) : bool{ public function awardAchievement(string $achievementId) : bool{
if(isset(Achievement::$list[$achievementId]) and !$this->hasAchievement($achievementId)){ if(isset(Achievement::$list[$achievementId]) and !$this->hasAchievement($achievementId)){
foreach(Achievement::$list[$achievementId]["requires"] as $requirementId){ foreach(Achievement::$list[$achievementId]["requires"] as $requirementId){
@ -1445,8 +1317,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param string $achievementId
*
* @return void * @return void
*/ */
public function removeAchievement(string $achievementId){ public function removeAchievement(string $achievementId){
@ -1455,9 +1325,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
} }
/**
* @return int
*/
public function getGamemode() : int{ public function getGamemode() : int{
return $this->gamemode; return $this->gamemode;
} }
@ -1469,10 +1336,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
* This function takes care of handling gamemodes known to MCPE (as of 1.1.0.3, that includes Survival, Creative and Adventure) * This function takes care of handling gamemodes known to MCPE (as of 1.1.0.3, that includes Survival, Creative and Adventure)
* *
* TODO: remove this when Spectator Mode gets added properly to MCPE * TODO: remove this when Spectator Mode gets added properly to MCPE
*
* @param int $gamemode
*
* @return int
*/ */
public static function getClientFriendlyGamemode(int $gamemode) : int{ public static function getClientFriendlyGamemode(int $gamemode) : int{
$gamemode &= 0x03; $gamemode &= 0x03;
@ -1486,10 +1349,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Sets the gamemode, and if needed, kicks the Player. * Sets the gamemode, and if needed, kicks the Player.
* *
* @param int $gm
* @param bool $client if the client made this change in their GUI * @param bool $client if the client made this change in their GUI
*
* @return bool
*/ */
public function setGamemode(int $gm, bool $client = false) : bool{ public function setGamemode(int $gm, bool $client = false) : bool{
if($gm < 0 or $gm > 3 or $this->gamemode === $gm){ if($gm < 0 or $gm > 3 or $this->gamemode === $gm){
@ -1572,8 +1432,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
* in Adventure Mode. Supply the $literal parameter as true to force a literal Survival Mode check. * in Adventure Mode. Supply the $literal parameter as true to force a literal Survival Mode check.
* *
* @param bool $literal whether a literal check should be performed * @param bool $literal whether a literal check should be performed
*
* @return bool
*/ */
public function isSurvival(bool $literal = false) : bool{ public function isSurvival(bool $literal = false) : bool{
if($literal){ if($literal){
@ -1588,8 +1446,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
* in Spectator Mode. Supply the $literal parameter as true to force a literal Creative Mode check. * in Spectator Mode. Supply the $literal parameter as true to force a literal Creative Mode check.
* *
* @param bool $literal whether a literal check should be performed * @param bool $literal whether a literal check should be performed
*
* @return bool
*/ */
public function isCreative(bool $literal = false) : bool{ public function isCreative(bool $literal = false) : bool{
if($literal){ if($literal){
@ -1604,8 +1460,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
* in Spectator Mode. Supply the $literal parameter as true to force a literal Adventure Mode check. * in Spectator Mode. Supply the $literal parameter as true to force a literal Adventure Mode check.
* *
* @param bool $literal whether a literal check should be performed * @param bool $literal whether a literal check should be performed
*
* @return bool
*/ */
public function isAdventure(bool $literal = false) : bool{ public function isAdventure(bool $literal = false) : bool{
if($literal){ if($literal){
@ -1615,9 +1469,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
} }
/**
* @return bool
*/
public function isSpectator() : bool{ public function isSpectator() : bool{
return $this->gamemode === Player::SPECTATOR; return $this->gamemode === Player::SPECTATOR;
} }
@ -1670,8 +1521,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param int $tickDiff
*
* @return void * @return void
*/ */
protected function processMovement(int $tickDiff){ protected function processMovement(int $tickDiff){
@ -1817,8 +1666,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param bool $sendAll
*
* @return void * @return void
*/ */
public function sendAttributes(bool $sendAll = false){ public function sendAttributes(bool $sendAll = false){
@ -1952,11 +1799,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Returns whether the player can interact with the specified position. This checks distance and direction. * Returns whether the player can interact with the specified position. This checks distance and direction.
* *
* @param Vector3 $pos
* @param float $maxDistance
* @param float $maxDiff defaults to half of the 3D diagonal width of a block * @param float $maxDiff defaults to half of the 3D diagonal width of a block
*
* @return bool
*/ */
public function canInteract(Vector3 $pos, float $maxDistance, float $maxDiff = M_SQRT3 / 2) : bool{ public function canInteract(Vector3 $pos, float $maxDistance, float $maxDiff = M_SQRT3 / 2) : bool{
$eyePos = $this->getPosition()->add(0, $this->getEyeHeight(), 0); $eyePos = $this->getPosition()->add(0, $this->getEyeHeight(), 0);
@ -2078,9 +1921,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param int $status
* @param bool $immediate
*
* @return void * @return void
*/ */
public function sendPlayStatus(int $status, bool $immediate = false){ public function sendPlayStatus(int $status, bool $immediate = false){
@ -2342,10 +2182,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Sends a chat message as this player. If the message begins with a / (forward-slash) it will be treated * Sends a chat message as this player. If the message begins with a / (forward-slash) it will be treated
* as a command. * as a command.
*
* @param string $message
*
* @return bool
*/ */
public function chat(string $message) : bool{ public function chat(string $message) : bool{
if(!$this->spawned or !$this->isAlive()){ if(!$this->spawned or !$this->isAlive()){
@ -2445,10 +2281,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Don't expect much from this handler. Most of it is roughly hacked and duct-taped together. * Don't expect much from this handler. Most of it is roughly hacked and duct-taped together.
*
* @param InventoryTransactionPacket $packet
*
* @return bool
*/ */
public function handleInventoryTransaction(InventoryTransactionPacket $packet) : bool{ public function handleInventoryTransaction(InventoryTransactionPacket $packet) : bool{
if(!$this->spawned or !$this->isAlive()){ if(!$this->spawned or !$this->isAlive()){
@ -3054,8 +2886,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Drops an item on the ground in front of the player. Returns if the item drop was successful. * Drops an item on the ground in front of the player. Returns if the item drop was successful.
* *
* @param Item $item
*
* @return bool if the item was dropped or if the item was null * @return bool if the item was dropped or if the item was null
*/ */
public function dropItem(Item $item) : bool{ public function dropItem(Item $item) : bool{
@ -3267,8 +3097,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Called when a packet is received from the client. This method will call DataPacketReceiveEvent. * Called when a packet is received from the client. This method will call DataPacketReceiveEvent.
* *
* @param DataPacket $packet
*
* @return void * @return void
*/ */
public function handleDataPacket(DataPacket $packet){ public function handleDataPacket(DataPacket $packet){
@ -3279,10 +3107,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Batch a Data packet into the channel list to send at the end of the tick * Batch a Data packet into the channel list to send at the end of the tick
*
* @param DataPacket $packet
*
* @return bool
*/ */
public function batchDataPacket(DataPacket $packet) : bool{ public function batchDataPacket(DataPacket $packet) : bool{
if(!$this->isConnected()){ if(!$this->isConnected()){
@ -3304,10 +3128,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param DataPacket $packet
* @param bool $needACK
* @param bool $immediate
*
* @return bool|int * @return bool|int
*/ */
public function sendDataPacket(DataPacket $packet, bool $needACK = false, bool $immediate = false){ public function sendDataPacket(DataPacket $packet, bool $needACK = false, bool $immediate = false){
@ -3343,9 +3163,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param DataPacket $packet
* @param bool $needACK
*
* @return bool|int * @return bool|int
*/ */
public function dataPacket(DataPacket $packet, bool $needACK = false){ public function dataPacket(DataPacket $packet, bool $needACK = false){
@ -3353,9 +3170,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param DataPacket $packet
* @param bool $needACK
*
* @return bool|int * @return bool|int
*/ */
public function directDataPacket(DataPacket $packet, bool $needACK = false){ public function directDataPacket(DataPacket $packet, bool $needACK = false){
@ -3390,11 +3204,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Kicks a player from the server * Kicks a player from the server
* *
* @param string $reason
* @param bool $isAdmin
* @param TextContainer|string $quitMessage * @param TextContainer|string $quitMessage
*
* @return bool
*/ */
public function kick(string $reason = "", bool $isAdmin = true, $quitMessage = null) : bool{ public function kick(string $reason = "", bool $isAdmin = true, $quitMessage = null) : bool{
$ev = new PlayerKickEvent($this, $reason, $quitMessage ?? $this->getLeaveMessage()); $ev = new PlayerKickEvent($this, $reason, $quitMessage ?? $this->getLeaveMessage());
@ -3422,8 +3232,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Adds a title text to the user's screen, with an optional subtitle. * Adds a title text to the user's screen, with an optional subtitle.
* *
* @param string $title
* @param string $subtitle
* @param int $fadeIn Duration in ticks for fade-in. If -1 is given, client-sided defaults will be used. * @param int $fadeIn Duration in ticks for fade-in. If -1 is given, client-sided defaults will be used.
* @param int $stay Duration in ticks to stay on screen for * @param int $stay Duration in ticks to stay on screen for
* @param int $fadeOut Duration in ticks for fade-out. * @param int $fadeOut Duration in ticks for fade-out.
@ -3441,8 +3249,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Sets the subtitle message, without sending a title. * Sets the subtitle message, without sending a title.
* *
* @param string $subtitle
*
* @return void * @return void
*/ */
public function addSubTitle(string $subtitle){ public function addSubTitle(string $subtitle){
@ -3452,8 +3258,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Adds small text to the user's screen. * Adds small text to the user's screen.
* *
* @param string $message
*
* @return void * @return void
*/ */
public function addActionBarMessage(string $message){ public function addActionBarMessage(string $message){
@ -3505,9 +3309,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Internal function used for sending titles. * Internal function used for sending titles.
* *
* @param string $title
* @param int $type
*
* @return void * @return void
*/ */
protected function sendTitleText(string $title, int $type){ protected function sendTitleText(string $title, int $type){
@ -3540,7 +3341,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param string $message
* @param string[] $parameters * @param string[] $parameters
* *
* @return void * @return void
@ -3567,7 +3367,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
* *
* TODO: add translation type popups * TODO: add translation type popups
* *
* @param string $message
* @param string $subtitle @deprecated * @param string $subtitle @deprecated
* *
* @return void * @return void
@ -3580,8 +3379,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param string $message
*
* @return void * @return void
*/ */
public function sendTip(string $message){ public function sendTip(string $message){
@ -3592,9 +3389,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param string $sender
* @param string $message
*
* @return void * @return void
*/ */
public function sendWhisper(string $sender, string $message){ public function sendWhisper(string $sender, string $message){
@ -3607,8 +3401,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Sends a Form to the player, or queue to send it if a form is already open. * Sends a Form to the player, or queue to send it if a form is already open.
*
* @param Form $form
*/ */
public function sendForm(Form $form) : void{ public function sendForm(Form $form) : void{
$id = $this->formIdCounter++; $id = $this->formIdCounter++;
@ -3624,10 +3416,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param int $formId
* @param mixed $responseData * @param mixed $responseData
*
* @return bool
*/ */
public function onFormSubmit(int $formId, $responseData) : bool{ public function onFormSubmit(int $formId, $responseData) : bool{
if(!isset($this->forms[$formId])){ if(!isset($this->forms[$formId])){
@ -3653,7 +3442,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
* *
* @param TextContainer|string $message Message to be broadcasted * @param TextContainer|string $message Message to be broadcasted
* @param string $reason Reason showed in console * @param string $reason Reason showed in console
* @param bool $notify
*/ */
final public function close($message = "", string $reason = "generic reason", bool $notify = true) : void{ final public function close($message = "", string $reason = "generic reason", bool $notify = true) : void{
if($this->isConnected() and !$this->closed){ if($this->isConnected() and !$this->closed){
@ -3921,10 +3709,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
} }
/** /**
* @param Vector3 $pos
* @param float|null $yaw
* @param float|null $pitch
* @param int $mode
* @param Player[]|null $targets * @param Player[]|null $targets
* *
* @return void * @return void
@ -4004,9 +3788,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
return $this->craftingGrid; return $this->craftingGrid;
} }
/**
* @param CraftingGrid $grid
*/
public function setCraftingGrid(CraftingGrid $grid) : void{ public function setCraftingGrid(CraftingGrid $grid) : void{
$this->craftingGrid = $grid; $this->craftingGrid = $grid;
} }
@ -4033,10 +3814,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Returns the window ID which the inventory has for this player, or -1 if the window is not open to the player. * Returns the window ID which the inventory has for this player, or -1 if the window is not open to the player.
*
* @param Inventory $inventory
*
* @return int
*/ */
public function getWindowId(Inventory $inventory) : int{ public function getWindowId(Inventory $inventory) : int{
return $this->windows[spl_object_hash($inventory)] ?? ContainerIds::NONE; return $this->windows[spl_object_hash($inventory)] ?? ContainerIds::NONE;
@ -4046,8 +3823,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
* Returns the inventory window open to the player with the specified window ID, or null if no window is open with * Returns the inventory window open to the player with the specified window ID, or null if no window is open with
* that ID. * that ID.
* *
* @param int $windowId
*
* @return Inventory|null * @return Inventory|null
*/ */
public function getWindow(int $windowId){ public function getWindow(int $windowId){
@ -4058,12 +3833,9 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
* Opens an inventory window to the player. Returns the ID of the created window, or the existing window ID if the * Opens an inventory window to the player. Returns the ID of the created window, or the existing window ID if the
* player is already viewing the specified inventory. * player is already viewing the specified inventory.
* *
* @param Inventory $inventory
* @param int|null $forceId Forces a special ID for the window * @param int|null $forceId Forces a special ID for the window
* @param bool $isPermanent Prevents the window being removed if true. * @param bool $isPermanent Prevents the window being removed if true.
* *
* @return int
*
* @throws \InvalidArgumentException if a forceID which is already in use is specified * @throws \InvalidArgumentException if a forceID which is already in use is specified
* @throws \InvalidStateException if trying to add a window without forceID when no slots are free * @throws \InvalidStateException if trying to add a window without forceID when no slots are free
*/ */
@ -4105,7 +3877,6 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
/** /**
* Removes an inventory window from the player. * Removes an inventory window from the player.
* *
* @param Inventory $inventory
* @param bool $force Forces removal of permanent windows such as normal inventory, cursor * @param bool $force Forces removal of permanent windows such as normal inventory, cursor
* *
* @return void * @return void

View File

@ -346,72 +346,42 @@ class Server{
/** @var Level */ /** @var Level */
private $levelDefault = null; private $levelDefault = null;
/**
* @return string
*/
public function getName() : string{ public function getName() : string{
return \pocketmine\NAME; return \pocketmine\NAME;
} }
/**
* @return bool
*/
public function isRunning() : bool{ public function isRunning() : bool{
return $this->isRunning; return $this->isRunning;
} }
/**
* @return string
*/
public function getPocketMineVersion() : string{ public function getPocketMineVersion() : string{
return \pocketmine\VERSION; return \pocketmine\VERSION;
} }
/**
* @return string
*/
public function getVersion() : string{ public function getVersion() : string{
return ProtocolInfo::MINECRAFT_VERSION; return ProtocolInfo::MINECRAFT_VERSION;
} }
/**
* @return string
*/
public function getApiVersion() : string{ public function getApiVersion() : string{
return \pocketmine\BASE_VERSION; return \pocketmine\BASE_VERSION;
} }
/**
* @return string
*/
public function getFilePath() : string{ public function getFilePath() : string{
return \pocketmine\PATH; return \pocketmine\PATH;
} }
/**
* @return string
*/
public function getResourcePath() : string{ public function getResourcePath() : string{
return \pocketmine\RESOURCE_PATH; return \pocketmine\RESOURCE_PATH;
} }
/**
* @return string
*/
public function getDataPath() : string{ public function getDataPath() : string{
return $this->dataPath; return $this->dataPath;
} }
/**
* @return string
*/
public function getPluginPath() : string{ public function getPluginPath() : string{
return $this->pluginPath; return $this->pluginPath;
} }
/**
* @return int
*/
public function getMaxPlayers() : int{ public function getMaxPlayers() : int{
return $this->maxPlayers; return $this->maxPlayers;
} }
@ -419,8 +389,6 @@ class Server{
/** /**
* Returns whether the server requires that players be authenticated to Xbox Live. If true, connecting players who * Returns whether the server requires that players be authenticated to Xbox Live. If true, connecting players who
* are not logged into Xbox Live will be disconnected. * are not logged into Xbox Live will be disconnected.
*
* @return bool
*/ */
public function getOnlineMode() : bool{ public function getOnlineMode() : bool{
return $this->onlineMode; return $this->onlineMode;
@ -428,40 +396,26 @@ class Server{
/** /**
* Alias of {@link #getOnlineMode()}. * Alias of {@link #getOnlineMode()}.
* @return bool
*/ */
public function requiresAuthentication() : bool{ public function requiresAuthentication() : bool{
return $this->getOnlineMode(); return $this->getOnlineMode();
} }
/**
* @return int
*/
public function getPort() : int{ public function getPort() : int{
return $this->getConfigInt("server-port", 19132); return $this->getConfigInt("server-port", 19132);
} }
/**
* @return int
*/
public function getViewDistance() : int{ public function getViewDistance() : int{
return max(2, $this->getConfigInt("view-distance", 8)); return max(2, $this->getConfigInt("view-distance", 8));
} }
/** /**
* Returns a view distance up to the currently-allowed limit. * Returns a view distance up to the currently-allowed limit.
*
* @param int $distance
*
* @return int
*/ */
public function getAllowedViewDistance(int $distance) : int{ public function getAllowedViewDistance(int $distance) : int{
return max(2, min($distance, $this->memoryManager->getViewDistance($this->getViewDistance()))); return max(2, min($distance, $this->memoryManager->getViewDistance($this->getViewDistance())));
} }
/**
* @return string
*/
public function getIp() : string{ public function getIp() : string{
$str = $this->getConfigString("server-ip"); $str = $this->getConfigString("server-ip");
return $str !== "" ? $str : "0.0.0.0"; return $str !== "" ? $str : "0.0.0.0";
@ -474,16 +428,11 @@ class Server{
return $this->serverID; return $this->serverID;
} }
/**
* @return bool
*/
public function getAutoSave() : bool{ public function getAutoSave() : bool{
return $this->autoSave; return $this->autoSave;
} }
/** /**
* @param bool $value
*
* @return void * @return void
*/ */
public function setAutoSave(bool $value){ public function setAutoSave(bool $value){
@ -493,40 +442,24 @@ class Server{
} }
} }
/**
* @return string
*/
public function getLevelType() : string{ public function getLevelType() : string{
return $this->getConfigString("level-type", "DEFAULT"); return $this->getConfigString("level-type", "DEFAULT");
} }
/**
* @return bool
*/
public function getGenerateStructures() : bool{ public function getGenerateStructures() : bool{
return $this->getConfigBool("generate-structures", true); return $this->getConfigBool("generate-structures", true);
} }
/**
* @return int
*/
public function getGamemode() : int{ public function getGamemode() : int{
return $this->getConfigInt("gamemode", 0) & 0b11; return $this->getConfigInt("gamemode", 0) & 0b11;
} }
/**
* @return bool
*/
public function getForceGamemode() : bool{ public function getForceGamemode() : bool{
return $this->getConfigBool("force-gamemode", false); return $this->getConfigBool("force-gamemode", false);
} }
/** /**
* Returns the gamemode text name * Returns the gamemode text name
*
* @param int $mode
*
* @return string
*/ */
public static function getGamemodeString(int $mode) : string{ public static function getGamemodeString(int $mode) : string{
switch($mode){ switch($mode){
@ -560,10 +493,6 @@ class Server{
/** /**
* Parses a string and returns a gamemode integer, -1 if not found * Parses a string and returns a gamemode integer, -1 if not found
*
* @param string $str
*
* @return int
*/ */
public static function getGamemodeFromString(string $str) : int{ public static function getGamemodeFromString(string $str) : int{
switch(strtolower(trim($str))){ switch(strtolower(trim($str))){
@ -593,51 +522,34 @@ class Server{
/** /**
* Returns Server global difficulty. Note that this may be overridden in individual Levels. * Returns Server global difficulty. Note that this may be overridden in individual Levels.
* @return int
*/ */
public function getDifficulty() : int{ public function getDifficulty() : int{
return $this->getConfigInt("difficulty", Level::DIFFICULTY_NORMAL); return $this->getConfigInt("difficulty", Level::DIFFICULTY_NORMAL);
} }
/**
* @return bool
*/
public function hasWhitelist() : bool{ public function hasWhitelist() : bool{
return $this->getConfigBool("white-list", false); return $this->getConfigBool("white-list", false);
} }
/**
* @return int
*/
public function getSpawnRadius() : int{ public function getSpawnRadius() : int{
return $this->getConfigInt("spawn-protection", 16); return $this->getConfigInt("spawn-protection", 16);
} }
/** /**
* @deprecated * @deprecated
* @return bool
*/ */
public function getAllowFlight() : bool{ public function getAllowFlight() : bool{
return true; return true;
} }
/**
* @return bool
*/
public function isHardcore() : bool{ public function isHardcore() : bool{
return $this->getConfigBool("hardcore", false); return $this->getConfigBool("hardcore", false);
} }
/**
* @return int
*/
public function getDefaultGamemode() : int{ public function getDefaultGamemode() : int{
return $this->getConfigInt("gamemode", 0) & 0b11; return $this->getConfigInt("gamemode", 0) & 0b11;
} }
/**
* @return string
*/
public function getMotd() : string{ public function getMotd() : string{
return $this->getConfigString("motd", \pocketmine\NAME . " Server"); return $this->getConfigString("motd", \pocketmine\NAME . " Server");
} }
@ -698,9 +610,6 @@ class Server{
return $this->craftingManager; return $this->craftingManager;
} }
/**
* @return ResourcePackManager
*/
public function getResourcePackManager() : ResourcePackManager{ public function getResourcePackManager() : ResourcePackManager{
return $this->resourceManager; return $this->resourceManager;
} }
@ -709,17 +618,12 @@ class Server{
return $this->asyncPool; return $this->asyncPool;
} }
/**
* @return int
*/
public function getTick() : int{ public function getTick() : int{
return $this->tickCounter; return $this->tickCounter;
} }
/** /**
* Returns the last server TPS measure * Returns the last server TPS measure
*
* @return float
*/ */
public function getTicksPerSecond() : float{ public function getTicksPerSecond() : float{
return round($this->currentTPS, 2); return round($this->currentTPS, 2);
@ -727,8 +631,6 @@ class Server{
/** /**
* Returns the last server TPS average measure * Returns the last server TPS average measure
*
* @return float
*/ */
public function getTicksPerSecondAverage() : float{ public function getTicksPerSecondAverage() : float{
return round(array_sum($this->tickAverage) / count($this->tickAverage), 2); return round(array_sum($this->tickAverage) / count($this->tickAverage), 2);
@ -736,8 +638,6 @@ class Server{
/** /**
* Returns the TPS usage/load in % * Returns the TPS usage/load in %
*
* @return float
*/ */
public function getTickUsage() : float{ public function getTickUsage() : float{
return round($this->currentUse * 100, 2); return round($this->currentUse * 100, 2);
@ -745,8 +645,6 @@ class Server{
/** /**
* Returns the TPS usage/load average in % * Returns the TPS usage/load average in %
*
* @return float
*/ */
public function getTickUsageAverage() : float{ public function getTickUsageAverage() : float{
return round((array_sum($this->useAverage) / count($this->useAverage)) * 100, 2); return round((array_sum($this->useAverage) / count($this->useAverage)) * 100, 2);
@ -778,8 +676,6 @@ class Server{
} }
/** /**
* @param string $name
*
* @return OfflinePlayer|Player * @return OfflinePlayer|Player
*/ */
public function getOfflinePlayer(string $name){ public function getOfflinePlayer(string $name){
@ -795,21 +691,12 @@ class Server{
/** /**
* Returns whether the server has stored any saved data for this player. * Returns whether the server has stored any saved data for this player.
*
* @param string $name
*
* @return bool
*/ */
public function hasOfflinePlayerData(string $name) : bool{ public function hasOfflinePlayerData(string $name) : bool{
$name = strtolower($name); $name = strtolower($name);
return file_exists($this->getDataPath() . "players/$name.dat"); return file_exists($this->getDataPath() . "players/$name.dat");
} }
/**
* @param string $name
*
* @return CompoundTag
*/
public function getOfflinePlayerData(string $name) : CompoundTag{ public function getOfflinePlayerData(string $name) : CompoundTag{
$name = strtolower($name); $name = strtolower($name);
$path = $this->getDataPath() . "players/"; $path = $this->getDataPath() . "players/";
@ -874,9 +761,6 @@ class Server{
} }
/** /**
* @param string $name
* @param CompoundTag $nbtTag
*
* @return void * @return void
*/ */
public function saveOfflinePlayerData(string $name, CompoundTag $nbtTag){ public function saveOfflinePlayerData(string $name, CompoundTag $nbtTag){
@ -902,8 +786,6 @@ class Server{
* *
* @see Server::getPlayerExact() * @see Server::getPlayerExact()
* *
* @param string $name
*
* @return Player|null * @return Player|null
*/ */
public function getPlayer(string $name){ public function getPlayer(string $name){
@ -929,8 +811,6 @@ class Server{
/** /**
* Returns an online player with the given name (case insensitive), or null if not found. * Returns an online player with the given name (case insensitive), or null if not found.
* *
* @param string $name
*
* @return Player|null * @return Player|null
*/ */
public function getPlayerExact(string $name){ public function getPlayerExact(string $name){
@ -948,8 +828,6 @@ class Server{
* Returns a list of online players whose names contain with the given string (case insensitive). * Returns a list of online players whose names contain with the given string (case insensitive).
* If an exact match is found, only that match is returned. * If an exact match is found, only that match is returned.
* *
* @param string $partialName
*
* @return Player[] * @return Player[]
*/ */
public function matchPlayer(string $partialName) : array{ public function matchPlayer(string $partialName) : array{
@ -969,10 +847,6 @@ class Server{
/** /**
* Returns the player online with the specified raw UUID, or null if not found * Returns the player online with the specified raw UUID, or null if not found
*
* @param string $rawUUID
*
* @return null|Player
*/ */
public function getPlayerByRawUUID(string $rawUUID) : ?Player{ public function getPlayerByRawUUID(string $rawUUID) : ?Player{
return $this->playerList[$rawUUID] ?? null; return $this->playerList[$rawUUID] ?? null;
@ -980,10 +854,6 @@ class Server{
/** /**
* Returns the player online with a UUID equivalent to the specified UUID object, or null if not found * Returns the player online with a UUID equivalent to the specified UUID object, or null if not found
*
* @param UUID $uuid
*
* @return null|Player
*/ */
public function getPlayerByUUID(UUID $uuid) : ?Player{ public function getPlayerByUUID(UUID $uuid) : ?Player{
return $this->getPlayerByRawUUID($uuid->toBinary()); return $this->getPlayerByRawUUID($uuid->toBinary());
@ -996,9 +866,6 @@ class Server{
return $this->levels; return $this->levels;
} }
/**
* @return Level|null
*/
public function getDefaultLevel() : ?Level{ public function getDefaultLevel() : ?Level{
return $this->levelDefault; return $this->levelDefault;
} }
@ -1007,8 +874,6 @@ class Server{
* Sets the default level to a different level * Sets the default level to a different level
* This won't change the level-name property, * This won't change the level-name property,
* it only affects the server on runtime * it only affects the server on runtime
*
* @param Level|null $level
*/ */
public function setDefaultLevel(?Level $level) : void{ public function setDefaultLevel(?Level $level) : void{
if($level === null or ($this->isLevelLoaded($level->getFolderName()) and $level !== $this->levelDefault)){ if($level === null or ($this->isLevelLoaded($level->getFolderName()) and $level !== $this->levelDefault)){
@ -1016,30 +881,16 @@ class Server{
} }
} }
/**
* @param string $name
*
* @return bool
*/
public function isLevelLoaded(string $name) : bool{ public function isLevelLoaded(string $name) : bool{
return $this->getLevelByName($name) instanceof Level; return $this->getLevelByName($name) instanceof Level;
} }
/**
* @param int $levelId
*
* @return Level|null
*/
public function getLevel(int $levelId) : ?Level{ public function getLevel(int $levelId) : ?Level{
return $this->levels[$levelId] ?? null; return $this->levels[$levelId] ?? null;
} }
/** /**
* NOTE: This matches levels based on the FOLDER name, NOT the display name. * NOTE: This matches levels based on the FOLDER name, NOT the display name.
*
* @param string $name
*
* @return Level|null
*/ */
public function getLevelByName(string $name) : ?Level{ public function getLevelByName(string $name) : ?Level{
foreach($this->getLevels() as $level){ foreach($this->getLevels() as $level){
@ -1052,11 +903,6 @@ class Server{
} }
/** /**
* @param Level $level
* @param bool $forceUnload
*
* @return bool
*
* @throws \InvalidStateException * @throws \InvalidStateException
*/ */
public function unloadLevel(Level $level, bool $forceUnload = false) : bool{ public function unloadLevel(Level $level, bool $forceUnload = false) : bool{
@ -1069,8 +915,6 @@ class Server{
/** /**
* @internal * @internal
*
* @param Level $level
*/ */
public function removeLevel(Level $level) : void{ public function removeLevel(Level $level) : void{
unset($this->levels[$level->getId()]); unset($this->levels[$level->getId()]);
@ -1079,10 +923,6 @@ class Server{
/** /**
* Loads a level from the data directory * Loads a level from the data directory
* *
* @param string $name
*
* @return bool
*
* @throws LevelException * @throws LevelException
*/ */
public function loadLevel(string $name) : bool{ public function loadLevel(string $name) : bool{
@ -1136,12 +976,7 @@ class Server{
/** /**
* Generates a new level if it does not exist * Generates a new level if it does not exist
* *
* @param string $name
* @param int|null $seed
* @param string|null $generator Class name that extends pocketmine\level\generator\Generator * @param string|null $generator Class name that extends pocketmine\level\generator\Generator
* @param array $options
*
* @return bool
*/ */
public function generateLevel(string $name, int $seed = null, $generator = null, array $options = []) : bool{ public function generateLevel(string $name, int $seed = null, $generator = null, array $options = []) : bool{
if(trim($name) === "" or $this->isLevelGenerated($name)){ if(trim($name) === "" or $this->isLevelGenerated($name)){
@ -1205,11 +1040,6 @@ class Server{
return true; return true;
} }
/**
* @param string $name
*
* @return bool
*/
public function isLevelGenerated(string $name) : bool{ public function isLevelGenerated(string $name) : bool{
if(trim($name) === ""){ if(trim($name) === ""){
return false; return false;
@ -1228,7 +1058,6 @@ class Server{
* Searches all levels for the entity with the specified ID. * Searches all levels for the entity with the specified ID.
* Useful for tracking entities across multiple worlds without needing strong references. * Useful for tracking entities across multiple worlds without needing strong references.
* *
* @param int $entityId
* @param Level|null $expectedLevel @deprecated Level to look in first for the target * @param Level|null $expectedLevel @deprecated Level to look in first for the target
* *
* @return Entity|null * @return Entity|null
@ -1245,7 +1074,6 @@ class Server{
} }
/** /**
* @param string $variable
* @param mixed $defaultValue * @param mixed $defaultValue
* *
* @return mixed * @return mixed
@ -1263,12 +1091,6 @@ class Server{
return $this->propertyCache[$variable] ?? $defaultValue; return $this->propertyCache[$variable] ?? $defaultValue;
} }
/**
* @param string $variable
* @param string $defaultValue
*
* @return string
*/
public function getConfigString(string $variable, string $defaultValue = "") : string{ public function getConfigString(string $variable, string $defaultValue = "") : string{
$v = getopt("", ["$variable::"]); $v = getopt("", ["$variable::"]);
if(isset($v[$variable])){ if(isset($v[$variable])){
@ -1279,21 +1101,12 @@ class Server{
} }
/** /**
* @param string $variable
* @param string $value
*
* @return void * @return void
*/ */
public function setConfigString(string $variable, string $value){ public function setConfigString(string $variable, string $value){
$this->properties->set($variable, $value); $this->properties->set($variable, $value);
} }
/**
* @param string $variable
* @param int $defaultValue
*
* @return int
*/
public function getConfigInt(string $variable, int $defaultValue = 0) : int{ public function getConfigInt(string $variable, int $defaultValue = 0) : int{
$v = getopt("", ["$variable::"]); $v = getopt("", ["$variable::"]);
if(isset($v[$variable])){ if(isset($v[$variable])){
@ -1304,21 +1117,12 @@ class Server{
} }
/** /**
* @param string $variable
* @param int $value
*
* @return void * @return void
*/ */
public function setConfigInt(string $variable, int $value){ public function setConfigInt(string $variable, int $value){
$this->properties->set($variable, $value); $this->properties->set($variable, $value);
} }
/**
* @param string $variable
* @param bool $defaultValue
*
* @return bool
*/
public function getConfigBool(string $variable, bool $defaultValue = false) : bool{ public function getConfigBool(string $variable, bool $defaultValue = false) : bool{
$v = getopt("", ["$variable::"]); $v = getopt("", ["$variable::"]);
if(isset($v[$variable])){ if(isset($v[$variable])){
@ -1342,9 +1146,6 @@ class Server{
} }
/** /**
* @param string $variable
* @param bool $value
*
* @return void * @return void
*/ */
public function setConfigBool(string $variable, bool $value){ public function setConfigBool(string $variable, bool $value){
@ -1352,8 +1153,6 @@ class Server{
} }
/** /**
* @param string $name
*
* @return PluginIdentifiableCommand|null * @return PluginIdentifiableCommand|null
*/ */
public function getPluginCommand(string $name){ public function getPluginCommand(string $name){
@ -1379,8 +1178,6 @@ class Server{
} }
/** /**
* @param string $name
*
* @return void * @return void
*/ */
public function addOp(string $name){ public function addOp(string $name){
@ -1393,8 +1190,6 @@ class Server{
} }
/** /**
* @param string $name
*
* @return void * @return void
*/ */
public function removeOp(string $name){ public function removeOp(string $name){
@ -1407,8 +1202,6 @@ class Server{
} }
/** /**
* @param string $name
*
* @return void * @return void
*/ */
public function addWhitelist(string $name){ public function addWhitelist(string $name){
@ -1417,8 +1210,6 @@ class Server{
} }
/** /**
* @param string $name
*
* @return void * @return void
*/ */
public function removeWhitelist(string $name){ public function removeWhitelist(string $name){
@ -1426,20 +1217,10 @@ class Server{
$this->whitelist->save(); $this->whitelist->save();
} }
/**
* @param string $name
*
* @return bool
*/
public function isWhitelisted(string $name) : bool{ public function isWhitelisted(string $name) : bool{
return !$this->hasWhitelist() or $this->operators->exists($name, true) or $this->whitelist->exists($name, true); return !$this->hasWhitelist() or $this->operators->exists($name, true) or $this->whitelist->exists($name, true);
} }
/**
* @param string $name
*
* @return bool
*/
public function isOp(string $name) : bool{ public function isOp(string $name) : bool{
return $this->operators->exists($name, true); return $this->operators->exists($name, true);
} }
@ -1487,9 +1268,6 @@ class Server{
return $result; return $result;
} }
/**
* @return Server
*/
public static function getInstance() : Server{ public static function getInstance() : Server{
if(self::$instance === null){ if(self::$instance === null){
throw new \RuntimeException("Attempt to retrieve Server instance outside server thread"); throw new \RuntimeException("Attempt to retrieve Server instance outside server thread");
@ -1498,8 +1276,6 @@ class Server{
} }
/** /**
* @param int $microseconds
*
* @return void * @return void
*/ */
public static function microSleep(int $microseconds){ public static function microSleep(int $microseconds){
@ -1508,12 +1284,6 @@ class Server{
}, $microseconds); }, $microseconds);
} }
/**
* @param \ClassLoader $autoloader
* @param \AttachableThreadedLogger $logger
* @param string $dataPath
* @param string $pluginPath
*/
public function __construct(\ClassLoader $autoloader, \AttachableThreadedLogger $logger, string $dataPath, string $pluginPath){ public function __construct(\ClassLoader $autoloader, \AttachableThreadedLogger $logger, string $dataPath, string $pluginPath){
if(self::$instance !== null){ if(self::$instance !== null){
throw new \InvalidStateException("Only one server instance can exist at once"); throw new \InvalidStateException("Only one server instance can exist at once");
@ -1817,8 +1587,6 @@ class Server{
/** /**
* @param TextContainer|string $message * @param TextContainer|string $message
* @param CommandSender[] $recipients * @param CommandSender[] $recipients
*
* @return int
*/ */
public function broadcastMessage($message, array $recipients = null) : int{ public function broadcastMessage($message, array $recipients = null) : int{
if(!is_array($recipients)){ if(!is_array($recipients)){
@ -1833,10 +1601,7 @@ class Server{
} }
/** /**
* @param string $tip
* @param Player[] $recipients * @param Player[] $recipients
*
* @return int
*/ */
public function broadcastTip(string $tip, array $recipients = null) : int{ public function broadcastTip(string $tip, array $recipients = null) : int{
if(!is_array($recipients)){ if(!is_array($recipients)){
@ -1857,10 +1622,7 @@ class Server{
} }
/** /**
* @param string $popup
* @param Player[] $recipients * @param Player[] $recipients
*
* @return int
*/ */
public function broadcastPopup(string $popup, array $recipients = null) : int{ public function broadcastPopup(string $popup, array $recipients = null) : int{
if(!is_array($recipients)){ if(!is_array($recipients)){
@ -1882,14 +1644,10 @@ class Server{
} }
/** /**
* @param string $title
* @param string $subtitle
* @param int $fadeIn Duration in ticks for fade-in. If -1 is given, client-sided defaults will be used. * @param int $fadeIn Duration in ticks for fade-in. If -1 is given, client-sided defaults will be used.
* @param int $stay Duration in ticks to stay on screen for * @param int $stay Duration in ticks to stay on screen for
* @param int $fadeOut Duration in ticks for fade-out. * @param int $fadeOut Duration in ticks for fade-out.
* @param Player[]|null $recipients * @param Player[]|null $recipients
*
* @return int
*/ */
public function broadcastTitle(string $title, string $subtitle = "", int $fadeIn = -1, int $stay = -1, int $fadeOut = -1, array $recipients = null) : int{ public function broadcastTitle(string $title, string $subtitle = "", int $fadeIn = -1, int $stay = -1, int $fadeOut = -1, array $recipients = null) : int{
if(!is_array($recipients)){ if(!is_array($recipients)){
@ -1912,9 +1670,6 @@ class Server{
/** /**
* @param TextContainer|string $message * @param TextContainer|string $message
* @param string $permissions
*
* @return int
*/ */
public function broadcast($message, string $permissions) : int{ public function broadcast($message, string $permissions) : int{
/** @var CommandSender[] $recipients */ /** @var CommandSender[] $recipients */
@ -1938,7 +1693,6 @@ class Server{
* Broadcasts a Minecraft packet to a list of players * Broadcasts a Minecraft packet to a list of players
* *
* @param Player[] $players * @param Player[] $players
* @param DataPacket $packet
* *
* @return void * @return void
*/ */
@ -1952,8 +1706,6 @@ class Server{
* *
* @param Player[] $players * @param Player[] $players
* @param DataPacket[] $packets * @param DataPacket[] $packets
* @param bool $forceSync
* @param bool $immediate
* *
* @return void * @return void
*/ */
@ -1991,9 +1743,7 @@ class Server{
} }
/** /**
* @param BatchPacket $pk
* @param Player[] $players * @param Player[] $players
* @param bool $immediate
* *
* @return void * @return void
*/ */
@ -2009,8 +1759,6 @@ class Server{
/** /**
* @param int $type
*
* @return void * @return void
*/ */
public function enablePlugins(int $type){ public function enablePlugins(int $type){
@ -2027,8 +1775,6 @@ class Server{
} }
/** /**
* @param Plugin $plugin
*
* @return void * @return void
*/ */
public function enablePlugin(Plugin $plugin){ public function enablePlugin(Plugin $plugin){
@ -2044,12 +1790,6 @@ class Server{
/** /**
* Executes a command from a CommandSender * Executes a command from a CommandSender
*
* @param CommandSender $sender
* @param string $commandLine
* @param bool $internal
*
* @return bool
*/ */
public function dispatchCommand(CommandSender $sender, string $commandLine, bool $internal = false) : bool{ public function dispatchCommand(CommandSender $sender, string $commandLine, bool $internal = false) : bool{
if(!$internal){ if(!$internal){
@ -2263,7 +2003,6 @@ class Server{
} }
/** /**
* @param \Throwable $e
* @param array|null $trace * @param array|null $trace
* *
* @return void * @return void
@ -2408,8 +2147,6 @@ class Server{
} }
/** /**
* @param Player $player
*
* @return void * @return void
*/ */
public function onPlayerLogin(Player $player){ public function onPlayerLogin(Player $player){
@ -2421,8 +2158,6 @@ class Server{
} }
/** /**
* @param Player $player
*
* @return void * @return void
*/ */
public function onPlayerLogout(Player $player){ public function onPlayerLogout(Player $player){
@ -2430,8 +2165,6 @@ class Server{
} }
/** /**
* @param Player $player
*
* @return void * @return void
*/ */
public function addPlayer(Player $player){ public function addPlayer(Player $player){
@ -2439,8 +2172,6 @@ class Server{
} }
/** /**
* @param Player $player
*
* @return void * @return void
*/ */
public function removePlayer(Player $player){ public function removePlayer(Player $player){
@ -2448,8 +2179,6 @@ class Server{
} }
/** /**
* @param Player $player
*
* @return void * @return void
*/ */
public function addOnlinePlayer(Player $player){ public function addOnlinePlayer(Player $player){
@ -2459,8 +2188,6 @@ class Server{
} }
/** /**
* @param Player $player
*
* @return void * @return void
*/ */
public function removeOnlinePlayer(Player $player){ public function removeOnlinePlayer(Player $player){
@ -2472,11 +2199,6 @@ class Server{
} }
/** /**
* @param UUID $uuid
* @param int $entityId
* @param string $name
* @param Skin $skin
* @param string $xboxUserId
* @param Player[]|null $players * @param Player[]|null $players
* *
* @return void * @return void
@ -2491,7 +2213,6 @@ class Server{
} }
/** /**
* @param UUID $uuid
* @param Player[]|null $players * @param Player[]|null $players
* *
* @return void * @return void
@ -2504,8 +2225,6 @@ class Server{
} }
/** /**
* @param Player $p
*
* @return void * @return void
*/ */
public function sendFullPlayerListData(Player $p){ public function sendFullPlayerListData(Player $p){
@ -2583,9 +2302,6 @@ class Server{
return $this->baseLang; return $this->baseLang;
} }
/**
* @return bool
*/
public function isLanguageForced() : bool{ public function isLanguageForced() : bool{
return $this->forceLanguage; return $this->forceLanguage;
} }
@ -2624,11 +2340,6 @@ class Server{
} }
/** /**
* @param AdvancedSourceInterface $interface
* @param string $address
* @param int $port
* @param string $payload
*
* @return void * @return void
* *
* TODO: move this to Network * TODO: move this to Network

View File

@ -44,8 +44,6 @@ abstract class Thread extends \Thread{
} }
/** /**
* @param \ClassLoader|null $loader
*
* @return void * @return void
*/ */
public function setClassLoader(\ClassLoader $loader = null){ public function setClassLoader(\ClassLoader $loader = null){

View File

@ -44,8 +44,6 @@ abstract class Worker extends \Worker{
} }
/** /**
* @param \ClassLoader|null $loader
*
* @return void * @return void
*/ */
public function setClassLoader(\ClassLoader $loader = null){ public function setClassLoader(\ClassLoader $loader = null){

View File

@ -114,10 +114,6 @@ abstract class BaseRail extends Flowable{
/** /**
* Returns a meta value for the rail with the given connections. * Returns a meta value for the rail with the given connections.
* *
* @param array $connections
*
* @return int
*
* @throws \InvalidArgumentException if no state matches the given connections * @throws \InvalidArgumentException if no state matches the given connections
*/ */
protected function getMetaForState(array $connections) : int{ protected function getMetaForState(array $connections) : int{

View File

@ -69,16 +69,11 @@ class Bed extends Transparent{
return ($this->meta & self::BITFLAG_HEAD) !== 0; return ($this->meta & self::BITFLAG_HEAD) !== 0;
} }
/**
* @return bool
*/
public function isOccupied() : bool{ public function isOccupied() : bool{
return ($this->meta & self::BITFLAG_OCCUPIED) !== 0; return ($this->meta & self::BITFLAG_OCCUPIED) !== 0;
} }
/** /**
* @param bool $occupied
*
* @return void * @return void
*/ */
public function setOccupied(bool $occupied = true){ public function setOccupied(bool $occupied = true){
@ -95,12 +90,6 @@ class Bed extends Transparent{
} }
} }
/**
* @param int $meta
* @param bool $isHead
*
* @return int
*/
public static function getOtherHalfSide(int $meta, bool $isHead = false) : int{ public static function getOtherHalfSide(int $meta, bool $isHead = false) : int{
$rotation = $meta & 0x03; $rotation = $meta & 0x03;
$side = -1; $side = -1;
@ -127,9 +116,6 @@ class Bed extends Transparent{
return $side; return $side;
} }
/**
* @return Bed|null
*/
public function getOtherHalf() : ?Bed{ public function getOtherHalf() : ?Bed{
$other = $this->getSide(self::getOtherHalfSide($this->meta, $this->isHeadPart())); $other = $this->getSide(self::getOtherHalfSide($this->meta, $this->isHeadPart()));
if($other instanceof Bed and $other->getId() === $this->getId() and $other->isHeadPart() !== $this->isHeadPart() and (($other->getDamage() & 0x03) === ($this->getDamage() & 0x03))){ if($other instanceof Bed and $other->getId() === $this->getId() and $other->isHeadPart() !== $this->isHeadPart() and (($other->getDamage() & 0x03) === ($this->getDamage() & 0x03))){

View File

@ -50,12 +50,6 @@ class Block extends Position implements BlockIds, Metadatable{
* Returns a new Block instance with the specified ID, meta and position. * Returns a new Block instance with the specified ID, meta and position.
* *
* This function redirects to {@link BlockFactory#get}. * This function redirects to {@link BlockFactory#get}.
*
* @param int $id
* @param int $meta
* @param Position|null $pos
*
* @return Block
*/ */
public static function get(int $id, int $meta = 0, Position $pos = null) : Block{ public static function get(int $id, int $meta = 0, Position $pos = null) : Block{
return BlockFactory::get($id, $meta, $pos); return BlockFactory::get($id, $meta, $pos);
@ -90,16 +84,10 @@ class Block extends Position implements BlockIds, Metadatable{
$this->itemId = $itemId; $this->itemId = $itemId;
} }
/**
* @return string
*/
public function getName() : string{ public function getName() : string{
return $this->fallbackName ?? "Unknown"; return $this->fallbackName ?? "Unknown";
} }
/**
* @return int
*/
final public function getId() : int{ final public function getId() : int{
return $this->id; return $this->id;
} }
@ -107,8 +95,6 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Returns the ID of the item form of the block. * Returns the ID of the item form of the block.
* Used for drops for blocks (some blocks such as doors have a different item ID). * Used for drops for blocks (some blocks such as doors have a different item ID).
*
* @return int
*/ */
public function getItemId() : int{ public function getItemId() : int{
return $this->itemId ?? $this->getId(); return $this->itemId ?? $this->getId();
@ -116,22 +102,15 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* @internal * @internal
* @return int
*/ */
public function getRuntimeId() : int{ public function getRuntimeId() : int{
return RuntimeBlockMapping::toStaticRuntimeId($this->getId(), $this->getDamage()); return RuntimeBlockMapping::toStaticRuntimeId($this->getId(), $this->getDamage());
} }
/**
* @return int
*/
final public function getDamage() : int{ final public function getDamage() : int{
return $this->meta; return $this->meta;
} }
/**
* @param int $meta
*/
final public function setDamage(int $meta) : void{ final public function setDamage(int $meta) : void{
if($meta < 0 or $meta > 0xf){ if($meta < 0 or $meta > 0xf){
throw new \InvalidArgumentException("Block damage values must be 0-15, not $meta"); throw new \InvalidArgumentException("Block damage values must be 0-15, not $meta");
@ -145,8 +124,6 @@ class Block extends Position implements BlockIds, Metadatable{
* *
* If your block should not have any meta value when it's dropped as an item, override this to return 0 in * If your block should not have any meta value when it's dropped as an item, override this to return 0 in
* descendent classes. * descendent classes.
*
* @return int
*/ */
public function getVariantBitmask() : int{ public function getVariantBitmask() : int{
return -1; return -1;
@ -154,24 +131,18 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Returns the block meta, stripped of non-variant flags. * Returns the block meta, stripped of non-variant flags.
* @return int
*/ */
public function getVariant() : int{ public function getVariant() : int{
return $this->meta & $this->getVariantBitmask(); return $this->meta & $this->getVariantBitmask();
} }
/** /**
* AKA: Block->isPlaceable * AKA: Block->isPlaceable
* @return bool
*/ */
public function canBePlaced() : bool{ public function canBePlaced() : bool{
return true; return true;
} }
/**
* @return bool
*/
public function canBeReplaced() : bool{ public function canBeReplaced() : bool{
return false; return false;
} }
@ -182,15 +153,6 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Places the Block, using block space and block target, and side. Returns if the block has been placed. * Places the Block, using block space and block target, and side. Returns if the block has been placed.
*
* @param Item $item
* @param Block $blockReplace
* @param Block $blockClicked
* @param int $face
* @param Vector3 $clickVector
* @param Player|null $player
*
* @return bool
*/ */
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{ public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, Player $player = null) : bool{
return $this->getLevel()->setBlock($this, $this, true, true); return $this->getLevel()->setBlock($this, $this, true, true);
@ -198,18 +160,11 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Returns if the block can be broken with an specific Item * Returns if the block can be broken with an specific Item
*
* @param Item $item
*
* @return bool
*/ */
public function isBreakable(Item $item) : bool{ public function isBreakable(Item $item) : bool{
return true; return true;
} }
/**
* @return int
*/
public function getToolType() : int{ public function getToolType() : int{
return BlockToolType::TYPE_NONE; return BlockToolType::TYPE_NONE;
} }
@ -223,8 +178,6 @@ class Block extends Position implements BlockIds, Metadatable{
* Otherwise, 1 should be returned if a tool is required, 0 if not. * Otherwise, 1 should be returned if a tool is required, 0 if not.
* *
* @see Item::getBlockToolHarvestLevel() * @see Item::getBlockToolHarvestLevel()
*
* @return int
*/ */
public function getToolHarvestLevel() : int{ public function getToolHarvestLevel() : int{
return 0; return 0;
@ -236,10 +189,6 @@ class Block extends Position implements BlockIds, Metadatable{
* *
* In most cases this is also used to determine whether block drops should be created or not, except in some * In most cases this is also used to determine whether block drops should be created or not, except in some
* special cases such as vines. * special cases such as vines.
*
* @param Item $tool
*
* @return bool
*/ */
public function isCompatibleWithTool(Item $tool) : bool{ public function isCompatibleWithTool(Item $tool) : bool{
if($this->getHardness() < 0){ if($this->getHardness() < 0){
@ -254,23 +203,14 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Do the actions needed so the block is broken with the Item * Do the actions needed so the block is broken with the Item
*
* @param Item $item
* @param Player|null $player
*
* @return bool
*/ */
public function onBreak(Item $item, Player $player = null) : bool{ public function onBreak(Item $item, Player $player = null) : bool{
return $this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR), true, true); return $this->getLevel()->setBlock($this, BlockFactory::get(Block::AIR), true, true);
} }
/** /**
* Returns the seconds that this block takes to be broken using an specific Item * Returns the seconds that this block takes to be broken using an specific Item
* *
* @param Item $item
*
* @return float
* @throws \InvalidArgumentException if the item efficiency is not a positive number * @throws \InvalidArgumentException if the item efficiency is not a positive number
*/ */
public function getBreakTime(Item $item) : float{ public function getBreakTime(Item $item) : float{
@ -300,8 +240,6 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Returns whether random block updates will be done on this block. * Returns whether random block updates will be done on this block.
*
* @return bool
*/ */
public function ticksRandomly() : bool{ public function ticksRandomly() : bool{
return false; return false;
@ -324,11 +262,6 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Do actions when activated by Item. Returns if it has done anything * Do actions when activated by Item. Returns if it has done anything
*
* @param Item $item
* @param Player|null $player
*
* @return bool
*/ */
public function onActivate(Item $item, Player $player = null) : bool{ public function onActivate(Item $item, Player $player = null) : bool{
return false; return false;
@ -336,7 +269,6 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Returns a base value used to compute block break times. * Returns a base value used to compute block break times.
* @return float
*/ */
public function getHardness() : float{ public function getHardness() : float{
return 10; return 10;
@ -344,15 +276,11 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Returns the block's resistance to explosions. Usually 5x hardness. * Returns the block's resistance to explosions. Usually 5x hardness.
* @return float
*/ */
public function getBlastResistance() : float{ public function getBlastResistance() : float{
return $this->getHardness() * 5; return $this->getHardness() * 5;
} }
/**
* @return float
*/
public function getFrictionFactor() : float{ public function getFrictionFactor() : float{
return 0.6; return 0.6;
} }
@ -380,16 +308,11 @@ class Block extends Position implements BlockIds, Metadatable{
* Examples of this behaviour include leaves and cobwebs. * Examples of this behaviour include leaves and cobwebs.
* *
* Light-diffusing blocks are included by the heightmap. * Light-diffusing blocks are included by the heightmap.
*
* @return bool
*/ */
public function diffusesSkyLight() : bool{ public function diffusesSkyLight() : bool{
return false; return false;
} }
/**
* @return bool
*/
public function isTransparent() : bool{ public function isTransparent() : bool{
return false; return false;
} }
@ -400,7 +323,6 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* AKA: Block->isFlowable * AKA: Block->isFlowable
* @return bool
*/ */
public function canBeFlowedInto() : bool{ public function canBeFlowedInto() : bool{
return false; return false;
@ -416,21 +338,17 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Returns whether entities can climb up this block. * Returns whether entities can climb up this block.
* @return bool
*/ */
public function canClimb() : bool{ public function canClimb() : bool{
return false; return false;
} }
public function addVelocityToEntity(Entity $entity, Vector3 $vector) : void{ public function addVelocityToEntity(Entity $entity, Vector3 $vector) : void{
} }
/** /**
* Sets the block position to a new Position object * Sets the block position to a new Position object
*
* @param Position $v
*/ */
final public function position(Position $v) : void{ final public function position(Position $v) : void{
$this->x = (int) $v->x; $this->x = (int) $v->x;
@ -443,8 +361,6 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Returns an array of Item objects to be dropped * Returns an array of Item objects to be dropped
* *
* @param Item $item
*
* @return Item[] * @return Item[]
*/ */
public function getDrops(Item $item) : array{ public function getDrops(Item $item) : array{
@ -462,8 +378,6 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Returns an array of Items to be dropped when the block is broken using the correct tool type. * Returns an array of Items to be dropped when the block is broken using the correct tool type.
* *
* @param Item $item
*
* @return Item[] * @return Item[]
*/ */
public function getDropsForCompatibleTool(Item $item) : array{ public function getDropsForCompatibleTool(Item $item) : array{
@ -475,8 +389,6 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Returns an array of Items to be dropped when the block is broken using a compatible Silk Touch-enchanted tool. * Returns an array of Items to be dropped when the block is broken using a compatible Silk Touch-enchanted tool.
* *
* @param Item $item
*
* @return Item[] * @return Item[]
*/ */
public function getSilkTouchDrops(Item $item) : array{ public function getSilkTouchDrops(Item $item) : array{
@ -487,10 +399,6 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Returns how much XP will be dropped by breaking this block with the given item. * Returns how much XP will be dropped by breaking this block with the given item.
*
* @param Item $item
*
* @return int
*/ */
public function getXpDropForTool(Item $item) : int{ public function getXpDropForTool(Item $item) : int{
if($item->hasEnchantment(Enchantment::SILK_TOUCH) or !$this->isCompatibleWithTool($item)){ if($item->hasEnchantment(Enchantment::SILK_TOUCH) or !$this->isCompatibleWithTool($item)){
@ -502,8 +410,6 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Returns how much XP this block will drop when broken with an appropriate tool. * Returns how much XP this block will drop when broken with an appropriate tool.
*
* @return int
*/ */
protected function getXpDropAmount() : int{ protected function getXpDropAmount() : int{
return 0; return 0;
@ -512,8 +418,6 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Returns whether Silk Touch enchanted tools will cause this block to drop as itself. Since most blocks drop * Returns whether Silk Touch enchanted tools will cause this block to drop as itself. Since most blocks drop
* themselves anyway, this is implicitly true. * themselves anyway, this is implicitly true.
*
* @return bool
*/ */
public function isAffectedBySilkTouch() : bool{ public function isAffectedBySilkTouch() : bool{
return true; return true;
@ -521,7 +425,6 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Returns the item that players will equip when middle-clicking on this block. * Returns the item that players will equip when middle-clicking on this block.
* @return Item
*/ */
public function getPickedItem() : Item{ public function getPickedItem() : Item{
return ItemFactory::get($this->getItemId(), $this->getVariant()); return ItemFactory::get($this->getItemId(), $this->getVariant());
@ -529,7 +432,6 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Returns the time in ticks which the block will fuel a furnace for. * Returns the time in ticks which the block will fuel a furnace for.
* @return int
*/ */
public function getFuelTime() : int{ public function getFuelTime() : int{
return 0; return 0;
@ -538,8 +440,6 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Returns the chance that the block will catch fire from nearby fire sources. Higher values lead to faster catching * Returns the chance that the block will catch fire from nearby fire sources. Higher values lead to faster catching
* fire. * fire.
*
* @return int
*/ */
public function getFlameEncouragement() : int{ public function getFlameEncouragement() : int{
return 0; return 0;
@ -547,8 +447,6 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Returns the base flammability of this block. Higher values lead to the block burning away more quickly. * Returns the base flammability of this block. Higher values lead to the block burning away more quickly.
*
* @return int
*/ */
public function getFlammability() : int{ public function getFlammability() : int{
return 0; return 0;
@ -556,8 +454,6 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Returns whether fire lit on this block will burn indefinitely. * Returns whether fire lit on this block will burn indefinitely.
*
* @return bool
*/ */
public function burnsForever() : bool{ public function burnsForever() : bool{
return false; return false;
@ -565,8 +461,6 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Returns whether this block can catch fire. * Returns whether this block can catch fire.
*
* @return bool
*/ */
public function isFlammable() : bool{ public function isFlammable() : bool{
return $this->getFlammability() > 0; return $this->getFlammability() > 0;
@ -582,9 +476,6 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Returns the Block on the side $side, works like Vector3::getSide() * Returns the Block on the side $side, works like Vector3::getSide()
* *
* @param int $side
* @param int $step
*
* @return Block * @return Block
*/ */
public function getSide(int $side, int $step = 1){ public function getSide(int $side, int $step = 1){
@ -643,10 +534,6 @@ class Block extends Position implements BlockIds, Metadatable{
/** /**
* Checks for collision against an AxisAlignedBB * Checks for collision against an AxisAlignedBB
*
* @param AxisAlignedBB $bb
*
* @return bool
*/ */
public function collidesWithBB(AxisAlignedBB $bb) : bool{ public function collidesWithBB(AxisAlignedBB $bb) : bool{
foreach($this->getCollisionBoxes() as $bb2){ foreach($this->getCollisionBoxes() as $bb2){
@ -658,9 +545,6 @@ class Block extends Position implements BlockIds, Metadatable{
return false; return false;
} }
/**
* @param Entity $entity
*/
public function onEntityCollide(Entity $entity) : void{ public function onEntityCollide(Entity $entity) : void{
} }
@ -687,9 +571,6 @@ class Block extends Position implements BlockIds, Metadatable{
return []; return [];
} }
/**
* @return AxisAlignedBB|null
*/
public function getBoundingBox() : ?AxisAlignedBB{ public function getBoundingBox() : ?AxisAlignedBB{
if($this->boundingBox === null){ if($this->boundingBox === null){
$this->boundingBox = $this->recalculateBoundingBox(); $this->boundingBox = $this->recalculateBoundingBox();
@ -697,9 +578,6 @@ class Block extends Position implements BlockIds, Metadatable{
return $this->boundingBox; return $this->boundingBox;
} }
/**
* @return AxisAlignedBB|null
*/
protected function recalculateBoundingBox() : ?AxisAlignedBB{ protected function recalculateBoundingBox() : ?AxisAlignedBB{
return new AxisAlignedBB( return new AxisAlignedBB(
$this->x, $this->x,
@ -720,12 +598,6 @@ class Block extends Position implements BlockIds, Metadatable{
$this->collisionBoxes = null; $this->collisionBoxes = null;
} }
/**
* @param Vector3 $pos1
* @param Vector3 $pos2
*
* @return RayTraceResult|null
*/
public function calculateIntercept(Vector3 $pos1, Vector3 $pos2) : ?RayTraceResult{ public function calculateIntercept(Vector3 $pos1, Vector3 $pos2) : ?RayTraceResult{
$bbs = $this->getCollisionBoxes(); $bbs = $this->getCollisionBoxes();
if(count($bbs) === 0){ if(count($bbs) === 0){

View File

@ -334,7 +334,6 @@ class BlockFactory{
* NOTE: If you are registering a new block type, you will need to add it to the creative inventory yourself - it * NOTE: If you are registering a new block type, you will need to add it to the creative inventory yourself - it
* will not automatically appear there. * will not automatically appear there.
* *
* @param Block $block
* @param bool $override Whether to override existing registrations * @param bool $override Whether to override existing registrations
* *
* @throws \RuntimeException if something attempted to override an already-registered block without specifying the * @throws \RuntimeException if something attempted to override an already-registered block without specifying the
@ -365,11 +364,7 @@ class BlockFactory{
/** /**
* Returns a new Block instance with the specified ID, meta and position. * Returns a new Block instance with the specified ID, meta and position.
* *
* @param int $id
* @param int $meta
* @param Position $pos * @param Position $pos
*
* @return Block
*/ */
public static function get(int $id, int $meta = 0, Position $pos = null) : Block{ public static function get(int $id, int $meta = 0, Position $pos = null) : Block{
if($meta < 0 or $meta > 0xf){ if($meta < 0 or $meta > 0xf){
@ -398,7 +393,6 @@ class BlockFactory{
/** /**
* @internal * @internal
* @return \SplFixedArray
*/ */
public static function getBlockStatesArray() : \SplFixedArray{ public static function getBlockStatesArray() : \SplFixedArray{
return self::$fullList; return self::$fullList;
@ -406,10 +400,6 @@ class BlockFactory{
/** /**
* Returns whether a specified block ID is already registered in the block factory. * Returns whether a specified block ID is already registered in the block factory.
*
* @param int $id
*
* @return bool
*/ */
public static function isRegistered(int $id) : bool{ public static function isRegistered(int $id) : bool{
$b = self::$fullList[$id << 4]; $b = self::$fullList[$id << 4];
@ -419,11 +409,6 @@ class BlockFactory{
/** /**
* @internal * @internal
* @deprecated * @deprecated
*
* @param int $id
* @param int $meta
*
* @return int
*/ */
public static function toStaticRuntimeId(int $id, int $meta = 0) : int{ public static function toStaticRuntimeId(int $id, int $meta = 0) : int{
return RuntimeBlockMapping::toStaticRuntimeId($id, $meta); return RuntimeBlockMapping::toStaticRuntimeId($id, $meta);
@ -433,8 +418,6 @@ class BlockFactory{
* @deprecated * @deprecated
* @internal * @internal
* *
* @param int $runtimeId
*
* @return int[] [id, meta] * @return int[] [id, meta]
*/ */
public static function fromStaticRuntimeId(int $runtimeId) : array{ public static function fromStaticRuntimeId(int $runtimeId) : array{

View File

@ -112,8 +112,6 @@ class CobblestoneWall extends Transparent{
} }
/** /**
* @param Block $block
*
* @return bool * @return bool
*/ */
public function canConnect(Block $block){ public function canConnect(Block $block){

View File

@ -53,16 +53,10 @@ class ConcretePowder extends Fallable{
} }
} }
/**
* @return null|Block
*/
public function tickFalling() : ?Block{ public function tickFalling() : ?Block{
return $this->checkAdjacentWater(); return $this->checkAdjacentWater();
} }
/**
* @return null|Block
*/
private function checkAdjacentWater() : ?Block{ private function checkAdjacentWater() : ?Block{
for($i = 1; $i < 6; ++$i){ //Do not check underneath for($i = 1; $i < 6; ++$i){ //Do not check underneath
if($this->getSide($i) instanceof Water){ if($this->getSide($i) instanceof Water){

View File

@ -68,7 +68,6 @@ class DoublePlant extends Flowable{
/** /**
* Returns whether this double-plant has a corresponding other half. * Returns whether this double-plant has a corresponding other half.
* @return bool
*/ */
public function isValidHalfPlant() : bool{ public function isValidHalfPlant() : bool{
if($this->meta & self::BITFLAG_TOP){ if($this->meta & self::BITFLAG_TOP){

View File

@ -45,9 +45,6 @@ abstract class Fallable extends Solid{
} }
} }
/**
* @return null|Block
*/
public function tickFalling() : ?Block{ public function tickFalling() : ?Block{
return null; return null;
} }

View File

@ -104,8 +104,6 @@ abstract class Fence extends Transparent{
} }
/** /**
* @param Block $block
*
* @return bool * @return bool
*/ */
public function canConnect(Block $block){ public function canConnect(Block $block){

View File

@ -211,8 +211,6 @@ abstract class Liquid extends Transparent{
/** /**
* Returns how many liquid levels are lost per block flowed horizontally. Affects how far the liquid can flow. * Returns how many liquid levels are lost per block flowed horizontally. Affects how far the liquid can flow.
*
* @return int
*/ */
public function getFlowDecayPerBlock() : int{ public function getFlowDecayPerBlock() : int{
return 1; return 1;

View File

@ -75,8 +75,6 @@ class TNT extends Solid{
} }
/** /**
* @param int $fuse
*
* @return void * @return void
*/ */
public function ignite(int $fuse = 80){ public function ignite(int $fuse = 80){

View File

@ -74,8 +74,6 @@ abstract class Command{
public $timings; public $timings;
/** /**
* @param string $name
* @param string $description
* @param string $usageMessage * @param string $usageMessage
* @param string[] $aliases * @param string[] $aliases
*/ */
@ -88,8 +86,6 @@ abstract class Command{
} }
/** /**
* @param CommandSender $sender
* @param string $commandLabel
* @param string[] $args * @param string[] $args
* *
* @return mixed * @return mixed
@ -97,9 +93,6 @@ abstract class Command{
*/ */
abstract public function execute(CommandSender $sender, string $commandLabel, array $args); abstract public function execute(CommandSender $sender, string $commandLabel, array $args);
/**
* @return string
*/
public function getName() : string{ public function getName() : string{
return $this->name; return $this->name;
} }
@ -113,19 +106,12 @@ abstract class Command{
/** /**
* @param string|null $permission
*
* @return void * @return void
*/ */
public function setPermission(string $permission = null){ public function setPermission(string $permission = null){
$this->permission = $permission; $this->permission = $permission;
} }
/**
* @param CommandSender $target
*
* @return bool
*/
public function testPermission(CommandSender $target) : bool{ public function testPermission(CommandSender $target) : bool{
if($this->testPermissionSilent($target)){ if($this->testPermissionSilent($target)){
return true; return true;
@ -140,11 +126,6 @@ abstract class Command{
return false; return false;
} }
/**
* @param CommandSender $target
*
* @return bool
*/
public function testPermissionSilent(CommandSender $target) : bool{ public function testPermissionSilent(CommandSender $target) : bool{
if($this->permission === null or $this->permission === ""){ if($this->permission === null or $this->permission === ""){
return true; return true;
@ -159,9 +140,6 @@ abstract class Command{
return false; return false;
} }
/**
* @return string
*/
public function getLabel() : string{ public function getLabel() : string{
return $this->label; return $this->label;
} }
@ -183,10 +161,6 @@ abstract class Command{
/** /**
* Registers the command into a Command map * Registers the command into a Command map
*
* @param CommandMap $commandMap
*
* @return bool
*/ */
public function register(CommandMap $commandMap) : bool{ public function register(CommandMap $commandMap) : bool{
if($this->allowChangesFrom($commandMap)){ if($this->allowChangesFrom($commandMap)){
@ -198,11 +172,6 @@ abstract class Command{
return false; return false;
} }
/**
* @param CommandMap $commandMap
*
* @return bool
*/
public function unregister(CommandMap $commandMap) : bool{ public function unregister(CommandMap $commandMap) : bool{
if($this->allowChangesFrom($commandMap)){ if($this->allowChangesFrom($commandMap)){
$this->commandMap = null; $this->commandMap = null;
@ -215,18 +184,10 @@ abstract class Command{
return false; return false;
} }
/**
* @param CommandMap $commandMap
*
* @return bool
*/
private function allowChangesFrom(CommandMap $commandMap) : bool{ private function allowChangesFrom(CommandMap $commandMap) : bool{
return $this->commandMap === null or $this->commandMap === $commandMap; return $this->commandMap === null or $this->commandMap === $commandMap;
} }
/**
* @return bool
*/
public function isRegistered() : bool{ public function isRegistered() : bool{
return $this->commandMap !== null; return $this->commandMap !== null;
} }
@ -238,23 +199,14 @@ abstract class Command{
return $this->activeAliases; return $this->activeAliases;
} }
/**
* @return string|null
*/
public function getPermissionMessage() : ?string{ public function getPermissionMessage() : ?string{
return $this->permissionMessage; return $this->permissionMessage;
} }
/**
* @return string
*/
public function getDescription() : string{ public function getDescription() : string{
return $this->description; return $this->description;
} }
/**
* @return string
*/
public function getUsage() : string{ public function getUsage() : string{
return $this->usageMessage; return $this->usageMessage;
} }
@ -272,8 +224,6 @@ abstract class Command{
} }
/** /**
* @param string $description
*
* @return void * @return void
*/ */
public function setDescription(string $description){ public function setDescription(string $description){
@ -281,8 +231,6 @@ abstract class Command{
} }
/** /**
* @param string $permissionMessage
*
* @return void * @return void
*/ */
public function setPermissionMessage(string $permissionMessage){ public function setPermissionMessage(string $permissionMessage){
@ -290,8 +238,6 @@ abstract class Command{
} }
/** /**
* @param string $usage
*
* @return void * @return void
*/ */
public function setUsage(string $usage){ public function setUsage(string $usage){
@ -299,9 +245,7 @@ abstract class Command{
} }
/** /**
* @param CommandSender $source
* @param TextContainer|string $message * @param TextContainer|string $message
* @param bool $sendToSource
* *
* @return void * @return void
*/ */
@ -338,9 +282,6 @@ abstract class Command{
} }
} }
/**
* @return string
*/
public function __toString() : string{ public function __toString() : string{
return $this->name; return $this->name;
} }

View File

@ -27,12 +27,7 @@ namespace pocketmine\command;
interface CommandExecutor{ interface CommandExecutor{
/** /**
* @param CommandSender $sender
* @param Command $command
* @param string $label
* @param string[] $args * @param string[] $args
*
* @return bool
*/ */
public function onCommand(CommandSender $sender, Command $command, string $label, array $args) : bool; public function onCommand(CommandSender $sender, Command $command, string $label, array $args) : bool;

View File

@ -27,28 +27,14 @@ namespace pocketmine\command;
interface CommandMap{ interface CommandMap{
/** /**
* @param string $fallbackPrefix
* @param Command[] $commands * @param Command[] $commands
* *
* @return void * @return void
*/ */
public function registerAll(string $fallbackPrefix, array $commands); public function registerAll(string $fallbackPrefix, array $commands);
/**
* @param string $fallbackPrefix
* @param Command $command
* @param string|null $label
*
* @return bool
*/
public function register(string $fallbackPrefix, Command $command, string $label = null) : bool; public function register(string $fallbackPrefix, Command $command, string $label = null) : bool;
/**
* @param CommandSender $sender
* @param string $cmdLine
*
* @return bool
*/
public function dispatch(CommandSender $sender, string $cmdLine) : bool; public function dispatch(CommandSender $sender, string $cmdLine) : bool;
/** /**
@ -57,8 +43,6 @@ interface CommandMap{
public function clearCommands(); public function clearCommands();
/** /**
* @param string $name
*
* @return Command|null * @return Command|null
*/ */
public function getCommand(string $name); public function getCommand(string $name);

View File

@ -116,8 +116,6 @@ class CommandReader extends Thread{
* Checks if the specified stream is a FIFO pipe. * Checks if the specified stream is a FIFO pipe.
* *
* @param resource $stream * @param resource $stream
*
* @return bool
*/ */
private function isPipe($stream) : bool{ private function isPipe($stream) : bool{
return is_resource($stream) and (!stream_isatty($stream) or ((fstat($stream)["mode"] & 0170000) === 0010000)); return is_resource($stream) and (!stream_isatty($stream) or ((fstat($stream)["mode"] & 0170000) === 0010000));

View File

@ -41,24 +41,17 @@ interface CommandSender extends Permissible{
*/ */
public function getServer(); public function getServer();
/**
* @return string
*/
public function getName() : string; public function getName() : string;
/** /**
* Returns the line height of the command-sender's screen. Used for determining sizes for command output pagination * Returns the line height of the command-sender's screen. Used for determining sizes for command output pagination
* such as in the /help command. * such as in the /help command.
*
* @return int
*/ */
public function getScreenLineHeight() : int; public function getScreenLineHeight() : int;
/** /**
* Sets the line height used for command output pagination for this command sender. `null` will reset it to default. * Sets the line height used for command output pagination for this command sender. `null` will reset it to default.
* *
* @param int|null $height
*
* @return void * @return void
*/ */
public function setScreenLineHeight(int $height = null); public function setScreenLineHeight(int $height = null);

View File

@ -49,8 +49,6 @@ class ConsoleCommandSender implements CommandSender{
/** /**
* @param Permission|string $name * @param Permission|string $name
*
* @return bool
*/ */
public function isPermissionSet($name) : bool{ public function isPermissionSet($name) : bool{
return $this->perm->isPermissionSet($name); return $this->perm->isPermissionSet($name);
@ -58,27 +56,20 @@ class ConsoleCommandSender implements CommandSender{
/** /**
* @param Permission|string $name * @param Permission|string $name
*
* @return bool
*/ */
public function hasPermission($name) : bool{ public function hasPermission($name) : bool{
return $this->perm->hasPermission($name); return $this->perm->hasPermission($name);
} }
/** /**
* @param Plugin $plugin
* @param string $name * @param string $name
* @param bool $value * @param bool $value
*
* @return PermissionAttachment
*/ */
public function addAttachment(Plugin $plugin, string $name = null, bool $value = null) : PermissionAttachment{ public function addAttachment(Plugin $plugin, string $name = null, bool $value = null) : PermissionAttachment{
return $this->perm->addAttachment($plugin, $name, $value); return $this->perm->addAttachment($plugin, $name, $value);
} }
/** /**
* @param PermissionAttachment $attachment
*
* @return void * @return void
*/ */
public function removeAttachment(PermissionAttachment $attachment){ public function removeAttachment(PermissionAttachment $attachment){
@ -120,23 +111,15 @@ class ConsoleCommandSender implements CommandSender{
} }
} }
/**
* @return string
*/
public function getName() : string{ public function getName() : string{
return "CONSOLE"; return "CONSOLE";
} }
/**
* @return bool
*/
public function isOp() : bool{ public function isOp() : bool{
return true; return true;
} }
/** /**
* @param bool $value
*
* @return void * @return void
*/ */
public function setOp(bool $value){ public function setOp(bool $value){

View File

@ -36,7 +36,6 @@ class FormattedCommandAlias extends Command{
private $formatStrings = []; private $formatStrings = [];
/** /**
* @param string $alias
* @param string[] $formatStrings * @param string[] $formatStrings
*/ */
public function __construct(string $alias, array $formatStrings){ public function __construct(string $alias, array $formatStrings){
@ -65,12 +64,6 @@ class FormattedCommandAlias extends Command{
return (bool) $result; return (bool) $result;
} }
/**
* @param string $formatString
* @param array $args
*
* @return string
*/
private function buildCommand(string $formatString, array $args) : string{ private function buildCommand(string $formatString, array $args) : string{
$index = strpos($formatString, '$'); $index = strpos($formatString, '$');
while($index !== false){ while($index !== false){
@ -144,13 +137,6 @@ class FormattedCommandAlias extends Command{
return $formatString; return $formatString;
} }
/**
* @param int $i
* @param int $j
* @param int $k
*
* @return bool
*/
private static function inRange(int $i, int $j, int $k) : bool{ private static function inRange(int $i, int $j, int $k) : bool{
return $i >= $j and $i <= $k; return $i >= $j and $i <= $k;
} }

View File

@ -34,10 +34,6 @@ class PluginCommand extends Command implements PluginIdentifiableCommand{
/** @var CommandExecutor */ /** @var CommandExecutor */
private $executor; private $executor;
/**
* @param string $name
* @param Plugin $owner
*/
public function __construct(string $name, Plugin $owner){ public function __construct(string $name, Plugin $owner){
parent::__construct($name); parent::__construct($name);
$this->owningPlugin = $owner; $this->owningPlugin = $owner;
@ -69,17 +65,12 @@ class PluginCommand extends Command implements PluginIdentifiableCommand{
} }
/** /**
* @param CommandExecutor $executor
*
* @return void * @return void
*/ */
public function setExecutor(CommandExecutor $executor){ public function setExecutor(CommandExecutor $executor){
$this->executor = $executor; $this->executor = $executor;
} }
/**
* @return Plugin
*/
public function getPlugin() : Plugin{ public function getPlugin() : Plugin{
return $this->owningPlugin; return $this->owningPlugin;
} }

View File

@ -27,8 +27,5 @@ use pocketmine\plugin\Plugin;
interface PluginIdentifiableCommand{ interface PluginIdentifiableCommand{
/**
* @return Plugin
*/
public function getPlugin() : Plugin; public function getPlugin() : Plugin;
} }

View File

@ -144,13 +144,6 @@ class SimpleCommandMap implements CommandMap{
} }
} }
/**
* @param string $fallbackPrefix
* @param Command $command
* @param string|null $label
*
* @return bool
*/
public function register(string $fallbackPrefix, Command $command, string $label = null) : bool{ public function register(string $fallbackPrefix, Command $command, string $label = null) : bool{
if($label === null){ if($label === null){
$label = $command->getName(); $label = $command->getName();
@ -177,11 +170,6 @@ class SimpleCommandMap implements CommandMap{
return $registered; return $registered;
} }
/**
* @param Command $command
*
* @return bool
*/
public function unregister(Command $command) : bool{ public function unregister(Command $command) : bool{
foreach($this->knownCommands as $lbl => $cmd){ foreach($this->knownCommands as $lbl => $cmd){
if($cmd === $command){ if($cmd === $command){
@ -194,14 +182,6 @@ class SimpleCommandMap implements CommandMap{
return true; return true;
} }
/**
* @param Command $command
* @param bool $isAlias
* @param string $fallbackPrefix
* @param string $label
*
* @return bool
*/
private function registerAlias(Command $command, bool $isAlias, string $fallbackPrefix, string $label) : bool{ private function registerAlias(Command $command, bool $isAlias, string $fallbackPrefix, string $label) : bool{
$this->knownCommands[$fallbackPrefix . ":" . $label] = $command; $this->knownCommands[$fallbackPrefix . ":" . $label] = $command;
if(($command instanceof VanillaCommand or $isAlias) and isset($this->knownCommands[$label])){ if(($command instanceof VanillaCommand or $isAlias) and isset($this->knownCommands[$label])){

View File

@ -137,13 +137,6 @@ class ParticleCommand extends VanillaCommand{
} }
/** /**
* @param string $name
* @param Vector3 $pos
* @param float $xd
* @param float $yd
* @param float $zd
* @param int|null $data
*
* @return Particle|null * @return Particle|null
*/ */
private function getParticle(string $name, Vector3 $pos, float $xd, float $yd, float $zd, int $data = null){ private function getParticle(string $name, Vector3 $pos, float $xd, float $yd, float $zd, int $data = null){

View File

@ -36,12 +36,7 @@ abstract class VanillaCommand extends Command{
public const MIN_COORD = -30000000; public const MIN_COORD = -30000000;
/** /**
* @param CommandSender $sender
* @param mixed $value * @param mixed $value
* @param int $min
* @param int $max
*
* @return int
*/ */
protected function getInteger(CommandSender $sender, $value, int $min = self::MIN_COORD, int $max = self::MAX_COORD) : int{ protected function getInteger(CommandSender $sender, $value, int $min = self::MIN_COORD, int $max = self::MAX_COORD) : int{
$i = (int) $value; $i = (int) $value;
@ -55,15 +50,6 @@ abstract class VanillaCommand extends Command{
return $i; return $i;
} }
/**
* @param float $original
* @param CommandSender $sender
* @param string $input
* @param float $min
* @param float $max
*
* @return float
*/
protected function getRelativeDouble(float $original, CommandSender $sender, string $input, float $min = self::MIN_COORD, float $max = self::MAX_COORD) : float{ protected function getRelativeDouble(float $original, CommandSender $sender, string $input, float $min = self::MIN_COORD, float $max = self::MAX_COORD) : float{
if($input[0] === "~"){ if($input[0] === "~"){
$value = $this->getDouble($sender, substr($input, 1)); $value = $this->getDouble($sender, substr($input, 1));
@ -75,12 +61,7 @@ abstract class VanillaCommand extends Command{
} }
/** /**
* @param CommandSender $sender
* @param mixed $value * @param mixed $value
* @param float $min
* @param float $max
*
* @return float
*/ */
protected function getDouble(CommandSender $sender, $value, float $min = self::MIN_COORD, float $max = self::MAX_COORD) : float{ protected function getDouble(CommandSender $sender, $value, float $min = self::MIN_COORD, float $max = self::MAX_COORD) : float{
$i = (double) $value; $i = (double) $value;

View File

@ -87,15 +87,6 @@ class Attribute{
} }
/** /**
* @param int $id
* @param string $name
* @param float $minValue
* @param float $maxValue
* @param float $defaultValue
* @param bool $shouldSend
*
* @return Attribute
*
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public static function addAttribute(int $id, string $name, float $minValue, float $maxValue, float $defaultValue, bool $shouldSend = true) : Attribute{ public static function addAttribute(int $id, string $name, float $minValue, float $maxValue, float $defaultValue, bool $shouldSend = true) : Attribute{
@ -106,20 +97,10 @@ class Attribute{
return self::$attributes[$id] = new Attribute($id, $name, $minValue, $maxValue, $defaultValue, $shouldSend); return self::$attributes[$id] = new Attribute($id, $name, $minValue, $maxValue, $defaultValue, $shouldSend);
} }
/**
* @param int $id
*
* @return Attribute|null
*/
public static function getAttribute(int $id) : ?Attribute{ public static function getAttribute(int $id) : ?Attribute{
return isset(self::$attributes[$id]) ? clone self::$attributes[$id] : null; return isset(self::$attributes[$id]) ? clone self::$attributes[$id] : null;
} }
/**
* @param string $name
*
* @return Attribute|null
*/
public static function getAttributeByName(string $name) : ?Attribute{ public static function getAttributeByName(string $name) : ?Attribute{
foreach(self::$attributes as $a){ foreach(self::$attributes as $a){
if($a->getName() === $name){ if($a->getName() === $name){
@ -146,8 +127,6 @@ class Attribute{
} }
/** /**
* @param float $minValue
*
* @return $this * @return $this
*/ */
public function setMinValue(float $minValue){ public function setMinValue(float $minValue){
@ -167,8 +146,6 @@ class Attribute{
} }
/** /**
* @param float $maxValue
*
* @return $this * @return $this
*/ */
public function setMaxValue(float $maxValue){ public function setMaxValue(float $maxValue){
@ -188,8 +165,6 @@ class Attribute{
} }
/** /**
* @param float $defaultValue
*
* @return $this * @return $this
*/ */
public function setDefaultValue(float $defaultValue){ public function setDefaultValue(float $defaultValue){
@ -213,10 +188,6 @@ class Attribute{
} }
/** /**
* @param float $value
* @param bool $fit
* @param bool $forceSend
*
* @return $this * @return $this
*/ */
public function setValue(float $value, bool $fit = false, bool $forceSend = false){ public function setValue(float $value, bool $fit = false, bool $forceSend = false){

View File

@ -36,11 +36,6 @@ class AttributeMap implements \ArrayAccess{
$this->attributes[$attribute->getId()] = $attribute; $this->attributes[$attribute->getId()] = $attribute;
} }
/**
* @param int $id
*
* @return Attribute|null
*/
public function getAttribute(int $id) : ?Attribute{ public function getAttribute(int $id) : ?Attribute{
return $this->attributes[$id] ?? null; return $this->attributes[$id] ?? null;
} }
@ -63,8 +58,6 @@ class AttributeMap implements \ArrayAccess{
/** /**
* @param int $offset * @param int $offset
*
* @return bool
*/ */
public function offsetExists($offset) : bool{ public function offsetExists($offset) : bool{
return isset($this->attributes[$offset]); return isset($this->attributes[$offset]);
@ -72,8 +65,6 @@ class AttributeMap implements \ArrayAccess{
/** /**
* @param int $offset * @param int $offset
*
* @return float
*/ */
public function offsetGet($offset) : float{ public function offsetGet($offset) : float{
return $this->attributes[$offset]->getValue(); return $this->attributes[$offset]->getValue();

View File

@ -42,102 +42,52 @@ class DataPropertyManager{
} }
/**
* @param int $key
*
* @return int|null
*/
public function getByte(int $key) : ?int{ public function getByte(int $key) : ?int{
$value = $this->getPropertyValue($key, Entity::DATA_TYPE_BYTE); $value = $this->getPropertyValue($key, Entity::DATA_TYPE_BYTE);
assert(is_int($value) or $value === null); assert(is_int($value) or $value === null);
return $value; return $value;
} }
/**
* @param int $key
* @param int $value
* @param bool $force
*/
public function setByte(int $key, int $value, bool $force = false) : void{ public function setByte(int $key, int $value, bool $force = false) : void{
$this->setPropertyValue($key, Entity::DATA_TYPE_BYTE, $value, $force); $this->setPropertyValue($key, Entity::DATA_TYPE_BYTE, $value, $force);
} }
/**
* @param int $key
*
* @return int|null
*/
public function getShort(int $key) : ?int{ public function getShort(int $key) : ?int{
$value = $this->getPropertyValue($key, Entity::DATA_TYPE_SHORT); $value = $this->getPropertyValue($key, Entity::DATA_TYPE_SHORT);
assert(is_int($value) or $value === null); assert(is_int($value) or $value === null);
return $value; return $value;
} }
/**
* @param int $key
* @param int $value
* @param bool $force
*/
public function setShort(int $key, int $value, bool $force = false) : void{ public function setShort(int $key, int $value, bool $force = false) : void{
$this->setPropertyValue($key, Entity::DATA_TYPE_SHORT, $value, $force); $this->setPropertyValue($key, Entity::DATA_TYPE_SHORT, $value, $force);
} }
/**
* @param int $key
*
* @return int|null
*/
public function getInt(int $key) : ?int{ public function getInt(int $key) : ?int{
$value = $this->getPropertyValue($key, Entity::DATA_TYPE_INT); $value = $this->getPropertyValue($key, Entity::DATA_TYPE_INT);
assert(is_int($value) or $value === null); assert(is_int($value) or $value === null);
return $value; return $value;
} }
/**
* @param int $key
* @param int $value
* @param bool $force
*/
public function setInt(int $key, int $value, bool $force = false) : void{ public function setInt(int $key, int $value, bool $force = false) : void{
$this->setPropertyValue($key, Entity::DATA_TYPE_INT, $value, $force); $this->setPropertyValue($key, Entity::DATA_TYPE_INT, $value, $force);
} }
/**
* @param int $key
*
* @return float|null
*/
public function getFloat(int $key) : ?float{ public function getFloat(int $key) : ?float{
$value = $this->getPropertyValue($key, Entity::DATA_TYPE_FLOAT); $value = $this->getPropertyValue($key, Entity::DATA_TYPE_FLOAT);
assert(is_float($value) or $value === null); assert(is_float($value) or $value === null);
return $value; return $value;
} }
/**
* @param int $key
* @param float $value
* @param bool $force
*/
public function setFloat(int $key, float $value, bool $force = false) : void{ public function setFloat(int $key, float $value, bool $force = false) : void{
$this->setPropertyValue($key, Entity::DATA_TYPE_FLOAT, $value, $force); $this->setPropertyValue($key, Entity::DATA_TYPE_FLOAT, $value, $force);
} }
/**
* @param int $key
*
* @return null|string
*/
public function getString(int $key) : ?string{ public function getString(int $key) : ?string{
$value = $this->getPropertyValue($key, Entity::DATA_TYPE_STRING); $value = $this->getPropertyValue($key, Entity::DATA_TYPE_STRING);
assert(is_string($value) or $value === null); assert(is_string($value) or $value === null);
return $value; return $value;
} }
/**
* @param int $key
* @param string $value
* @param bool $force
*/
public function setString(int $key, string $value, bool $force = false) : void{ public function setString(int $key, string $value, bool $force = false) : void{
$this->setPropertyValue($key, Entity::DATA_TYPE_STRING, $value, $force); $this->setPropertyValue($key, Entity::DATA_TYPE_STRING, $value, $force);
} }
@ -152,87 +102,44 @@ class DataPropertyManager{
$this->setPropertyValue($key, Entity::DATA_TYPE_COMPOUND_TAG, $value, $force); $this->setPropertyValue($key, Entity::DATA_TYPE_COMPOUND_TAG, $value, $force);
} }
/**
* @param int $key
*
* @return null|Vector3
*/
public function getBlockPos(int $key) : ?Vector3{ public function getBlockPos(int $key) : ?Vector3{
$value = $this->getPropertyValue($key, Entity::DATA_TYPE_POS); $value = $this->getPropertyValue($key, Entity::DATA_TYPE_POS);
assert($value instanceof Vector3 or $value === null); assert($value instanceof Vector3 or $value === null);
return $value; return $value;
} }
/**
* @param int $key
* @param null|Vector3 $value
* @param bool $force
*/
public function setBlockPos(int $key, ?Vector3 $value, bool $force = false) : void{ public function setBlockPos(int $key, ?Vector3 $value, bool $force = false) : void{
$this->setPropertyValue($key, Entity::DATA_TYPE_POS, $value ? $value->floor() : null, $force); $this->setPropertyValue($key, Entity::DATA_TYPE_POS, $value ? $value->floor() : null, $force);
} }
/**
* @param int $key
*
* @return int|null
*/
public function getLong(int $key) : ?int{ public function getLong(int $key) : ?int{
$value = $this->getPropertyValue($key, Entity::DATA_TYPE_LONG); $value = $this->getPropertyValue($key, Entity::DATA_TYPE_LONG);
assert(is_int($value) or $value === null); assert(is_int($value) or $value === null);
return $value; return $value;
} }
/**
* @param int $key
* @param int $value
* @param bool $force
*/
public function setLong(int $key, int $value, bool $force = false) : void{ public function setLong(int $key, int $value, bool $force = false) : void{
$this->setPropertyValue($key, Entity::DATA_TYPE_LONG, $value, $force); $this->setPropertyValue($key, Entity::DATA_TYPE_LONG, $value, $force);
} }
/**
* @param int $key
*
* @return null|Vector3
*/
public function getVector3(int $key) : ?Vector3{ public function getVector3(int $key) : ?Vector3{
$value = $this->getPropertyValue($key, Entity::DATA_TYPE_VECTOR3F); $value = $this->getPropertyValue($key, Entity::DATA_TYPE_VECTOR3F);
assert($value instanceof Vector3 or $value === null); assert($value instanceof Vector3 or $value === null);
return $value; return $value;
} }
/**
* @param int $key
* @param null|Vector3 $value
* @param bool $force
*/
public function setVector3(int $key, ?Vector3 $value, bool $force = false) : void{ public function setVector3(int $key, ?Vector3 $value, bool $force = false) : void{
$this->setPropertyValue($key, Entity::DATA_TYPE_VECTOR3F, $value ? $value->asVector3() : null, $force); $this->setPropertyValue($key, Entity::DATA_TYPE_VECTOR3F, $value ? $value->asVector3() : null, $force);
} }
/**
* @param int $key
*/
public function removeProperty(int $key) : void{ public function removeProperty(int $key) : void{
unset($this->properties[$key]); unset($this->properties[$key]);
} }
/**
* @param int $key
*
* @return bool
*/
public function hasProperty(int $key) : bool{ public function hasProperty(int $key) : bool{
return isset($this->properties[$key]); return isset($this->properties[$key]);
} }
/**
* @param int $key
*
* @return int
*/
public function getPropertyType(int $key) : int{ public function getPropertyType(int $key) : int{
if(isset($this->properties[$key])){ if(isset($this->properties[$key])){
return $this->properties[$key][0]; return $this->properties[$key][0];
@ -248,9 +155,6 @@ class DataPropertyManager{
} }
/** /**
* @param int $key
* @param int $type
*
* @return mixed * @return mixed
*/ */
public function getPropertyValue(int $key, int $type){ public function getPropertyValue(int $key, int $type){
@ -261,10 +165,7 @@ class DataPropertyManager{
} }
/** /**
* @param int $key
* @param int $type
* @param mixed $value * @param mixed $value
* @param bool $force
*/ */
public function setPropertyValue(int $key, int $type, $value, bool $force = false) : void{ public function setPropertyValue(int $key, int $type, $value, bool $force = false) : void{
if(!$force){ if(!$force){
@ -275,8 +176,6 @@ class DataPropertyManager{
/** /**
* Returns all properties. * Returns all properties.
*
* @return array
*/ */
public function getAll() : array{ public function getAll() : array{
return $this->properties; return $this->properties;
@ -284,8 +183,6 @@ class DataPropertyManager{
/** /**
* Returns properties that have changed and need to be broadcasted. * Returns properties that have changed and need to be broadcasted.
*
* @return array
*/ */
public function getDirty() : array{ public function getDirty() : array{
return $this->dirtyProperties; return $this->dirtyProperties;

View File

@ -93,27 +93,14 @@ class Effect{
self::registerEffect(new Effect(Effect::CONDUIT_POWER, "%potion.conduitPower", new Color(0x1d, 0xc2, 0xd1))); self::registerEffect(new Effect(Effect::CONDUIT_POWER, "%potion.conduitPower", new Color(0x1d, 0xc2, 0xd1)));
} }
/**
* @param Effect $effect
*/
public static function registerEffect(Effect $effect) : void{ public static function registerEffect(Effect $effect) : void{
self::$effects[$effect->getId()] = $effect; self::$effects[$effect->getId()] = $effect;
} }
/**
* @param int $id
*
* @return Effect|null
*/
public static function getEffect(int $id) : ?Effect{ public static function getEffect(int $id) : ?Effect{
return self::$effects[$id] ?? null; return self::$effects[$id] ?? null;
} }
/**
* @param string $name
*
* @return Effect|null
*/
public static function getEffectByName(string $name) : ?Effect{ public static function getEffectByName(string $name) : ?Effect{
$const = self::class . "::" . strtoupper($name); $const = self::class . "::" . strtoupper($name);
if(defined($const)){ if(defined($const)){
@ -154,7 +141,6 @@ class Effect{
/** /**
* Returns the effect ID as per Minecraft PE * Returns the effect ID as per Minecraft PE
* @return int
*/ */
public function getId() : int{ public function getId() : int{
return $this->id; return $this->id;
@ -162,7 +148,6 @@ class Effect{
/** /**
* Returns the translation key used to translate this effect's name. * Returns the translation key used to translate this effect's name.
* @return string
*/ */
public function getName() : string{ public function getName() : string{
return $this->name; return $this->name;
@ -170,7 +155,6 @@ class Effect{
/** /**
* Returns a Color object representing this effect's particle colour. * Returns a Color object representing this effect's particle colour.
* @return Color
*/ */
public function getColor() : Color{ public function getColor() : Color{
return clone $this->color; return clone $this->color;
@ -179,8 +163,6 @@ class Effect{
/** /**
* Returns whether this effect is harmful. * Returns whether this effect is harmful.
* TODO: implement inverse effect results for undead mobs * TODO: implement inverse effect results for undead mobs
*
* @return bool
*/ */
public function isBad() : bool{ public function isBad() : bool{
return $this->bad; return $this->bad;
@ -188,7 +170,6 @@ class Effect{
/** /**
* Returns whether the effect is by default an instant effect. * Returns whether the effect is by default an instant effect.
* @return bool
*/ */
public function isInstantEffect() : bool{ public function isInstantEffect() : bool{
return $this->defaultDuration <= 1; return $this->defaultDuration <= 1;
@ -196,8 +177,6 @@ class Effect{
/** /**
* Returns the default duration (in ticks) this effect will apply for if a duration is not specified. * Returns the default duration (in ticks) this effect will apply for if a duration is not specified.
*
* @return int
*/ */
public function getDefaultDuration() : int{ public function getDefaultDuration() : int{
return $this->defaultDuration; return $this->defaultDuration;
@ -205,7 +184,6 @@ class Effect{
/** /**
* Returns whether this effect will give the subject potion bubbles. * Returns whether this effect will give the subject potion bubbles.
* @return bool
*/ */
public function hasBubbles() : bool{ public function hasBubbles() : bool{
return $this->hasBubbles; return $this->hasBubbles;
@ -213,10 +191,6 @@ class Effect{
/** /**
* Returns whether the effect will do something on the current tick. * Returns whether the effect will do something on the current tick.
*
* @param EffectInstance $instance
*
* @return bool
*/ */
public function canTick(EffectInstance $instance) : bool{ public function canTick(EffectInstance $instance) : bool{
switch($this->id){ switch($this->id){
@ -249,12 +223,6 @@ class Effect{
/** /**
* Applies effect results to an entity. This will not be called unless canTick() returns true. * Applies effect results to an entity. This will not be called unless canTick() returns true.
*
* @param Living $entity
* @param EffectInstance $instance
* @param float $potency
* @param null|Entity $source
* @param null|Entity $sourceOwner
*/ */
public function applyEffect(Living $entity, EffectInstance $instance, float $potency = 1.0, ?Entity $source = null, ?Entity $sourceOwner = null) : void{ public function applyEffect(Living $entity, EffectInstance $instance, float $potency = 1.0, ?Entity $source = null, ?Entity $sourceOwner = null) : void{
switch($this->id){ switch($this->id){
@ -315,9 +283,6 @@ class Effect{
/** /**
* Applies effects to the entity when the effect is first added. * Applies effects to the entity when the effect is first added.
*
* @param Living $entity
* @param EffectInstance $instance
*/ */
public function add(Living $entity, EffectInstance $instance) : void{ public function add(Living $entity, EffectInstance $instance) : void{
switch($this->id){ switch($this->id){
@ -348,9 +313,6 @@ class Effect{
/** /**
* Removes the effect from the entity, resetting any changed values back to their original defaults. * Removes the effect from the entity, resetting any changed values back to their original defaults.
*
* @param Living $entity
* @param EffectInstance $instance
*/ */
public function remove(Living $entity, EffectInstance $instance) : void{ public function remove(Living $entity, EffectInstance $instance) : void{
switch($this->id){ switch($this->id){

View File

@ -47,12 +47,7 @@ class EffectInstance{
private $color; private $color;
/** /**
* @param Effect $effectType
* @param int|null $duration Passing null will use the effect type's default duration * @param int|null $duration Passing null will use the effect type's default duration
* @param int $amplifier
* @param bool $visible
* @param bool $ambient
* @param null|Color $overrideColor
*/ */
public function __construct(Effect $effectType, ?int $duration = null, int $amplifier = 0, bool $visible = true, bool $ambient = false, ?Color $overrideColor = null){ public function __construct(Effect $effectType, ?int $duration = null, int $amplifier = 0, bool $visible = true, bool $ambient = false, ?Color $overrideColor = null){
$this->effectType = $effectType; $this->effectType = $effectType;
@ -67,17 +62,12 @@ class EffectInstance{
return $this->effectType->getId(); return $this->effectType->getId();
} }
/**
* @return Effect
*/
public function getType() : Effect{ public function getType() : Effect{
return $this->effectType; return $this->effectType;
} }
/** /**
* Returns the number of ticks remaining until the effect expires. * Returns the number of ticks remaining until the effect expires.
*
* @return int
*/ */
public function getDuration() : int{ public function getDuration() : int{
return $this->duration; return $this->duration;
@ -86,8 +76,6 @@ class EffectInstance{
/** /**
* Sets the number of ticks remaining until the effect expires. * Sets the number of ticks remaining until the effect expires.
* *
* @param int $duration
*
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* *
* @return $this * @return $this
@ -104,8 +92,6 @@ class EffectInstance{
/** /**
* Decreases the duration by the given number of ticks, without dropping below zero. * Decreases the duration by the given number of ticks, without dropping below zero.
* *
* @param int $ticks
*
* @return $this * @return $this
*/ */
public function decreaseDuration(int $ticks) : EffectInstance{ public function decreaseDuration(int $ticks) : EffectInstance{
@ -116,32 +102,23 @@ class EffectInstance{
/** /**
* Returns whether the duration has run out. * Returns whether the duration has run out.
*
* @return bool
*/ */
public function hasExpired() : bool{ public function hasExpired() : bool{
return $this->duration <= 0; return $this->duration <= 0;
} }
/**
* @return int
*/
public function getAmplifier() : int{ public function getAmplifier() : int{
return $this->amplifier; return $this->amplifier;
} }
/** /**
* Returns the level of this effect, which is always one higher than the amplifier. * Returns the level of this effect, which is always one higher than the amplifier.
*
* @return int
*/ */
public function getEffectLevel() : int{ public function getEffectLevel() : int{
return $this->amplifier + 1; return $this->amplifier + 1;
} }
/** /**
* @param int $amplifier
*
* @return $this * @return $this
*/ */
public function setAmplifier(int $amplifier) : EffectInstance{ public function setAmplifier(int $amplifier) : EffectInstance{
@ -152,16 +129,12 @@ class EffectInstance{
/** /**
* Returns whether this effect will produce some visible effect, such as bubbles or particles. * Returns whether this effect will produce some visible effect, such as bubbles or particles.
*
* @return bool
*/ */
public function isVisible() : bool{ public function isVisible() : bool{
return $this->visible; return $this->visible;
} }
/** /**
* @param bool $visible
*
* @return $this * @return $this
*/ */
public function setVisible(bool $visible = true) : EffectInstance{ public function setVisible(bool $visible = true) : EffectInstance{
@ -174,16 +147,12 @@ class EffectInstance{
* Returns whether the effect originated from the ambient environment. * Returns whether the effect originated from the ambient environment.
* Ambient effects can originate from things such as a Beacon's area of effect radius. * Ambient effects can originate from things such as a Beacon's area of effect radius.
* If this flag is set, the amount of visible particles will be reduced by a factor of 5. * If this flag is set, the amount of visible particles will be reduced by a factor of 5.
*
* @return bool
*/ */
public function isAmbient() : bool{ public function isAmbient() : bool{
return $this->ambient; return $this->ambient;
} }
/** /**
* @param bool $ambient
*
* @return $this * @return $this
*/ */
public function setAmbient(bool $ambient = true) : EffectInstance{ public function setAmbient(bool $ambient = true) : EffectInstance{
@ -195,8 +164,6 @@ class EffectInstance{
/** /**
* Returns the particle colour of this effect instance. This can be overridden on a per-EffectInstance basis, so it * Returns the particle colour of this effect instance. This can be overridden on a per-EffectInstance basis, so it
* is not reflective of the default colour of the effect. * is not reflective of the default colour of the effect.
*
* @return Color
*/ */
public function getColor() : Color{ public function getColor() : Color{
return clone $this->color; return clone $this->color;
@ -204,10 +171,6 @@ class EffectInstance{
/** /**
* Sets the colour of this EffectInstance. * Sets the colour of this EffectInstance.
*
* @param Color $color
*
* @return EffectInstance
*/ */
public function setColor(Color $color) : EffectInstance{ public function setColor(Color $color) : EffectInstance{
$this->color = clone $color; $this->color = clone $color;
@ -217,8 +180,6 @@ class EffectInstance{
/** /**
* Resets the colour of this EffectInstance to the default specified by its type. * Resets the colour of this EffectInstance to the default specified by its type.
*
* @return EffectInstance
*/ */
public function resetColor() : EffectInstance{ public function resetColor() : EffectInstance{
$this->color = $this->effectType->getColor(); $this->color = $this->effectType->getColor();

View File

@ -353,17 +353,12 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
PaintingMotive::init(); PaintingMotive::init();
} }
/** /**
* Creates an entity with the specified type, level and NBT, with optional additional arguments to pass to the * Creates an entity with the specified type, level and NBT, with optional additional arguments to pass to the
* entity's constructor * entity's constructor
* *
* @param int|string $type * @param int|string $type
* @param Level $level
* @param CompoundTag $nbt
* @param mixed ...$args * @param mixed ...$args
*
* @return Entity|null
*/ */
public static function createEntity($type, Level $level, CompoundTag $nbt, ...$args) : ?Entity{ public static function createEntity($type, Level $level, CompoundTag $nbt, ...$args) : ?Entity{
if(isset(self::$knownEntities[$type])){ if(isset(self::$knownEntities[$type])){
@ -384,8 +379,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
* *
* NOTE: The first save name in the $saveNames array will be used when saving the entity to disk. The reflection * NOTE: The first save name in the $saveNames array will be used when saving the entity to disk. The reflection
* name of the class will be appended to the end and only used if no other save names are specified. * name of the class will be appended to the end and only used if no other save names are specified.
*
* @return bool
*/ */
public static function registerEntity(string $className, bool $force = false, array $saveNames = []) : bool{ public static function registerEntity(string $className, bool $force = false, array $saveNames = []) : bool{
/** @var Entity $className */ /** @var Entity $className */
@ -417,13 +410,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Helper function which creates minimal NBT needed to spawn an entity. * Helper function which creates minimal NBT needed to spawn an entity.
*
* @param Vector3 $pos
* @param Vector3|null $motion
* @param float $yaw
* @param float $pitch
*
* @return CompoundTag
*/ */
public static function createBaseNBT(Vector3 $pos, ?Vector3 $motion = null, float $yaw = 0.0, float $pitch = 0.0) : CompoundTag{ public static function createBaseNBT(Vector3 $pos, ?Vector3 $motion = null, float $yaw = 0.0, float $pitch = 0.0) : CompoundTag{
return new CompoundTag("", [ return new CompoundTag("", [
@ -652,73 +638,42 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
} }
/**
* @return string
*/
public function getNameTag() : string{ public function getNameTag() : string{
return $this->propertyManager->getString(self::DATA_NAMETAG); return $this->propertyManager->getString(self::DATA_NAMETAG);
} }
/**
* @return bool
*/
public function isNameTagVisible() : bool{ public function isNameTagVisible() : bool{
return $this->getGenericFlag(self::DATA_FLAG_CAN_SHOW_NAMETAG); return $this->getGenericFlag(self::DATA_FLAG_CAN_SHOW_NAMETAG);
} }
/**
* @return bool
*/
public function isNameTagAlwaysVisible() : bool{ public function isNameTagAlwaysVisible() : bool{
return $this->propertyManager->getByte(self::DATA_ALWAYS_SHOW_NAMETAG) === 1; return $this->propertyManager->getByte(self::DATA_ALWAYS_SHOW_NAMETAG) === 1;
} }
/**
* @param string $name
*/
public function setNameTag(string $name) : void{ public function setNameTag(string $name) : void{
$this->propertyManager->setString(self::DATA_NAMETAG, $name); $this->propertyManager->setString(self::DATA_NAMETAG, $name);
} }
/**
* @param bool $value
*/
public function setNameTagVisible(bool $value = true) : void{ public function setNameTagVisible(bool $value = true) : void{
$this->setGenericFlag(self::DATA_FLAG_CAN_SHOW_NAMETAG, $value); $this->setGenericFlag(self::DATA_FLAG_CAN_SHOW_NAMETAG, $value);
} }
/**
* @param bool $value
*/
public function setNameTagAlwaysVisible(bool $value = true) : void{ public function setNameTagAlwaysVisible(bool $value = true) : void{
$this->propertyManager->setByte(self::DATA_ALWAYS_SHOW_NAMETAG, $value ? 1 : 0); $this->propertyManager->setByte(self::DATA_ALWAYS_SHOW_NAMETAG, $value ? 1 : 0);
} }
/**
* @return string|null
*/
public function getScoreTag() : ?string{ public function getScoreTag() : ?string{
return $this->propertyManager->getString(self::DATA_SCORE_TAG); return $this->propertyManager->getString(self::DATA_SCORE_TAG);
} }
/**
* @param string $score
*/
public function setScoreTag(string $score) : void{ public function setScoreTag(string $score) : void{
$this->propertyManager->setString(self::DATA_SCORE_TAG, $score); $this->propertyManager->setString(self::DATA_SCORE_TAG, $score);
} }
/**
* @return float
*/
public function getScale() : float{ public function getScale() : float{
return $this->propertyManager->getFloat(self::DATA_SCALE); return $this->propertyManager->getFloat(self::DATA_SCALE);
} }
/**
* @param float $value
*/
public function setScale(float $value) : void{ public function setScale(float $value) : void{
if($value <= 0){ if($value <= 0){
throw new \InvalidArgumentException("Scale must be greater than 0"); throw new \InvalidArgumentException("Scale must be greater than 0");
@ -789,7 +744,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Returns whether the entity is able to climb blocks such as ladders or vines. * Returns whether the entity is able to climb blocks such as ladders or vines.
* @return bool
*/ */
public function canClimb() : bool{ public function canClimb() : bool{
return $this->getGenericFlag(self::DATA_FLAG_CAN_CLIMB); return $this->getGenericFlag(self::DATA_FLAG_CAN_CLIMB);
@ -797,8 +751,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Sets whether the entity is able to climb climbable blocks. * Sets whether the entity is able to climb climbable blocks.
*
* @param bool $value
*/ */
public function setCanClimb(bool $value = true) : void{ public function setCanClimb(bool $value = true) : void{
$this->setGenericFlag(self::DATA_FLAG_CAN_CLIMB, $value); $this->setGenericFlag(self::DATA_FLAG_CAN_CLIMB, $value);
@ -806,8 +758,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Returns whether this entity is climbing a block. By default this is only true if the entity is climbing a ladder or vine or similar block. * Returns whether this entity is climbing a block. By default this is only true if the entity is climbing a ladder or vine or similar block.
*
* @return bool
*/ */
public function canClimbWalls() : bool{ public function canClimbWalls() : bool{
return $this->getGenericFlag(self::DATA_FLAG_WALLCLIMBING); return $this->getGenericFlag(self::DATA_FLAG_WALLCLIMBING);
@ -815,8 +765,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Sets whether the entity is climbing a block. If true, the entity can climb anything. * Sets whether the entity is climbing a block. If true, the entity can climb anything.
*
* @param bool $value
*/ */
public function setCanClimbWalls(bool $value = true) : void{ public function setCanClimbWalls(bool $value = true) : void{
$this->setGenericFlag(self::DATA_FLAG_WALLCLIMBING, $value); $this->setGenericFlag(self::DATA_FLAG_WALLCLIMBING, $value);
@ -824,7 +772,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Returns the entity ID of the owning entity, or null if the entity doesn't have an owner. * Returns the entity ID of the owning entity, or null if the entity doesn't have an owner.
* @return int|null
*/ */
public function getOwningEntityId() : ?int{ public function getOwningEntityId() : ?int{
return $this->propertyManager->getLong(self::DATA_OWNER_EID); return $this->propertyManager->getLong(self::DATA_OWNER_EID);
@ -832,7 +779,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Returns the owning entity, or null if the entity was not found. * Returns the owning entity, or null if the entity was not found.
* @return Entity|null
*/ */
public function getOwningEntity() : ?Entity{ public function getOwningEntity() : ?Entity{
$eid = $this->getOwningEntityId(); $eid = $this->getOwningEntityId();
@ -846,8 +792,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Sets the owner of the entity. Passing null will remove the current owner. * Sets the owner of the entity. Passing null will remove the current owner.
* *
* @param Entity|null $owner
*
* @throws \InvalidArgumentException if the supplied entity is not valid * @throws \InvalidArgumentException if the supplied entity is not valid
*/ */
public function setOwningEntity(?Entity $owner) : void{ public function setOwningEntity(?Entity $owner) : void{
@ -862,7 +806,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Returns the entity ID of the entity's target, or null if it doesn't have a target. * Returns the entity ID of the entity's target, or null if it doesn't have a target.
* @return int|null
*/ */
public function getTargetEntityId() : ?int{ public function getTargetEntityId() : ?int{
return $this->propertyManager->getLong(self::DATA_TARGET_EID); return $this->propertyManager->getLong(self::DATA_TARGET_EID);
@ -871,8 +814,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Returns the entity's target entity, or null if not found. * Returns the entity's target entity, or null if not found.
* This is used for things like hostile mobs attacking entities, and for fishing rods reeling hit entities in. * This is used for things like hostile mobs attacking entities, and for fishing rods reeling hit entities in.
*
* @return Entity|null
*/ */
public function getTargetEntity() : ?Entity{ public function getTargetEntity() : ?Entity{
$eid = $this->getTargetEntityId(); $eid = $this->getTargetEntityId();
@ -886,8 +827,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Sets the entity's target entity. Passing null will remove the current target. * Sets the entity's target entity. Passing null will remove the current target.
* *
* @param Entity|null $target
*
* @throws \InvalidArgumentException if the target entity is not valid * @throws \InvalidArgumentException if the target entity is not valid
*/ */
public function setTargetEntity(?Entity $target) : void{ public function setTargetEntity(?Entity $target) : void{
@ -902,7 +841,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Returns whether this entity will be saved when its chunk is unloaded. * Returns whether this entity will be saved when its chunk is unloaded.
* @return bool
*/ */
public function canSaveWithChunk() : bool{ public function canSaveWithChunk() : bool{
return $this->savedWithChunk; return $this->savedWithChunk;
@ -911,8 +849,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Sets whether this entity will be saved when its chunk is unloaded. This can be used to prevent the entity being * Sets whether this entity will be saved when its chunk is unloaded. This can be used to prevent the entity being
* saved to disk. * saved to disk.
*
* @param bool $value
*/ */
public function setCanSaveWithChunk(bool $value) : void{ public function setCanSaveWithChunk(bool $value) : void{
$this->savedWithChunk = $value; $this->savedWithChunk = $value;
@ -920,8 +856,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Returns the short save name * Returns the short save name
*
* @return string
*/ */
public function getSaveId() : string{ public function getSaveId() : string{
if(!isset(self::$saveNames[static::class])){ if(!isset(self::$saveNames[static::class])){
@ -987,9 +921,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
} }
/**
* @param EntityDamageEvent $source
*/
public function attack(EntityDamageEvent $source) : void{ public function attack(EntityDamageEvent $source) : void{
$source->call(); $source->call();
if($source->isCancelled()){ if($source->isCancelled()){
@ -1001,9 +932,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
$this->setHealth($this->getHealth() - $source->getFinalDamage()); $this->setHealth($this->getHealth() - $source->getFinalDamage());
} }
/**
* @param EntityRegainHealthEvent $source
*/
public function heal(EntityRegainHealthEvent $source) : void{ public function heal(EntityRegainHealthEvent $source) : void{
$source->call(); $source->call();
if($source->isCancelled()){ if($source->isCancelled()){
@ -1020,10 +948,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Called to tick entities while dead. Returns whether the entity should be flagged for despawn yet. * Called to tick entities while dead. Returns whether the entity should be flagged for despawn yet.
*
* @param int $tickDiff
*
* @return bool
*/ */
protected function onDeathUpdate(int $tickDiff) : bool{ protected function onDeathUpdate(int $tickDiff) : bool{
return true; return true;
@ -1033,17 +957,12 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
return $this->health > 0; return $this->health > 0;
} }
/**
* @return float
*/
public function getHealth() : float{ public function getHealth() : float{
return $this->health; return $this->health;
} }
/** /**
* Sets the health of the Entity. This won't send any update to the players * Sets the health of the Entity. This won't send any update to the players
*
* @param float $amount
*/ */
public function setHealth(float $amount) : void{ public function setHealth(float $amount) : void{
if($amount == $this->health){ if($amount == $this->health){
@ -1062,30 +981,18 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
} }
} }
/**
* @return int
*/
public function getMaxHealth() : int{ public function getMaxHealth() : int{
return $this->maxHealth; return $this->maxHealth;
} }
/**
* @param int $amount
*/
public function setMaxHealth(int $amount) : void{ public function setMaxHealth(int $amount) : void{
$this->maxHealth = $amount; $this->maxHealth = $amount;
} }
/**
* @param EntityDamageEvent $type
*/
public function setLastDamageCause(EntityDamageEvent $type) : void{ public function setLastDamageCause(EntityDamageEvent $type) : void{
$this->lastDamageCause = $type; $this->lastDamageCause = $type;
} }
/**
* @return EntityDamageEvent|null
*/
public function getLastDamageCause() : ?EntityDamageEvent{ public function getLastDamageCause() : ?EntityDamageEvent{
return $this->lastDamageCause; return $this->lastDamageCause;
} }
@ -1148,15 +1055,11 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
$this->setGenericFlag(self::DATA_FLAG_ONFIRE, $this->isOnFire()); $this->setGenericFlag(self::DATA_FLAG_ONFIRE, $this->isOnFire());
} }
/**
* @return int
*/
public function getFireTicks() : int{ public function getFireTicks() : int{
return $this->fireTicks; return $this->fireTicks;
} }
/** /**
* @param int $fireTicks
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public function setFireTicks(int $fireTicks) : void{ public function setFireTicks(int $fireTicks) : void{
@ -1397,9 +1300,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
return false; return false;
} }
/**
* @return int|null
*/
public function getDirection() : ?int{ public function getDirection() : ?int{
$rotation = ($this->yaw - 90) % 360; $rotation = ($this->yaw - 90) % 360;
if($rotation < 0){ if($rotation < 0){
@ -1418,9 +1318,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
} }
} }
/**
* @return Vector3
*/
public function getDirectionVector() : Vector3{ public function getDirectionVector() : Vector3{
$y = -sin(deg2rad($this->pitch)); $y = -sin(deg2rad($this->pitch));
$xz = cos(deg2rad($this->pitch)); $xz = cos(deg2rad($this->pitch));
@ -1510,8 +1407,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Flags the entity as needing a movement update on the next tick. Setting this forces a movement update even if the * Flags the entity as needing a movement update on the next tick. Setting this forces a movement update even if the
* entity's motion is zero. Used to trigger movement updates when blocks change near entities. * entity's motion is zero. Used to trigger movement updates when blocks change near entities.
*
* @param bool $value
*/ */
final public function setForceMovementUpdate(bool $value = true) : void{ final public function setForceMovementUpdate(bool $value = true) : void{
$this->forceMovementUpdate = $value; $this->forceMovementUpdate = $value;
@ -1521,7 +1416,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Returns whether the entity needs a movement update on the next tick. * Returns whether the entity needs a movement update on the next tick.
* @return bool
*/ */
public function hasMovementUpdate() : bool{ public function hasMovementUpdate() : bool{
return ( return (
@ -1541,10 +1435,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
$this->fallDistance = 0.0; $this->fallDistance = 0.0;
} }
/**
* @param float $distanceThisTick
* @param bool $onGround
*/
protected function updateFallState(float $distanceThisTick, bool $onGround) : void{ protected function updateFallState(float $distanceThisTick, bool $onGround) : void{
if($onGround){ if($onGround){
if($this->fallDistance > 0){ if($this->fallDistance > 0){
@ -1558,8 +1448,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Called when a falling entity hits the ground. * Called when a falling entity hits the ground.
*
* @param float $fallDistance
*/ */
public function fall(float $fallDistance) : void{ public function fall(float $fallDistance) : void{
@ -1823,8 +1711,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Returns whether this entity can be moved by currents in liquids. * Returns whether this entity can be moved by currents in liquids.
*
* @return bool
*/ */
public function canBeMovedByCurrents() : bool{ public function canBeMovedByCurrents() : bool{
return true; return true;
@ -1960,10 +1846,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* @param Vector3|Position|Location $pos * @param Vector3|Position|Location $pos
* @param float|null $yaw
* @param float|null $pitch
*
* @return bool
*/ */
public function teleport(Vector3 $pos, ?float $yaw = null, ?float $pitch = null) : bool{ public function teleport(Vector3 $pos, ?float $yaw = null, ?float $pitch = null) : bool{
if($pos instanceof Location){ if($pos instanceof Location){
@ -2032,8 +1914,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Called by spawnTo() to send whatever packets needed to spawn the entity to the client. * Called by spawnTo() to send whatever packets needed to spawn the entity to the client.
*
* @param Player $player
*/ */
protected function sendSpawnPacket(Player $player) : void{ protected function sendSpawnPacket(Player $player) : void{
$pk = new AddActorPacket(); $pk = new AddActorPacket();
@ -2050,9 +1930,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
$player->dataPacket($pk); $player->dataPacket($pk);
} }
/**
* @param Player $player
*/
public function spawnTo(Player $player) : void{ public function spawnTo(Player $player) : void{
if(!isset($this->hasSpawned[$player->getLoaderId()]) and $this->chunk !== null and isset($player->usedChunks[Level::chunkHash($this->chunk->getX(), $this->chunk->getZ())])){ if(!isset($this->hasSpawned[$player->getLoaderId()]) and $this->chunk !== null and isset($player->usedChunks[Level::chunkHash($this->chunk->getX(), $this->chunk->getZ())])){
$this->hasSpawned[$player->getLoaderId()] = $player; $this->hasSpawned[$player->getLoaderId()] = $player;
@ -2082,9 +1959,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* @deprecated WARNING: This function DOES NOT permanently hide the entity from the player. As soon as the entity or * @deprecated WARNING: This function DOES NOT permanently hide the entity from the player. As soon as the entity or
* player moves, the player will once again be able to see the entity. * player moves, the player will once again be able to see the entity.
*
* @param Player $player
* @param bool $send
*/ */
public function despawnFrom(Player $player, bool $send = true) : void{ public function despawnFrom(Player $player, bool $send = true) : void{
if(isset($this->hasSpawned[$player->getLoaderId()])){ if(isset($this->hasSpawned[$player->getLoaderId()])){
@ -2121,7 +1995,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Returns whether the entity has been "closed". * Returns whether the entity has been "closed".
* @return bool
*/ */
public function isClosed() : bool{ public function isClosed() : bool{
return $this->closed; return $this->closed;
@ -2161,12 +2034,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
} }
} }
/**
* @param int $propertyId
* @param int $flagId
* @param bool $value
* @param int $propertyType
*/
public function setDataFlag(int $propertyId, int $flagId, bool $value = true, int $propertyType = self::DATA_TYPE_LONG) : void{ public function setDataFlag(int $propertyId, int $flagId, bool $value = true, int $propertyType = self::DATA_TYPE_LONG) : void{
if($this->getDataFlag($propertyId, $flagId) !== $value){ if($this->getDataFlag($propertyId, $flagId) !== $value){
$flags = (int) $this->propertyManager->getPropertyValue($propertyId, $propertyType); $flags = (int) $this->propertyManager->getPropertyValue($propertyId, $propertyType);
@ -2175,22 +2042,12 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
} }
} }
/**
* @param int $propertyId
* @param int $flagId
*
* @return bool
*/
public function getDataFlag(int $propertyId, int $flagId) : bool{ public function getDataFlag(int $propertyId, int $flagId) : bool{
return (((int) $this->propertyManager->getPropertyValue($propertyId, -1)) & (1 << $flagId)) > 0; return (((int) $this->propertyManager->getPropertyValue($propertyId, -1)) & (1 << $flagId)) > 0;
} }
/** /**
* Wrapper around {@link Entity#getDataFlag} for generic data flag reading. * Wrapper around {@link Entity#getDataFlag} for generic data flag reading.
*
* @param int $flagId
*
* @return bool
*/ */
public function getGenericFlag(int $flagId) : bool{ public function getGenericFlag(int $flagId) : bool{
return $this->getDataFlag($flagId >= 64 ? self::DATA_FLAGS2 : self::DATA_FLAGS, $flagId % 64); return $this->getDataFlag($flagId >= 64 ? self::DATA_FLAGS2 : self::DATA_FLAGS, $flagId % 64);
@ -2198,9 +2055,6 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
/** /**
* Wrapper around {@link Entity#setDataFlag} for generic data flag setting. * Wrapper around {@link Entity#setDataFlag} for generic data flag setting.
*
* @param int $flagId
* @param bool $value
*/ */
public function setGenericFlag(int $flagId, bool $value = true) : void{ public function setGenericFlag(int $flagId, bool $value = true) : void{
$this->setDataFlag($flagId >= 64 ? self::DATA_FLAGS2 : self::DATA_FLAGS, $flagId % 64, $value, self::DATA_TYPE_LONG); $this->setDataFlag($flagId >= 64 ? self::DATA_FLAGS2 : self::DATA_FLAGS, $flagId % 64, $value, self::DATA_TYPE_LONG);

View File

@ -116,9 +116,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
} }
/** /**
* @param CompoundTag $skinTag
*
* @return Skin
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
protected static function deserializeSkinNBT(CompoundTag $skinTag) : Skin{ protected static function deserializeSkinNBT(CompoundTag $skinTag) : Skin{
@ -137,32 +134,21 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
* @deprecated * @deprecated
* *
* Checks the length of a supplied skin bitmap and returns whether the length is valid. * Checks the length of a supplied skin bitmap and returns whether the length is valid.
*
* @param string $skin
*
* @return bool
*/ */
public static function isValidSkin(string $skin) : bool{ public static function isValidSkin(string $skin) : bool{
return in_array(strlen($skin), Skin::ACCEPTED_SKIN_SIZES, true); return in_array(strlen($skin), Skin::ACCEPTED_SKIN_SIZES, true);
} }
/**
* @return UUID|null
*/
public function getUniqueId() : ?UUID{ public function getUniqueId() : ?UUID{
return $this->uuid; return $this->uuid;
} }
/**
* @return string
*/
public function getRawUniqueId() : string{ public function getRawUniqueId() : string{
return $this->rawUUID; return $this->rawUUID;
} }
/** /**
* Returns a Skin object containing information about this human's skin. * Returns a Skin object containing information about this human's skin.
* @return Skin
*/ */
public function getSkin() : Skin{ public function getSkin() : Skin{
return $this->skin; return $this->skin;
@ -171,8 +157,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** /**
* Sets the human's skin. This will not send any update to viewers, you need to do that manually using * Sets the human's skin. This will not send any update to viewers, you need to do that manually using
* {@link sendSkin}. * {@link sendSkin}.
*
* @param Skin $skin
*/ */
public function setSkin(Skin $skin) : void{ public function setSkin(Skin $skin) : void{
$skin->validate(); $skin->validate();
@ -210,8 +194,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
* WARNING: This method does not check if full and may throw an exception if out of bounds. * WARNING: This method does not check if full and may throw an exception if out of bounds.
* Use {@link Human::addFood()} for this purpose * Use {@link Human::addFood()} for this purpose
* *
* @param float $new
*
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public function setFood(float $new) : void{ public function setFood(float $new) : void{
@ -241,8 +223,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** /**
* Returns whether this Human may consume objects requiring hunger. * Returns whether this Human may consume objects requiring hunger.
*
* @return bool
*/ */
public function isHungry() : bool{ public function isHungry() : bool{
return $this->getFood() < $this->getMaxFood(); return $this->getFood() < $this->getMaxFood();
@ -256,8 +236,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
* WARNING: This method does not check if saturated and may throw an exception if out of bounds. * WARNING: This method does not check if saturated and may throw an exception if out of bounds.
* Use {@link Human::addSaturation()} for this purpose * Use {@link Human::addSaturation()} for this purpose
* *
* @param float $saturation
*
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public function setSaturation(float $saturation) : void{ public function setSaturation(float $saturation) : void{
@ -276,8 +254,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** /**
* WARNING: This method does not check if exhausted and does not consume saturation/food. * WARNING: This method does not check if exhausted and does not consume saturation/food.
* Use {@link Human::exhaust()} for this purpose. * Use {@link Human::exhaust()} for this purpose.
*
* @param float $exhaustion
*/ */
public function setExhaustion(float $exhaustion) : void{ public function setExhaustion(float $exhaustion) : void{
$this->attributeMap->getAttribute(Attribute::EXHAUSTION)->setValue($exhaustion); $this->attributeMap->getAttribute(Attribute::EXHAUSTION)->setValue($exhaustion);
@ -286,9 +262,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** /**
* Increases a human's exhaustion level. * Increases a human's exhaustion level.
* *
* @param float $amount
* @param int $cause
*
* @return float the amount of exhaustion level increased * @return float the amount of exhaustion level increased
*/ */
public function exhaust(float $amount, int $cause = PlayerExhaustEvent::CAUSE_CUSTOM) : float{ public function exhaust(float $amount, int $cause = PlayerExhaustEvent::CAUSE_CUSTOM) : float{
@ -336,7 +309,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** /**
* Returns the player's experience level. * Returns the player's experience level.
* @return int
*/ */
public function getXpLevel() : int{ public function getXpLevel() : int{
return (int) $this->attributeMap->getAttribute(Attribute::EXPERIENCE_LEVEL)->getValue(); return (int) $this->attributeMap->getAttribute(Attribute::EXPERIENCE_LEVEL)->getValue();
@ -344,10 +316,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** /**
* Sets the player's experience level. This does not affect their total XP or their XP progress. * Sets the player's experience level. This does not affect their total XP or their XP progress.
*
* @param int $level
*
* @return bool
*/ */
public function setXpLevel(int $level) : bool{ public function setXpLevel(int $level) : bool{
return $this->setXpAndProgress($level, null); return $this->setXpAndProgress($level, null);
@ -355,11 +323,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** /**
* Adds a number of XP levels to the player. * Adds a number of XP levels to the player.
*
* @param int $amount
* @param bool $playSound
*
* @return bool
*/ */
public function addXpLevels(int $amount, bool $playSound = true) : bool{ public function addXpLevels(int $amount, bool $playSound = true) : bool{
$oldLevel = $this->getXpLevel(); $oldLevel = $this->getXpLevel();
@ -379,10 +342,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** /**
* Subtracts a number of XP levels from the player. * Subtracts a number of XP levels from the player.
*
* @param int $amount
*
* @return bool
*/ */
public function subtractXpLevels(int $amount) : bool{ public function subtractXpLevels(int $amount) : bool{
return $this->addXpLevels(-$amount); return $this->addXpLevels(-$amount);
@ -390,7 +349,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** /**
* Returns a value between 0.0 and 1.0 to indicate how far through the current level the player is. * Returns a value between 0.0 and 1.0 to indicate how far through the current level the player is.
* @return float
*/ */
public function getXpProgress() : float{ public function getXpProgress() : float{
return $this->attributeMap->getAttribute(Attribute::EXPERIENCE)->getValue(); return $this->attributeMap->getAttribute(Attribute::EXPERIENCE)->getValue();
@ -398,10 +356,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** /**
* Sets the player's progress through the current level to a value between 0.0 and 1.0. * Sets the player's progress through the current level to a value between 0.0 and 1.0.
*
* @param float $progress
*
* @return bool
*/ */
public function setXpProgress(float $progress) : bool{ public function setXpProgress(float $progress) : bool{
return $this->setXpAndProgress(null, $progress); return $this->setXpAndProgress(null, $progress);
@ -409,7 +363,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** /**
* Returns the number of XP points the player has progressed into their current level. * Returns the number of XP points the player has progressed into their current level.
* @return int
*/ */
public function getRemainderXp() : int{ public function getRemainderXp() : int{
return (int) (ExperienceUtils::getXpToCompleteLevel($this->getXpLevel()) * $this->getXpProgress()); return (int) (ExperienceUtils::getXpToCompleteLevel($this->getXpLevel()) * $this->getXpProgress());
@ -419,8 +372,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
* Returns the amount of XP points the player currently has, calculated from their current level and progress * Returns the amount of XP points the player currently has, calculated from their current level and progress
* through their current level. This will be reduced by enchanting deducting levels and is used to calculate the * through their current level. This will be reduced by enchanting deducting levels and is used to calculate the
* amount of XP the player drops on death. * amount of XP the player drops on death.
*
* @return int
*/ */
public function getCurrentTotalXp() : int{ public function getCurrentTotalXp() : int{
return ExperienceUtils::getXpToReachLevel($this->getXpLevel()) + $this->getRemainderXp(); return ExperienceUtils::getXpToReachLevel($this->getXpLevel()) + $this->getRemainderXp();
@ -429,10 +380,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** /**
* Sets the current total of XP the player has, recalculating their XP level and progress. * Sets the current total of XP the player has, recalculating their XP level and progress.
* Note that this DOES NOT update the player's lifetime total XP. * Note that this DOES NOT update the player's lifetime total XP.
*
* @param int $amount
*
* @return bool
*/ */
public function setCurrentTotalXp(int $amount) : bool{ public function setCurrentTotalXp(int $amount) : bool{
$newLevel = ExperienceUtils::getLevelFromXp($amount); $newLevel = ExperienceUtils::getLevelFromXp($amount);
@ -444,10 +391,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
* Adds an amount of XP to the player, recalculating their XP level and progress. XP amount will be added to the * Adds an amount of XP to the player, recalculating their XP level and progress. XP amount will be added to the
* player's lifetime XP. * player's lifetime XP.
* *
* @param int $amount
* @param bool $playSound Whether to play level-up and XP gained sounds. * @param bool $playSound Whether to play level-up and XP gained sounds.
*
* @return bool
*/ */
public function addXp(int $amount, bool $playSound = true) : bool{ public function addXp(int $amount, bool $playSound = true) : bool{
$this->totalXp += $amount; $this->totalXp += $amount;
@ -478,10 +422,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** /**
* Takes an amount of XP from the player, recalculating their XP level and progress. * Takes an amount of XP from the player, recalculating their XP level and progress.
*
* @param int $amount
*
* @return bool
*/ */
public function subtractXp(int $amount) : bool{ public function subtractXp(int $amount) : bool{
return $this->addXp(-$amount); return $this->addXp(-$amount);
@ -514,8 +454,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** /**
* Returns the total XP the player has collected in their lifetime. Resets when the player dies. * Returns the total XP the player has collected in their lifetime. Resets when the player dies.
* XP levels being removed in enchanting do not reduce this number. * XP levels being removed in enchanting do not reduce this number.
*
* @return int
*/ */
public function getLifetimeTotalXp() : int{ public function getLifetimeTotalXp() : int{
return $this->totalXp; return $this->totalXp;
@ -524,8 +462,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** /**
* Sets the lifetime total XP of the player. This does not recalculate their level or progress. Used for player * Sets the lifetime total XP of the player. This does not recalculate their level or progress. Used for player
* score when they die. (TODO: add this when MCPE supports it) * score when they die. (TODO: add this when MCPE supports it)
*
* @param int $amount
*/ */
public function setLifetimeTotalXp(int $amount) : void{ public function setLifetimeTotalXp(int $amount) : void{
if($amount < 0){ if($amount < 0){
@ -537,7 +473,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** /**
* Returns whether the human can pickup XP orbs (checks cooldown time) * Returns whether the human can pickup XP orbs (checks cooldown time)
* @return bool
*/ */
public function canPickupXp() : bool{ public function canPickupXp() : bool{
return $this->xpCooldown === 0; return $this->xpCooldown === 0;
@ -581,8 +516,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** /**
* Sets the duration in ticks until the human can pick up another XP orb. * Sets the duration in ticks until the human can pick up another XP orb.
*
* @param int $value
*/ */
public function resetXpCooldown(int $value = 2) : void{ public function resetXpCooldown(int $value = 2) : void{
$this->xpCooldown = $value; $this->xpCooldown = $value;
@ -902,10 +835,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** /**
* Wrapper around {@link Entity#getDataFlag} for player-specific data flag reading. * Wrapper around {@link Entity#getDataFlag} for player-specific data flag reading.
*
* @param int $flagId
*
* @return bool
*/ */
public function getPlayerFlag(int $flagId) : bool{ public function getPlayerFlag(int $flagId) : bool{
return $this->getDataFlag(self::DATA_PLAYER_FLAGS, $flagId); return $this->getDataFlag(self::DATA_PLAYER_FLAGS, $flagId);
@ -913,9 +842,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** /**
* Wrapper around {@link Entity#setDataFlag} for player-specific data flag setting. * Wrapper around {@link Entity#setDataFlag} for player-specific data flag setting.
*
* @param int $flagId
* @param bool $value
*/ */
public function setPlayerFlag(int $flagId, bool $value = true) : void{ public function setPlayerFlag(int $flagId, bool $value = true) : void{
$this->setDataFlag(self::DATA_PLAYER_FLAGS, $flagId, $value, self::DATA_TYPE_BYTE); $this->setDataFlag(self::DATA_PLAYER_FLAGS, $flagId, $value, self::DATA_TYPE_BYTE);

View File

@ -213,8 +213,6 @@ abstract class Living extends Entity implements Damageable{
/** /**
* Removes the effect with the specified ID from the mob. * Removes the effect with the specified ID from the mob.
*
* @param int $effectId
*/ */
public function removeEffect(int $effectId) : void{ public function removeEffect(int $effectId) : void{
if(isset($this->effects[$effectId])){ if(isset($this->effects[$effectId])){
@ -240,10 +238,6 @@ abstract class Living extends Entity implements Damageable{
/** /**
* Returns the effect instance active on this entity with the specified ID, or null if the mob does not have the * Returns the effect instance active on this entity with the specified ID, or null if the mob does not have the
* effect. * effect.
*
* @param int $effectId
*
* @return EffectInstance|null
*/ */
public function getEffect(int $effectId) : ?EffectInstance{ public function getEffect(int $effectId) : ?EffectInstance{
return $this->effects[$effectId] ?? null; return $this->effects[$effectId] ?? null;
@ -251,10 +245,6 @@ abstract class Living extends Entity implements Damageable{
/** /**
* Returns whether the specified effect is active on the mob. * Returns whether the specified effect is active on the mob.
*
* @param int $effectId
*
* @return bool
*/ */
public function hasEffect(int $effectId) : bool{ public function hasEffect(int $effectId) : bool{
return isset($this->effects[$effectId]); return isset($this->effects[$effectId]);
@ -262,7 +252,6 @@ abstract class Living extends Entity implements Damageable{
/** /**
* Returns whether the mob has any active effects. * Returns whether the mob has any active effects.
* @return bool
*/ */
public function hasEffects() : bool{ public function hasEffects() : bool{
return count($this->effects) > 0; return count($this->effects) > 0;
@ -273,8 +262,6 @@ abstract class Living extends Entity implements Damageable{
* If a weaker effect of the same type is already applied, it will be replaced. * If a weaker effect of the same type is already applied, it will be replaced.
* If a weaker or equal-strength effect is already applied but has a shorter duration, it will be replaced. * If a weaker or equal-strength effect is already applied but has a shorter duration, it will be replaced.
* *
* @param EffectInstance $effect
*
* @return bool whether the effect has been successfully applied. * @return bool whether the effect has been successfully applied.
*/ */
public function addEffect(EffectInstance $effect) : bool{ public function addEffect(EffectInstance $effect) : bool{
@ -345,8 +332,6 @@ abstract class Living extends Entity implements Damageable{
/** /**
* Sends the mob's potion effects to the specified player. * Sends the mob's potion effects to the specified player.
*
* @param Player $player
*/ */
public function sendPotionEffects(Player $player) : void{ public function sendPotionEffects(Player $player) : void{
foreach($this->effects as $effect){ foreach($this->effects as $effect){
@ -373,10 +358,6 @@ abstract class Living extends Entity implements Damageable{
/** /**
* Causes the mob to consume the given Consumable object, applying applicable effects, health bonuses, food bonuses, * Causes the mob to consume the given Consumable object, applying applicable effects, health bonuses, food bonuses,
* etc. * etc.
*
* @param Consumable $consumable
*
* @return bool
*/ */
public function consumeObject(Consumable $consumable) : bool{ public function consumeObject(Consumable $consumable) : bool{
foreach($consumable->getAdditionalEffects() as $effect){ foreach($consumable->getAdditionalEffects() as $effect){
@ -390,7 +371,6 @@ abstract class Living extends Entity implements Damageable{
/** /**
* Returns the initial upwards velocity of a jumping entity in blocks/tick, including additional velocity due to effects. * Returns the initial upwards velocity of a jumping entity in blocks/tick, including additional velocity due to effects.
* @return float
*/ */
public function getJumpVelocity() : float{ public function getJumpVelocity() : float{
return $this->jumpVelocity + ($this->hasEffect(Effect::JUMP) ? ($this->getEffect(Effect::JUMP)->getEffectLevel() / 10) : 0); return $this->jumpVelocity + ($this->hasEffect(Effect::JUMP) ? ($this->getEffect(Effect::JUMP)->getEffectLevel() / 10) : 0);
@ -417,8 +397,6 @@ abstract class Living extends Entity implements Damageable{
* Returns how many armour points this mob has. Armour points provide a percentage reduction to damage. * Returns how many armour points this mob has. Armour points provide a percentage reduction to damage.
* For mobs which can wear armour, this should return the sum total of the armour points provided by their * For mobs which can wear armour, this should return the sum total of the armour points provided by their
* equipment. * equipment.
*
* @return int
*/ */
public function getArmorPoints() : int{ public function getArmorPoints() : int{
$total = 0; $total = 0;
@ -431,10 +409,6 @@ abstract class Living extends Entity implements Damageable{
/** /**
* Returns the highest level of the specified enchantment on any armour piece that the entity is currently wearing. * Returns the highest level of the specified enchantment on any armour piece that the entity is currently wearing.
*
* @param int $enchantmentId
*
* @return int
*/ */
public function getHighestArmorEnchantmentLevel(int $enchantmentId) : int{ public function getHighestArmorEnchantmentLevel(int $enchantmentId) : int{
$result = 0; $result = 0;
@ -445,9 +419,6 @@ abstract class Living extends Entity implements Damageable{
return $result; return $result;
} }
/**
* @return ArmorInventory
*/
public function getArmorInventory() : ArmorInventory{ public function getArmorInventory() : ArmorInventory{
return $this->armorInventory; return $this->armorInventory;
} }
@ -459,8 +430,6 @@ abstract class Living extends Entity implements Damageable{
/** /**
* Called prior to EntityDamageEvent execution to apply modifications to the event's damage, such as reduction due * Called prior to EntityDamageEvent execution to apply modifications to the event's damage, such as reduction due
* to effects or armour. * to effects or armour.
*
* @param EntityDamageEvent $source
*/ */
public function applyDamageModifiers(EntityDamageEvent $source) : void{ public function applyDamageModifiers(EntityDamageEvent $source) : void{
if($source->canBeReducedByArmor()){ if($source->canBeReducedByArmor()){
@ -488,8 +457,6 @@ abstract class Living extends Entity implements Damageable{
* Called after EntityDamageEvent execution to apply post-hurt effects, such as reducing absorption or modifying * Called after EntityDamageEvent execution to apply post-hurt effects, such as reducing absorption or modifying
* armour durability. * armour durability.
* This will not be called by damage sources causing death. * This will not be called by damage sources causing death.
*
* @param EntityDamageEvent $source
*/ */
protected function applyPostDamageEffects(EntityDamageEvent $source) : void{ protected function applyPostDamageEffects(EntityDamageEvent $source) : void{
$this->setAbsorption(max(0, $this->getAbsorption() + $source->getModifier(EntityDamageEvent::MODIFIER_ABSORPTION))); $this->setAbsorption(max(0, $this->getAbsorption() + $source->getModifier(EntityDamageEvent::MODIFIER_ABSORPTION)));
@ -519,8 +486,6 @@ abstract class Living extends Entity implements Damageable{
/** /**
* Damages the worn armour according to the amount of damage given. Each 4 points (rounded down) deals 1 damage * Damages the worn armour according to the amount of damage given. Each 4 points (rounded down) deals 1 damage
* point to each armour piece, but never less than 1 total. * point to each armour piece, but never less than 1 total.
*
* @param float $damage
*/ */
public function damageArmor(float $damage) : void{ public function damageArmor(float $damage) : void{
$durabilityRemoved = (int) max(floor($damage / 4), 1); $durabilityRemoved = (int) max(floor($damage / 4), 1);
@ -720,10 +685,6 @@ abstract class Living extends Entity implements Damageable{
/** /**
* Ticks the entity's air supply, consuming it when underwater and regenerating it when out of water. * Ticks the entity's air supply, consuming it when underwater and regenerating it when out of water.
*
* @param int $tickDiff
*
* @return bool
*/ */
protected function doAirSupplyTick(int $tickDiff) : bool{ protected function doAirSupplyTick(int $tickDiff) : bool{
$ticks = $this->getAirSupplyTicks(); $ticks = $this->getAirSupplyTicks();
@ -759,7 +720,6 @@ abstract class Living extends Entity implements Damageable{
/** /**
* Returns whether the entity can currently breathe. * Returns whether the entity can currently breathe.
* @return bool
*/ */
public function canBreathe() : bool{ public function canBreathe() : bool{
return $this->hasEffect(Effect::WATER_BREATHING) or $this->hasEffect(Effect::CONDUIT_POWER) or !$this->isUnderwater(); return $this->hasEffect(Effect::WATER_BREATHING) or $this->hasEffect(Effect::CONDUIT_POWER) or !$this->isUnderwater();
@ -767,7 +727,6 @@ abstract class Living extends Entity implements Damageable{
/** /**
* Returns whether the entity is currently breathing or not. If this is false, the entity's air supply will be used. * Returns whether the entity is currently breathing or not. If this is false, the entity's air supply will be used.
* @return bool
*/ */
public function isBreathing() : bool{ public function isBreathing() : bool{
return $this->getGenericFlag(self::DATA_FLAG_BREATHING); return $this->getGenericFlag(self::DATA_FLAG_BREATHING);
@ -776,8 +735,6 @@ abstract class Living extends Entity implements Damageable{
/** /**
* Sets whether the entity is currently breathing. If false, it will cause the entity's air supply to be used. * Sets whether the entity is currently breathing. If false, it will cause the entity's air supply to be used.
* For players, this also shows the oxygen bar. * For players, this also shows the oxygen bar.
*
* @param bool $value
*/ */
public function setBreathing(bool $value = true) : void{ public function setBreathing(bool $value = true) : void{
$this->setGenericFlag(self::DATA_FLAG_BREATHING, $value); $this->setGenericFlag(self::DATA_FLAG_BREATHING, $value);
@ -786,8 +743,6 @@ abstract class Living extends Entity implements Damageable{
/** /**
* Returns the number of ticks remaining in the entity's air supply. Note that the entity may survive longer than * Returns the number of ticks remaining in the entity's air supply. Note that the entity may survive longer than
* this amount of time without damage due to enchantments such as Respiration. * this amount of time without damage due to enchantments such as Respiration.
*
* @return int
*/ */
public function getAirSupplyTicks() : int{ public function getAirSupplyTicks() : int{
return $this->propertyManager->getShort(self::DATA_AIR); return $this->propertyManager->getShort(self::DATA_AIR);
@ -795,8 +750,6 @@ abstract class Living extends Entity implements Damageable{
/** /**
* Sets the number of air ticks left in the entity's air supply. * Sets the number of air ticks left in the entity's air supply.
*
* @param int $ticks
*/ */
public function setAirSupplyTicks(int $ticks) : void{ public function setAirSupplyTicks(int $ticks) : void{
$this->propertyManager->setShort(self::DATA_AIR, $ticks); $this->propertyManager->setShort(self::DATA_AIR, $ticks);
@ -804,7 +757,6 @@ abstract class Living extends Entity implements Damageable{
/** /**
* Returns the maximum amount of air ticks the entity's air supply can contain. * Returns the maximum amount of air ticks the entity's air supply can contain.
* @return int
*/ */
public function getMaxAirSupplyTicks() : int{ public function getMaxAirSupplyTicks() : int{
return $this->propertyManager->getShort(self::DATA_MAX_AIR); return $this->propertyManager->getShort(self::DATA_MAX_AIR);
@ -812,8 +764,6 @@ abstract class Living extends Entity implements Damageable{
/** /**
* Sets the maximum amount of air ticks the air supply can hold. * Sets the maximum amount of air ticks the air supply can hold.
*
* @param int $ticks
*/ */
public function setMaxAirSupplyTicks(int $ticks) : void{ public function setMaxAirSupplyTicks(int $ticks) : void{
$this->propertyManager->setShort(self::DATA_MAX_AIR, $ticks); $this->propertyManager->setShort(self::DATA_MAX_AIR, $ticks);
@ -837,17 +787,12 @@ abstract class Living extends Entity implements Damageable{
/** /**
* Returns the amount of XP this mob will drop on death. * Returns the amount of XP this mob will drop on death.
* @return int
*/ */
public function getXpDropAmount() : int{ public function getXpDropAmount() : int{
return 0; return 0;
} }
/** /**
* @param int $maxDistance
* @param int $maxLength
* @param array $transparent
*
* @return Block[] * @return Block[]
*/ */
public function getLineOfSight(int $maxDistance, int $maxLength = 0, array $transparent = []) : array{ public function getLineOfSight(int $maxDistance, int $maxLength = 0, array $transparent = []) : array{
@ -887,12 +832,6 @@ abstract class Living extends Entity implements Damageable{
return $blocks; return $blocks;
} }
/**
* @param int $maxDistance
* @param array $transparent
*
* @return Block|null
*/
public function getTargetBlock(int $maxDistance, array $transparent = []) : ?Block{ public function getTargetBlock(int $maxDistance, array $transparent = []) : ?Block{
$line = $this->getLineOfSight($maxDistance, 1, $transparent); $line = $this->getLineOfSight($maxDistance, 1, $transparent);
if(count($line) > 0){ if(count($line) > 0){
@ -905,8 +844,6 @@ abstract class Living extends Entity implements Damageable{
/** /**
* Changes the entity's yaw and pitch to make it look at the specified Vector3 position. For mobs, this will cause * Changes the entity's yaw and pitch to make it look at the specified Vector3 position. For mobs, this will cause
* their heads to turn. * their heads to turn.
*
* @param Vector3 $target
*/ */
public function lookAt(Vector3 $target) : void{ public function lookAt(Vector3 $target) : void{
$horizontal = sqrt(($target->x - $this->x) ** 2 + ($target->z - $this->z) ** 2); $horizontal = sqrt(($target->x - $this->x) ** 2 + ($target->z - $this->z) ** 2);

View File

@ -85,37 +85,22 @@ class Skin{
//TODO: validate geometry //TODO: validate geometry
} }
/**
* @return string
*/
public function getSkinId() : string{ public function getSkinId() : string{
return $this->skinId; return $this->skinId;
} }
/**
* @return string
*/
public function getSkinData() : string{ public function getSkinData() : string{
return $this->skinData; return $this->skinData;
} }
/**
* @return string
*/
public function getCapeData() : string{ public function getCapeData() : string{
return $this->capeData; return $this->capeData;
} }
/**
* @return string
*/
public function getGeometryName() : string{ public function getGeometryName() : string{
return $this->geometryName; return $this->geometryName;
} }
/**
* @return string
*/
public function getGeometryData() : string{ public function getGeometryData() : string{
return $this->geometryData; return $this->geometryData;
} }

View File

@ -59,8 +59,6 @@ class Villager extends Creature implements NPC, Ageable{
/** /**
* Sets the villager profession * Sets the villager profession
*
* @param int $profession
*/ */
public function setProfession(int $profession) : void{ public function setProfession(int $profession) : void{
$this->propertyManager->setInt(self::DATA_VARIANT, $profession); $this->propertyManager->setInt(self::DATA_VARIANT, $profession);

View File

@ -49,10 +49,6 @@ class ExperienceOrb extends Entity{
/** /**
* Returns the largest size of normal XP orb that will be spawned for the specified amount of XP. Used to split XP * Returns the largest size of normal XP orb that will be spawned for the specified amount of XP. Used to split XP
* up into multiple orbs when an amount of XP is dropped. * up into multiple orbs when an amount of XP is dropped.
*
* @param int $amount
*
* @return int
*/ */
public static function getMaxOrbSize(int $amount) : int{ public static function getMaxOrbSize(int $amount) : int{
foreach(self::ORB_SPLIT_SIZES as $split){ foreach(self::ORB_SPLIT_SIZES as $split){
@ -67,8 +63,6 @@ class ExperienceOrb extends Entity{
/** /**
* Splits the specified amount of XP into an array of acceptable XP orb sizes. * Splits the specified amount of XP into an array of acceptable XP orb sizes.
* *
* @param int $amount
*
* @return int[] * @return int[]
*/ */
public static function splitIntoOrbSizes(int $amount) : array{ public static function splitIntoOrbSizes(int $amount) : array{

View File

@ -134,9 +134,6 @@ class ItemEntity extends Entity{
} }
} }
/**
* @return Item
*/
public function getItem() : Item{ public function getItem() : Item{
return $this->item; return $this->item;
} }
@ -149,44 +146,26 @@ class ItemEntity extends Entity{
return false; return false;
} }
/**
* @return int
*/
public function getPickupDelay() : int{ public function getPickupDelay() : int{
return $this->pickupDelay; return $this->pickupDelay;
} }
/**
* @param int $delay
*/
public function setPickupDelay(int $delay) : void{ public function setPickupDelay(int $delay) : void{
$this->pickupDelay = $delay; $this->pickupDelay = $delay;
} }
/**
* @return string
*/
public function getOwner() : string{ public function getOwner() : string{
return $this->owner; return $this->owner;
} }
/**
* @param string $owner
*/
public function setOwner(string $owner) : void{ public function setOwner(string $owner) : void{
$this->owner = $owner; $this->owner = $owner;
} }
/**
* @return string
*/
public function getThrower() : string{ public function getThrower() : string{
return $this->thrower; return $this->thrower;
} }
/**
* @param string $thrower
*/
public function setThrower(string $thrower) : void{ public function setThrower(string $thrower) : void{
$this->thrower = $thrower; $this->thrower = $thrower;
} }

View File

@ -168,7 +168,6 @@ class Painting extends Entity{
/** /**
* Returns the painting motive (which image is displayed on the painting) * Returns the painting motive (which image is displayed on the painting)
* @return PaintingMotive
*/ */
public function getMotive() : PaintingMotive{ public function getMotive() : PaintingMotive{
return PaintingMotive::getMotiveByName($this->motive); return PaintingMotive::getMotiveByName($this->motive);
@ -180,12 +179,6 @@ class Painting extends Entity{
/** /**
* Returns the bounding-box a painting with the specified motive would have at the given position and direction. * Returns the bounding-box a painting with the specified motive would have at the given position and direction.
*
* @param Vector3 $blockIn
* @param int $facing
* @param PaintingMotive $motive
*
* @return AxisAlignedBB
*/ */
private static function getPaintingBB(Vector3 $blockIn, int $facing, PaintingMotive $motive) : AxisAlignedBB{ private static function getPaintingBB(Vector3 $blockIn, int $facing, PaintingMotive $motive) : AxisAlignedBB{
$width = $motive->getWidth(); $width = $motive->getWidth();
@ -241,14 +234,6 @@ class Painting extends Entity{
/** /**
* Returns whether a painting with the specified motive can be placed at the given position. * Returns whether a painting with the specified motive can be placed at the given position.
*
* @param Level $level
* @param Vector3 $blockIn
* @param int $facing
* @param bool $checkOverlap
* @param PaintingMotive $motive
*
* @return bool
*/ */
public static function canFit(Level $level, Vector3 $blockIn, int $facing, bool $checkOverlap, PaintingMotive $motive) : bool{ public static function canFit(Level $level, Vector3 $blockIn, int $facing, bool $checkOverlap, PaintingMotive $motive) : bool{
$width = $motive->getWidth(); $width = $motive->getWidth();

View File

@ -64,18 +64,10 @@ class PaintingMotive{
} }
} }
/**
* @param PaintingMotive $motive
*/
public static function registerMotive(PaintingMotive $motive) : void{ public static function registerMotive(PaintingMotive $motive) : void{
self::$motives[$motive->getName()] = $motive; self::$motives[$motive->getName()] = $motive;
} }
/**
* @param string $name
*
* @return PaintingMotive|null
*/
public static function getMotiveByName(string $name) : ?PaintingMotive{ public static function getMotiveByName(string $name) : ?PaintingMotive{
return self::$motives[$name] ?? null; return self::$motives[$name] ?? null;
} }
@ -101,23 +93,14 @@ class PaintingMotive{
$this->height = $height; $this->height = $height;
} }
/**
* @return string
*/
public function getName() : string{ public function getName() : string{
return $this->name; return $this->name;
} }
/**
* @return int
*/
public function getWidth() : int{ public function getWidth() : int{
return $this->width; return $this->width;
} }
/**
* @return int
*/
public function getHeight() : int{ public function getHeight() : int{
return $this->height; return $this->height;
} }

View File

@ -102,16 +102,10 @@ class Arrow extends Projectile{
} }
} }
/**
* @return float
*/
public function getPunchKnockback() : float{ public function getPunchKnockback() : float{
return $this->punchKnockback; return $this->punchKnockback;
} }
/**
* @param float $punchKnockback
*/
public function setPunchKnockback(float $punchKnockback) : void{ public function setPunchKnockback(float $punchKnockback) : void{
$this->punchKnockback = $punchKnockback; $this->punchKnockback = $punchKnockback;
} }
@ -157,16 +151,10 @@ class Arrow extends Projectile{
} }
} }
/**
* @return int
*/
public function getPickupMode() : int{ public function getPickupMode() : int{
return $this->pickupMode; return $this->pickupMode;
} }
/**
* @param int $pickupMode
*/
public function setPickupMode(int $pickupMode) : void{ public function setPickupMode(int $pickupMode) : void{
$this->pickupMode = $pickupMode; $this->pickupMode = $pickupMode;
} }

View File

@ -120,8 +120,6 @@ abstract class Projectile extends Entity{
/** /**
* Returns the base damage applied on collision. This is multiplied by the projectile's speed to give a result * Returns the base damage applied on collision. This is multiplied by the projectile's speed to give a result
* damage. * damage.
*
* @return float
*/ */
public function getBaseDamage() : float{ public function getBaseDamage() : float{
return $this->damage; return $this->damage;
@ -129,8 +127,6 @@ abstract class Projectile extends Entity{
/** /**
* Sets the base amount of damage applied by the projectile. * Sets the base amount of damage applied by the projectile.
*
* @param float $damage
*/ */
public function setBaseDamage(float $damage) : void{ public function setBaseDamage(float $damage) : void{
$this->damage = $damage; $this->damage = $damage;
@ -138,7 +134,6 @@ abstract class Projectile extends Entity{
/** /**
* Returns the amount of damage this projectile will deal to the entity it hits. * Returns the amount of damage this projectile will deal to the entity it hits.
* @return int
*/ */
public function getResultDamage() : int{ public function getResultDamage() : int{
return (int) ceil($this->motion->length() * $this->damage); return (int) ceil($this->motion->length() * $this->damage);
@ -279,10 +274,6 @@ abstract class Projectile extends Entity{
* This can be overridden by other projectiles to allow altering the blocks which are collided with (for example * This can be overridden by other projectiles to allow altering the blocks which are collided with (for example
* some projectiles collide with any non-air block). * some projectiles collide with any non-air block).
* *
* @param Block $block
* @param Vector3 $start
* @param Vector3 $end
*
* @return RayTraceResult|null the result of the ray trace if successful, or null if no interception is found. * @return RayTraceResult|null the result of the ray trace if successful, or null if no interception is found.
*/ */
protected function calculateInterceptWithBlock(Block $block, Vector3 $start, Vector3 $end) : ?RayTraceResult{ protected function calculateInterceptWithBlock(Block $block, Vector3 $start, Vector3 $end) : ?RayTraceResult{
@ -292,8 +283,6 @@ abstract class Projectile extends Entity{
/** /**
* Called when the projectile hits something. Override this to perform non-target-specific effects when the * Called when the projectile hits something. Override this to perform non-target-specific effects when the
* projectile hits something. * projectile hits something.
*
* @param ProjectileHitEvent $event
*/ */
protected function onHit(ProjectileHitEvent $event) : void{ protected function onHit(ProjectileHitEvent $event) : void{
@ -301,9 +290,6 @@ abstract class Projectile extends Entity{
/** /**
* Called when the projectile collides with an Entity. * Called when the projectile collides with an Entity.
*
* @param Entity $entityHit
* @param RayTraceResult $hitResult
*/ */
protected function onHitEntity(Entity $entityHit, RayTraceResult $hitResult) : void{ protected function onHitEntity(Entity $entityHit, RayTraceResult $hitResult) : void{
$damage = $this->getResultDamage(); $damage = $this->getResultDamage();
@ -331,9 +317,6 @@ abstract class Projectile extends Entity{
/** /**
* Called when the projectile collides with a Block. * Called when the projectile collides with a Block.
*
* @param Block $blockHit
* @param RayTraceResult $hitResult
*/ */
protected function onHitBlock(Block $blockHit, RayTraceResult $hitResult) : void{ protected function onHitBlock(Block $blockHit, RayTraceResult $hitResult) : void{
$this->blockHit = $blockHit->asVector3(); $this->blockHit = $blockHit->asVector3();

View File

@ -131,22 +131,17 @@ class SplashPotion extends Throwable{
/** /**
* Returns the meta value of the potion item that this splash potion corresponds to. This decides what effects will be applied to the entity when it collides with its target. * Returns the meta value of the potion item that this splash potion corresponds to. This decides what effects will be applied to the entity when it collides with its target.
* @return int
*/ */
public function getPotionId() : int{ public function getPotionId() : int{
return $this->propertyManager->getShort(self::DATA_POTION_AUX_VALUE) ?? 0; return $this->propertyManager->getShort(self::DATA_POTION_AUX_VALUE) ?? 0;
} }
/**
* @param int $id
*/
public function setPotionId(int $id) : void{ public function setPotionId(int $id) : void{
$this->propertyManager->setShort(self::DATA_POTION_AUX_VALUE, $id); $this->propertyManager->setShort(self::DATA_POTION_AUX_VALUE, $id);
} }
/** /**
* Returns whether this splash potion will create an area-effect cloud when it lands. * Returns whether this splash potion will create an area-effect cloud when it lands.
* @return bool
*/ */
public function willLinger() : bool{ public function willLinger() : bool{
return $this->getDataFlag(self::DATA_FLAGS, self::DATA_FLAG_LINGER); return $this->getDataFlag(self::DATA_FLAGS, self::DATA_FLAG_LINGER);
@ -154,8 +149,6 @@ class SplashPotion extends Throwable{
/** /**
* Sets whether this splash potion will create an area-effect-cloud when it lands. * Sets whether this splash potion will create an area-effect-cloud when it lands.
*
* @param bool $value
*/ */
public function setLinger(bool $value = true) : void{ public function setLinger(bool $value = true) : void{
$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_LINGER, $value); $this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_LINGER, $value);

View File

@ -30,10 +30,6 @@ abstract class ExperienceUtils{
/** /**
* Calculates and returns the amount of XP needed to get from level 0 to level $level * Calculates and returns the amount of XP needed to get from level 0 to level $level
*
* @param int $level
*
* @return int
*/ */
public static function getXpToReachLevel(int $level) : int{ public static function getXpToReachLevel(int $level) : int{
if($level <= 16){ if($level <= 16){
@ -47,10 +43,6 @@ abstract class ExperienceUtils{
/** /**
* Returns the amount of XP needed to reach $level + 1. * Returns the amount of XP needed to reach $level + 1.
*
* @param int $level
*
* @return int
*/ */
public static function getXpToCompleteLevel(int $level) : int{ public static function getXpToCompleteLevel(int $level) : int{
if($level <= 15){ if($level <= 15){
@ -65,10 +57,6 @@ abstract class ExperienceUtils{
/** /**
* Calculates and returns the number of XP levels the specified amount of XP points are worth. * Calculates and returns the number of XP levels the specified amount of XP points are worth.
* This returns a floating-point number, the decimal part being the progress through the resulting level. * This returns a floating-point number, the decimal part being the progress through the resulting level.
*
* @param int $xp
*
* @return float
*/ */
public static function getLevelFromXp(int $xp) : float{ public static function getLevelFromXp(int $xp) : float{
if($xp <= self::getXpToReachLevel(16)){ if($xp <= self::getXpToReachLevel(16)){

View File

@ -28,14 +28,9 @@ namespace pocketmine\event;
* Events that can be cancelled must use the interface Cancellable * Events that can be cancelled must use the interface Cancellable
*/ */
interface Cancellable{ interface Cancellable{
/**
* @return bool
*/
public function isCancelled() : bool; public function isCancelled() : bool;
/** /**
* @param bool $value
*
* @return void * @return void
*/ */
public function setCancelled(bool $value = true); public function setCancelled(bool $value = true);

View File

@ -39,16 +39,11 @@ abstract class Event{
/** @var bool */ /** @var bool */
private $isCancelled = false; private $isCancelled = false;
/**
* @return string
*/
final public function getEventName() : string{ final public function getEventName() : string{
return $this->eventName ?? get_class($this); return $this->eventName ?? get_class($this);
} }
/** /**
* @return bool
*
* @throws \BadMethodCallException * @throws \BadMethodCallException
*/ */
public function isCancelled() : bool{ public function isCancelled() : bool{
@ -60,8 +55,6 @@ abstract class Event{
} }
/** /**
* @param bool $value
*
* @throws \BadMethodCallException * @throws \BadMethodCallException
*/ */
public function setCancelled(bool $value = true) : void{ public function setCancelled(bool $value = true) : void{

View File

@ -76,10 +76,6 @@ abstract class EventPriority{
public const MONITOR = 0; public const MONITOR = 0;
/** /**
* @param string $name
*
* @return int
*
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public static function fromString(string $name) : int{ public static function fromString(string $name) : int{

View File

@ -61,9 +61,6 @@ class HandlerList{
* *
* Calling this method also lazily initializes the $classMap inheritance tree of handler lists. * Calling this method also lazily initializes the $classMap inheritance tree of handler lists.
* *
* @param string $event
*
* @return null|HandlerList
* @throws \ReflectionException * @throws \ReflectionException
*/ */
public static function getHandlerListFor(string $event) : ?HandlerList{ public static function getHandlerListFor(string $event) : ?HandlerList{
@ -112,8 +109,6 @@ class HandlerList{
} }
/** /**
* @param RegisteredListener $listener
*
* @throws \Exception * @throws \Exception
*/ */
public function register(RegisteredListener $listener) : void{ public function register(RegisteredListener $listener) : void{
@ -157,17 +152,12 @@ class HandlerList{
} }
/** /**
* @param int $priority
*
* @return RegisteredListener[] * @return RegisteredListener[]
*/ */
public function getListenersByPriority(int $priority) : array{ public function getListenersByPriority(int $priority) : array{
return $this->handlerSlots[$priority]; return $this->handlerSlots[$priority];
} }
/**
* @return null|HandlerList
*/
public function getParent() : ?HandlerList{ public function getParent() : ?HandlerList{
return $this->parentList; return $this->parentList;
} }

View File

@ -46,12 +46,7 @@ class BlockBreakEvent extends BlockEvent implements Cancellable{
protected $xpDrops; protected $xpDrops;
/** /**
* @param Player $player
* @param Block $block
* @param Item $item
* @param bool $instaBreak
* @param Item[] $drops * @param Item[] $drops
* @param int $xpDrops
*/ */
public function __construct(Player $player, Block $block, Item $item, bool $instaBreak = false, array $drops, int $xpDrops = 0){ public function __construct(Player $player, Block $block, Item $item, bool $instaBreak = false, array $drops, int $xpDrops = 0){
parent::__construct($block); parent::__construct($block);
@ -65,7 +60,6 @@ class BlockBreakEvent extends BlockEvent implements Cancellable{
/** /**
* Returns the player who is destroying the block. * Returns the player who is destroying the block.
* @return Player
*/ */
public function getPlayer() : Player{ public function getPlayer() : Player{
return $this->player; return $this->player;
@ -73,7 +67,6 @@ class BlockBreakEvent extends BlockEvent implements Cancellable{
/** /**
* Returns the item used to destroy the block. * Returns the item used to destroy the block.
* @return Item
*/ */
public function getItem() : Item{ public function getItem() : Item{
return $this->item; return $this->item;
@ -82,16 +75,11 @@ class BlockBreakEvent extends BlockEvent implements Cancellable{
/** /**
* Returns whether the block may be broken in less than the amount of time calculated. This is usually true for * Returns whether the block may be broken in less than the amount of time calculated. This is usually true for
* creative players. * creative players.
*
* @return bool
*/ */
public function getInstaBreak() : bool{ public function getInstaBreak() : bool{
return $this->instaBreak; return $this->instaBreak;
} }
/**
* @param bool $instaBreak
*/
public function setInstaBreak(bool $instaBreak) : void{ public function setInstaBreak(bool $instaBreak) : void{
$this->instaBreak = $instaBreak; $this->instaBreak = $instaBreak;
} }
@ -122,8 +110,6 @@ class BlockBreakEvent extends BlockEvent implements Cancellable{
/** /**
* Returns how much XP will be dropped by breaking this block. * Returns how much XP will be dropped by breaking this block.
*
* @return int
*/ */
public function getXpDropAmount() : int{ public function getXpDropAmount() : int{
return $this->xpDrops; return $this->xpDrops;
@ -131,8 +117,6 @@ class BlockBreakEvent extends BlockEvent implements Cancellable{
/** /**
* Sets how much XP will be dropped by breaking this block. * Sets how much XP will be dropped by breaking this block.
*
* @param int $amount
*/ */
public function setXpDropAmount(int $amount) : void{ public function setXpDropAmount(int $amount) : void{
if($amount < 0){ if($amount < 0){

View File

@ -40,7 +40,6 @@ class BlockBurnEvent extends BlockEvent implements Cancellable{
/** /**
* Returns the block (usually Fire) which caused the target block to be burned away. * Returns the block (usually Fire) which caused the target block to be burned away.
* @return Block
*/ */
public function getCausingBlock() : Block{ public function getCausingBlock() : Block{
return $this->causingBlock; return $this->causingBlock;

View File

@ -33,16 +33,10 @@ abstract class BlockEvent extends Event{
/** @var Block */ /** @var Block */
protected $block; protected $block;
/**
* @param Block $block
*/
public function __construct(Block $block){ public function __construct(Block $block){
$this->block = $block; $this->block = $block;
} }
/**
* @return Block
*/
public function getBlock() : Block{ public function getBlock() : Block{
return $this->block; return $this->block;
} }

View File

@ -38,9 +38,6 @@ class BlockGrowEvent extends BlockEvent implements Cancellable{
$this->newState = $newState; $this->newState = $newState;
} }
/**
* @return Block
*/
public function getNewState() : Block{ public function getNewState() : Block{
return $this->newState; return $this->newState;
} }

View File

@ -53,7 +53,6 @@ class BlockPlaceEvent extends BlockEvent implements Cancellable{
/** /**
* Returns the player who is placing the block. * Returns the player who is placing the block.
* @return Player
*/ */
public function getPlayer() : Player{ public function getPlayer() : Player{
return $this->player; return $this->player;
@ -61,22 +60,15 @@ class BlockPlaceEvent extends BlockEvent implements Cancellable{
/** /**
* Gets the item in hand * Gets the item in hand
* @return Item
*/ */
public function getItem() : Item{ public function getItem() : Item{
return $this->item; return $this->item;
} }
/**
* @return Block
*/
public function getBlockReplaced() : Block{ public function getBlockReplaced() : Block{
return $this->blockReplace; return $this->blockReplace;
} }
/**
* @return Block
*/
public function getBlockAgainst() : Block{ public function getBlockAgainst() : Block{
return $this->blockAgainst; return $this->blockAgainst;
} }

View File

@ -37,9 +37,6 @@ class BlockSpreadEvent extends BlockFormEvent{
$this->source = $source; $this->source = $source;
} }
/**
* @return Block
*/
public function getSource() : Block{ public function getSource() : Block{
return $this->source; return $this->source;
} }

View File

@ -38,8 +38,6 @@ class SignChangeEvent extends BlockEvent implements Cancellable{
private $lines = []; private $lines = [];
/** /**
* @param Block $theBlock
* @param Player $thePlayer
* @param string[] $theLines * @param string[] $theLines
*/ */
public function __construct(Block $theBlock, Player $thePlayer, array $theLines){ public function __construct(Block $theBlock, Player $thePlayer, array $theLines){
@ -48,9 +46,6 @@ class SignChangeEvent extends BlockEvent implements Cancellable{
$this->setLines($theLines); $this->setLines($theLines);
} }
/**
* @return Player
*/
public function getPlayer() : Player{ public function getPlayer() : Player{
return $this->player; return $this->player;
} }
@ -65,8 +60,6 @@ class SignChangeEvent extends BlockEvent implements Cancellable{
/** /**
* @param int $index 0-3 * @param int $index 0-3
* *
* @return string
*
* @throws \InvalidArgumentException if the index is out of bounds * @throws \InvalidArgumentException if the index is out of bounds
*/ */
public function getLine(int $index) : string{ public function getLine(int $index) : string{
@ -91,7 +84,6 @@ class SignChangeEvent extends BlockEvent implements Cancellable{
/** /**
* @param int $index 0-3 * @param int $index 0-3
* @param string $line
* *
* @throws \InvalidArgumentException if the index is out of bounds * @throws \InvalidArgumentException if the index is out of bounds
*/ */

View File

@ -42,16 +42,10 @@ class EntityBlockChangeEvent extends EntityEvent implements Cancellable{
$this->to = $to; $this->to = $to;
} }
/**
* @return Block
*/
public function getBlock() : Block{ public function getBlock() : Block{
return $this->from; return $this->from;
} }
/**
* @return Block
*/
public function getTo() : Block{ public function getTo() : Block{
return $this->to; return $this->to;
} }

View File

@ -30,19 +30,11 @@ class EntityCombustByBlockEvent extends EntityCombustEvent{
/** @var Block */ /** @var Block */
protected $combuster; protected $combuster;
/**
* @param Block $combuster
* @param Entity $combustee
* @param int $duration
*/
public function __construct(Block $combuster, Entity $combustee, int $duration){ public function __construct(Block $combuster, Entity $combustee, int $duration){
parent::__construct($combustee, $duration); parent::__construct($combustee, $duration);
$this->combuster = $combuster; $this->combuster = $combuster;
} }
/**
* @return Block
*/
public function getCombuster() : Block{ public function getCombuster() : Block{
return $this->combuster; return $this->combuster;
} }

View File

@ -29,19 +29,11 @@ class EntityCombustByEntityEvent extends EntityCombustEvent{
/** @var Entity */ /** @var Entity */
protected $combuster; protected $combuster;
/**
* @param Entity $combuster
* @param Entity $combustee
* @param int $duration
*/
public function __construct(Entity $combuster, Entity $combustee, int $duration){ public function __construct(Entity $combuster, Entity $combustee, int $duration){
parent::__construct($combustee, $duration); parent::__construct($combustee, $duration);
$this->combuster = $combuster; $this->combuster = $combuster;
} }
/**
* @return Entity
*/
public function getCombuster() : Entity{ public function getCombuster() : Entity{
return $this->combuster; return $this->combuster;
} }

View File

@ -30,10 +30,6 @@ class EntityCombustEvent extends EntityEvent implements Cancellable{
/** @var int */ /** @var int */
protected $duration; protected $duration;
/**
* @param Entity $combustee
* @param int $duration
*/
public function __construct(Entity $combustee, int $duration){ public function __construct(Entity $combustee, int $duration){
$this->entity = $combustee; $this->entity = $combustee;
$this->duration = $duration; $this->duration = $duration;
@ -41,7 +37,6 @@ class EntityCombustEvent extends EntityEvent implements Cancellable{
/** /**
* Returns the duration in seconds the entity will burn for. * Returns the duration in seconds the entity will burn for.
* @return int
*/ */
public function getDuration() : int{ public function getDuration() : int{
return $this->duration; return $this->duration;

View File

@ -34,10 +34,6 @@ class EntityDamageByBlockEvent extends EntityDamageEvent{
private $damager; private $damager;
/** /**
* @param Block $damager
* @param Entity $entity
* @param int $cause
* @param float $damage
* @param float[] $modifiers * @param float[] $modifiers
*/ */
public function __construct(Block $damager, Entity $entity, int $cause, float $damage, array $modifiers = []){ public function __construct(Block $damager, Entity $entity, int $cause, float $damage, array $modifiers = []){
@ -45,9 +41,6 @@ class EntityDamageByBlockEvent extends EntityDamageEvent{
parent::__construct($entity, $cause, $damage, $modifiers); parent::__construct($entity, $cause, $damage, $modifiers);
} }
/**
* @return Block
*/
public function getDamager() : Block{ public function getDamager() : Block{
return $this->damager; return $this->damager;
} }

View File

@ -33,11 +33,6 @@ class EntityDamageByChildEntityEvent extends EntityDamageByEntityEvent{
private $childEntityEid; private $childEntityEid;
/** /**
* @param Entity $damager
* @param Entity $childEntity
* @param Entity $entity
* @param int $cause
* @param float $damage
* @param float[] $modifiers * @param float[] $modifiers
*/ */
public function __construct(Entity $damager, Entity $childEntity, Entity $entity, int $cause, float $damage, array $modifiers = []){ public function __construct(Entity $damager, Entity $childEntity, Entity $entity, int $cause, float $damage, array $modifiers = []){
@ -47,8 +42,6 @@ class EntityDamageByChildEntityEvent extends EntityDamageByEntityEvent{
/** /**
* Returns the entity which caused the damage, or null if the entity has been killed or closed. * Returns the entity which caused the damage, or null if the entity has been killed or closed.
*
* @return Entity|null
*/ */
public function getChild() : ?Entity{ public function getChild() : ?Entity{
return $this->getEntity()->getLevel()->getServer()->findEntity($this->childEntityEid); return $this->getEntity()->getLevel()->getServer()->findEntity($this->childEntityEid);

View File

@ -37,12 +37,7 @@ class EntityDamageByEntityEvent extends EntityDamageEvent{
private $knockBack; private $knockBack;
/** /**
* @param Entity $damager
* @param Entity $entity
* @param int $cause
* @param float $damage
* @param float[] $modifiers * @param float[] $modifiers
* @param float $knockBack
*/ */
public function __construct(Entity $damager, Entity $entity, int $cause, float $damage, array $modifiers = [], float $knockBack = 0.4){ public function __construct(Entity $damager, Entity $entity, int $cause, float $damage, array $modifiers = [], float $knockBack = 0.4){
$this->damagerEntityId = $damager->getId(); $this->damagerEntityId = $damager->getId();
@ -65,23 +60,15 @@ class EntityDamageByEntityEvent extends EntityDamageEvent{
/** /**
* Returns the attacking entity, or null if the attacker has been killed or closed. * Returns the attacking entity, or null if the attacker has been killed or closed.
*
* @return Entity|null
*/ */
public function getDamager() : ?Entity{ public function getDamager() : ?Entity{
return $this->getEntity()->getLevel()->getServer()->findEntity($this->damagerEntityId); return $this->getEntity()->getLevel()->getServer()->findEntity($this->damagerEntityId);
} }
/**
* @return float
*/
public function getKnockBack() : float{ public function getKnockBack() : float{
return $this->knockBack; return $this->knockBack;
} }
/**
* @param float $knockBack
*/
public function setKnockBack(float $knockBack) : void{ public function setKnockBack(float $knockBack) : void{
$this->knockBack = $knockBack; $this->knockBack = $knockBack;
} }

View File

@ -75,9 +75,6 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
/** /**
* @param Entity $entity
* @param int $cause
* @param float $damage
* @param float[] $modifiers * @param float[] $modifiers
*/ */
public function __construct(Entity $entity, int $cause, float $damage, array $modifiers = []){ public function __construct(Entity $entity, int $cause, float $damage, array $modifiers = []){
@ -89,17 +86,12 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
$this->originals = $this->modifiers; $this->originals = $this->modifiers;
} }
/**
* @return int
*/
public function getCause() : int{ public function getCause() : int{
return $this->cause; return $this->cause;
} }
/** /**
* Returns the base amount of damage applied, before modifiers. * Returns the base amount of damage applied, before modifiers.
*
* @return float
*/ */
public function getBaseDamage() : float{ public function getBaseDamage() : float{
return $this->baseDamage; return $this->baseDamage;
@ -109,8 +101,6 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
* Sets the base amount of damage applied, optionally recalculating modifiers. * Sets the base amount of damage applied, optionally recalculating modifiers.
* *
* TODO: add ability to recalculate modifiers when this is set * TODO: add ability to recalculate modifiers when this is set
*
* @param float $damage
*/ */
public function setBaseDamage(float $damage) : void{ public function setBaseDamage(float $damage) : void{
$this->baseDamage = $damage; $this->baseDamage = $damage;
@ -118,8 +108,6 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
/** /**
* Returns the original base amount of damage applied, before alterations by plugins. * Returns the original base amount of damage applied, before alterations by plugins.
*
* @return float
*/ */
public function getOriginalBaseDamage() : float{ public function getOriginalBaseDamage() : float{
return $this->originalBase; return $this->originalBase;
@ -132,11 +120,6 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
return $this->originals; return $this->originals;
} }
/**
* @param int $type
*
* @return float
*/
public function getOriginalModifier(int $type) : float{ public function getOriginalModifier(int $type) : float{
return $this->originals[$type] ?? 0.0; return $this->originals[$type] ?? 0.0;
} }
@ -148,42 +131,24 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
return $this->modifiers; return $this->modifiers;
} }
/**
* @param int $type
*
* @return float
*/
public function getModifier(int $type) : float{ public function getModifier(int $type) : float{
return $this->modifiers[$type] ?? 0.0; return $this->modifiers[$type] ?? 0.0;
} }
/**
* @param float $damage
* @param int $type
*/
public function setModifier(float $damage, int $type) : void{ public function setModifier(float $damage, int $type) : void{
$this->modifiers[$type] = $damage; $this->modifiers[$type] = $damage;
} }
/**
* @param int $type
*
* @return bool
*/
public function isApplicable(int $type) : bool{ public function isApplicable(int $type) : bool{
return isset($this->modifiers[$type]); return isset($this->modifiers[$type]);
} }
/**
* @return float
*/
public function getFinalDamage() : float{ public function getFinalDamage() : float{
return $this->baseDamage + array_sum($this->modifiers); return $this->baseDamage + array_sum($this->modifiers);
} }
/** /**
* Returns whether an entity can use armour points to reduce this type of damage. * Returns whether an entity can use armour points to reduce this type of damage.
* @return bool
*/ */
public function canBeReducedByArmor() : bool{ public function canBeReducedByArmor() : bool{
switch($this->cause){ switch($this->cause){
@ -204,8 +169,6 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
/** /**
* Returns the cooldown in ticks before the target entity can be attacked again. * Returns the cooldown in ticks before the target entity can be attacked again.
*
* @return int
*/ */
public function getAttackCooldown() : int{ public function getAttackCooldown() : int{
return $this->attackCooldown; return $this->attackCooldown;
@ -215,8 +178,6 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
* Sets the cooldown in ticks before the target entity can be attacked again. * Sets the cooldown in ticks before the target entity can be attacked again.
* *
* NOTE: This value is not used in non-Living entities * NOTE: This value is not used in non-Living entities
*
* @param int $attackCooldown
*/ */
public function setAttackCooldown(int $attackCooldown) : void{ public function setAttackCooldown(int $attackCooldown) : void{
$this->attackCooldown = $attackCooldown; $this->attackCooldown = $attackCooldown;

View File

@ -31,7 +31,6 @@ class EntityDeathEvent extends EntityEvent{
private $drops = []; private $drops = [];
/** /**
* @param Living $entity
* @param Item[] $drops * @param Item[] $drops
*/ */
public function __construct(Living $entity, array $drops = []){ public function __construct(Living $entity, array $drops = []){

View File

@ -37,52 +37,31 @@ class EntityDespawnEvent extends EntityEvent{
/** @var int */ /** @var int */
private $entityType; private $entityType;
/**
* @param Entity $entity
*/
public function __construct(Entity $entity){ public function __construct(Entity $entity){
$this->entity = $entity; $this->entity = $entity;
$this->entityType = $entity::NETWORK_ID; $this->entityType = $entity::NETWORK_ID;
} }
/**
* @return int
*/
public function getType() : int{ public function getType() : int{
return $this->entityType; return $this->entityType;
} }
/**
* @return bool
*/
public function isCreature() : bool{ public function isCreature() : bool{
return $this->entity instanceof Creature; return $this->entity instanceof Creature;
} }
/**
* @return bool
*/
public function isHuman() : bool{ public function isHuman() : bool{
return $this->entity instanceof Human; return $this->entity instanceof Human;
} }
/**
* @return bool
*/
public function isProjectile() : bool{ public function isProjectile() : bool{
return $this->entity instanceof Projectile; return $this->entity instanceof Projectile;
} }
/**
* @return bool
*/
public function isVehicle() : bool{ public function isVehicle() : bool{
return $this->entity instanceof Vehicle; return $this->entity instanceof Vehicle;
} }
/**
* @return bool
*/
public function isItem() : bool{ public function isItem() : bool{
return $this->entity instanceof ItemEntity; return $this->entity instanceof ItemEntity;
} }

View File

@ -34,8 +34,6 @@ class EntityEffectAddEvent extends EntityEffectEvent{
private $oldEffect; private $oldEffect;
/** /**
* @param Entity $entity
* @param EffectInstance $effect
* @param EffectInstance $oldEffect * @param EffectInstance $oldEffect
*/ */
public function __construct(Entity $entity, EffectInstance $effect, EffectInstance $oldEffect = null){ public function __construct(Entity $entity, EffectInstance $effect, EffectInstance $oldEffect = null){
@ -45,23 +43,15 @@ class EntityEffectAddEvent extends EntityEffectEvent{
/** /**
* Returns whether the effect addition will replace an existing effect already applied to the entity. * Returns whether the effect addition will replace an existing effect already applied to the entity.
*
* @return bool
*/ */
public function willModify() : bool{ public function willModify() : bool{
return $this->hasOldEffect(); return $this->hasOldEffect();
} }
/**
* @return bool
*/
public function hasOldEffect() : bool{ public function hasOldEffect() : bool{
return $this->oldEffect instanceof EffectInstance; return $this->oldEffect instanceof EffectInstance;
} }
/**
* @return EffectInstance|null
*/
public function getOldEffect() : ?EffectInstance{ public function getOldEffect() : ?EffectInstance{
return $this->oldEffect; return $this->oldEffect;
} }

View File

@ -44,10 +44,7 @@ class EntityExplodeEvent extends EntityEvent implements Cancellable{
protected $yield; protected $yield;
/** /**
* @param Entity $entity
* @param Position $position
* @param Block[] $blocks * @param Block[] $blocks
* @param float $yield
*/ */
public function __construct(Entity $entity, Position $position, array $blocks, float $yield){ public function __construct(Entity $entity, Position $position, array $blocks, float $yield){
$this->entity = $entity; $this->entity = $entity;
@ -56,9 +53,6 @@ class EntityExplodeEvent extends EntityEvent implements Cancellable{
$this->yield = $yield; $this->yield = $yield;
} }
/**
* @return Position
*/
public function getPosition() : Position{ public function getPosition() : Position{
return $this->position; return $this->position;
} }
@ -77,16 +71,10 @@ class EntityExplodeEvent extends EntityEvent implements Cancellable{
$this->blocks = $blocks; $this->blocks = $blocks;
} }
/**
* @return float
*/
public function getYield() : float{ public function getYield() : float{
return $this->yield; return $this->yield;
} }
/**
* @param float $yield
*/
public function setYield(float $yield) : void{ public function setYield(float $yield) : void{
$this->yield = $yield; $this->yield = $yield;
} }

View File

@ -47,7 +47,6 @@ class EntityInventoryChangeEvent extends EntityEvent implements Cancellable{
/** /**
* Returns the inventory slot number affected by the event. * Returns the inventory slot number affected by the event.
* @return int
*/ */
public function getSlot() : int{ public function getSlot() : int{
return $this->slot; return $this->slot;
@ -55,22 +54,17 @@ class EntityInventoryChangeEvent extends EntityEvent implements Cancellable{
/** /**
* Returns the item which will be in the slot after the event. * Returns the item which will be in the slot after the event.
* @return Item
*/ */
public function getNewItem() : Item{ public function getNewItem() : Item{
return $this->newItem; return $this->newItem;
} }
/**
* @param Item $item
*/
public function setNewItem(Item $item) : void{ public function setNewItem(Item $item) : void{
$this->newItem = $item; $this->newItem = $item;
} }
/** /**
* Returns the item currently in the slot. * Returns the item currently in the slot.
* @return Item
*/ */
public function getOldItem() : Item{ public function getOldItem() : Item{
return $this->oldItem; return $this->oldItem;

View File

@ -36,9 +36,6 @@ class EntityMotionEvent extends EntityEvent implements Cancellable{
$this->mot = $mot; $this->mot = $mot;
} }
/**
* @return Vector3
*/
public function getVector() : Vector3{ public function getVector() : Vector3{
return $this->mot; return $this->mot;
} }

View File

@ -38,35 +38,22 @@ class EntityRegainHealthEvent extends EntityEvent implements Cancellable{
/** @var int */ /** @var int */
private $reason; private $reason;
/**
* @param Entity $entity
* @param float $amount
* @param int $regainReason
*/
public function __construct(Entity $entity, float $amount, int $regainReason){ public function __construct(Entity $entity, float $amount, int $regainReason){
$this->entity = $entity; $this->entity = $entity;
$this->amount = $amount; $this->amount = $amount;
$this->reason = $regainReason; $this->reason = $regainReason;
} }
/**
* @return float
*/
public function getAmount() : float{ public function getAmount() : float{
return $this->amount; return $this->amount;
} }
/**
* @param float $amount
*/
public function setAmount(float $amount) : void{ public function setAmount(float $amount) : void{
$this->amount = $amount; $this->amount = $amount;
} }
/** /**
* Returns one of the CAUSE_* constants to indicate why this regeneration occurred. * Returns one of the CAUSE_* constants to indicate why this regeneration occurred.
* @return int
*/ */
public function getRegainReason() : int{ public function getRegainReason() : int{
return $this->reason; return $this->reason;

View File

@ -38,12 +38,6 @@ class EntityShootBowEvent extends EntityEvent implements Cancellable{
/** @var float */ /** @var float */
private $force; private $force;
/**
* @param Living $shooter
* @param Item $bow
* @param Projectile $projectile
* @param float $force
*/
public function __construct(Living $shooter, Item $bow, Projectile $projectile, float $force){ public function __construct(Living $shooter, Item $bow, Projectile $projectile, float $force){
$this->entity = $shooter; $this->entity = $shooter;
$this->bow = $bow; $this->bow = $bow;
@ -58,9 +52,6 @@ class EntityShootBowEvent extends EntityEvent implements Cancellable{
return $this->entity; return $this->entity;
} }
/**
* @return Item
*/
public function getBow() : Item{ public function getBow() : Item{
return $this->bow; return $this->bow;
} }
@ -69,16 +60,11 @@ class EntityShootBowEvent extends EntityEvent implements Cancellable{
* Returns the entity considered as the projectile in this event. * Returns the entity considered as the projectile in this event.
* *
* NOTE: This might not return a Projectile if a plugin modified the target entity. * NOTE: This might not return a Projectile if a plugin modified the target entity.
*
* @return Entity
*/ */
public function getProjectile() : Entity{ public function getProjectile() : Entity{
return $this->projectile; return $this->projectile;
} }
/**
* @param Entity $projectile
*/
public function setProjectile(Entity $projectile) : void{ public function setProjectile(Entity $projectile) : void{
if($projectile !== $this->projectile){ if($projectile !== $this->projectile){
if(count($this->projectile->getViewers()) === 0){ if(count($this->projectile->getViewers()) === 0){
@ -88,16 +74,10 @@ class EntityShootBowEvent extends EntityEvent implements Cancellable{
} }
} }
/**
* @return float
*/
public function getForce() : float{ public function getForce() : float{
return $this->force; return $this->force;
} }
/**
* @param float $force
*/
public function setForce(float $force) : void{ public function setForce(float $force) : void{
$this->force = $force; $this->force = $force;
} }

View File

@ -38,59 +38,35 @@ class EntitySpawnEvent extends EntityEvent{
/** @var int */ /** @var int */
private $entityType; private $entityType;
/**
* @param Entity $entity
*/
public function __construct(Entity $entity){ public function __construct(Entity $entity){
$this->entity = $entity; $this->entity = $entity;
$this->entityType = $entity::NETWORK_ID; $this->entityType = $entity::NETWORK_ID;
} }
/**
* @return Position
*/
public function getPosition() : Position{ public function getPosition() : Position{
return $this->entity->getPosition(); return $this->entity->getPosition();
} }
/**
* @return int
*/
public function getType() : int{ public function getType() : int{
return $this->entityType; return $this->entityType;
} }
/**
* @return bool
*/
public function isCreature() : bool{ public function isCreature() : bool{
return $this->entity instanceof Creature; return $this->entity instanceof Creature;
} }
/**
* @return bool
*/
public function isHuman() : bool{ public function isHuman() : bool{
return $this->entity instanceof Human; return $this->entity instanceof Human;
} }
/**
* @return bool
*/
public function isProjectile() : bool{ public function isProjectile() : bool{
return $this->entity instanceof Projectile; return $this->entity instanceof Projectile;
} }
/**
* @return bool
*/
public function isVehicle() : bool{ public function isVehicle() : bool{
return $this->entity instanceof Vehicle; return $this->entity instanceof Vehicle;
} }
/**
* @return bool
*/
public function isItem() : bool{ public function isItem() : bool{
return $this->entity instanceof ItemEntity; return $this->entity instanceof ItemEntity;
} }

View File

@ -39,23 +39,14 @@ class EntityTeleportEvent extends EntityEvent implements Cancellable{
$this->to = $to; $this->to = $to;
} }
/**
* @return Position
*/
public function getFrom() : Position{ public function getFrom() : Position{
return $this->from; return $this->from;
} }
/**
* @return Position
*/
public function getTo() : Position{ public function getTo() : Position{
return $this->to; return $this->to;
} }
/**
* @param Position $to
*/
public function setTo(Position $to) : void{ public function setTo(Position $to) : void{
$this->to = $to; $this->to = $to;
} }

View File

@ -35,19 +35,12 @@ class ExplosionPrimeEvent extends EntityEvent implements Cancellable{
/** @var bool */ /** @var bool */
private $blockBreaking; private $blockBreaking;
/**
* @param Entity $entity
* @param float $force
*/
public function __construct(Entity $entity, float $force){ public function __construct(Entity $entity, float $force){
$this->entity = $entity; $this->entity = $entity;
$this->force = $force; $this->force = $force;
$this->blockBreaking = true; $this->blockBreaking = true;
} }
/**
* @return float
*/
public function getForce() : float{ public function getForce() : float{
return $this->force; return $this->force;
} }
@ -56,16 +49,10 @@ class ExplosionPrimeEvent extends EntityEvent implements Cancellable{
$this->force = $force; $this->force = $force;
} }
/**
* @return bool
*/
public function isBlockBreaking() : bool{ public function isBlockBreaking() : bool{
return $this->blockBreaking; return $this->blockBreaking;
} }
/**
* @param bool $affectsBlocks
*/
public function setBlockBreaking(bool $affectsBlocks) : void{ public function setBlockBreaking(bool $affectsBlocks) : void{
$this->blockBreaking = $affectsBlocks; $this->blockBreaking = $affectsBlocks;
} }

View File

@ -28,9 +28,6 @@ use pocketmine\event\Cancellable;
class ItemDespawnEvent extends EntityEvent implements Cancellable{ class ItemDespawnEvent extends EntityEvent implements Cancellable{
/**
* @param ItemEntity $item
*/
public function __construct(ItemEntity $item){ public function __construct(ItemEntity $item){
$this->entity = $item; $this->entity = $item;

View File

@ -27,9 +27,6 @@ use pocketmine\entity\object\ItemEntity;
class ItemSpawnEvent extends EntityEvent{ class ItemSpawnEvent extends EntityEvent{
/**
* @param ItemEntity $item
*/
public function __construct(ItemEntity $item){ public function __construct(ItemEntity $item){
$this->entity = $item; $this->entity = $item;

View File

@ -39,8 +39,6 @@ class ProjectileHitBlockEvent extends ProjectileHitEvent{
/** /**
* Returns the Block struck by the projectile. * Returns the Block struck by the projectile.
* Hint: to get the block face hit, look at the RayTraceResult. * Hint: to get the block face hit, look at the RayTraceResult.
*
* @return Block
*/ */
public function getBlockHit() : Block{ public function getBlockHit() : Block{
return $this->blockHit; return $this->blockHit;

View File

@ -38,8 +38,6 @@ class ProjectileHitEntityEvent extends ProjectileHitEvent{
/** /**
* Returns the Entity struck by the projectile. * Returns the Entity struck by the projectile.
*
* @return Entity
*/ */
public function getEntityHit() : Entity{ public function getEntityHit() : Entity{
return $this->entityHit; return $this->entityHit;

View File

@ -33,10 +33,6 @@ abstract class ProjectileHitEvent extends EntityEvent{
/** @var RayTraceResult */ /** @var RayTraceResult */
private $rayTraceResult; private $rayTraceResult;
/**
* @param Projectile $entity
* @param RayTraceResult $rayTraceResult
*/
public function __construct(Projectile $entity, RayTraceResult $rayTraceResult){ public function __construct(Projectile $entity, RayTraceResult $rayTraceResult){
$this->entity = $entity; $this->entity = $entity;
$this->rayTraceResult = $rayTraceResult; $this->rayTraceResult = $rayTraceResult;
@ -52,8 +48,6 @@ abstract class ProjectileHitEvent extends EntityEvent{
/** /**
* Returns a RayTraceResult object containing information such as the exact position struck, the AABB it hit, and * Returns a RayTraceResult object containing information such as the exact position struck, the AABB it hit, and
* the face of the AABB that it hit. * the face of the AABB that it hit.
*
* @return RayTraceResult
*/ */
public function getRayTraceResult() : RayTraceResult{ public function getRayTraceResult() : RayTraceResult{
return $this->rayTraceResult; return $this->rayTraceResult;

View File

@ -27,9 +27,6 @@ use pocketmine\entity\projectile\Projectile;
use pocketmine\event\Cancellable; use pocketmine\event\Cancellable;
class ProjectileLaunchEvent extends EntityEvent implements Cancellable{ class ProjectileLaunchEvent extends EntityEvent implements Cancellable{
/**
* @param Projectile $entity
*/
public function __construct(Projectile $entity){ public function __construct(Projectile $entity){
$this->entity = $entity; $this->entity = $entity;

View File

@ -43,9 +43,6 @@ class CraftItemEvent extends Event implements Cancellable{
private $outputs; private $outputs;
/** /**
* @param CraftingTransaction $transaction
* @param CraftingRecipe $recipe
* @param int $repetitions
* @param Item[] $inputs * @param Item[] $inputs
* @param Item[] $outputs * @param Item[] $outputs
*/ */
@ -59,8 +56,6 @@ class CraftItemEvent extends Event implements Cancellable{
/** /**
* Returns the inventory transaction involved in this crafting event. * Returns the inventory transaction involved in this crafting event.
*
* @return CraftingTransaction
*/ */
public function getTransaction() : CraftingTransaction{ public function getTransaction() : CraftingTransaction{
return $this->transaction; return $this->transaction;
@ -68,8 +63,6 @@ class CraftItemEvent extends Event implements Cancellable{
/** /**
* Returns the recipe crafted. * Returns the recipe crafted.
*
* @return CraftingRecipe
*/ */
public function getRecipe() : CraftingRecipe{ public function getRecipe() : CraftingRecipe{
return $this->recipe; return $this->recipe;
@ -78,8 +71,6 @@ class CraftItemEvent extends Event implements Cancellable{
/** /**
* Returns the number of times the recipe was crafted. This is usually 1, but might be more in the case of recipe * Returns the number of times the recipe was crafted. This is usually 1, but might be more in the case of recipe
* book shift-clicks (which craft lots of items in a batch). * book shift-clicks (which craft lots of items in a batch).
*
* @return int
*/ */
public function getRepetitions() : int{ public function getRepetitions() : int{
return $this->repetitions; return $this->repetitions;
@ -103,9 +94,6 @@ class CraftItemEvent extends Event implements Cancellable{
return $this->outputs; return $this->outputs;
} }
/**
* @return Player
*/
public function getPlayer() : Player{ public function getPlayer() : Player{
return $this->transaction->getSource(); return $this->transaction->getSource();
} }

View File

@ -38,11 +38,6 @@ class FurnaceBurnEvent extends BlockEvent implements Cancellable{
/** @var bool */ /** @var bool */
private $burning = true; private $burning = true;
/**
* @param Furnace $furnace
* @param Item $fuel
* @param int $burnTime
*/
public function __construct(Furnace $furnace, Item $fuel, int $burnTime){ public function __construct(Furnace $furnace, Item $fuel, int $burnTime){
parent::__construct($furnace->getBlock()); parent::__construct($furnace->getBlock());
$this->fuel = $fuel; $this->fuel = $fuel;
@ -50,44 +45,26 @@ class FurnaceBurnEvent extends BlockEvent implements Cancellable{
$this->furnace = $furnace; $this->furnace = $furnace;
} }
/**
* @return Furnace
*/
public function getFurnace() : Furnace{ public function getFurnace() : Furnace{
return $this->furnace; return $this->furnace;
} }
/**
* @return Item
*/
public function getFuel() : Item{ public function getFuel() : Item{
return $this->fuel; return $this->fuel;
} }
/**
* @return int
*/
public function getBurnTime() : int{ public function getBurnTime() : int{
return $this->burnTime; return $this->burnTime;
} }
/**
* @param int $burnTime
*/
public function setBurnTime(int $burnTime) : void{ public function setBurnTime(int $burnTime) : void{
$this->burnTime = $burnTime; $this->burnTime = $burnTime;
} }
/**
* @return bool
*/
public function isBurning() : bool{ public function isBurning() : bool{
return $this->burning; return $this->burning;
} }
/**
* @param bool $burning
*/
public function setBurning(bool $burning) : void{ public function setBurning(bool $burning) : void{
$this->burning = $burning; $this->burning = $burning;
} }

View File

@ -36,11 +36,6 @@ class FurnaceSmeltEvent extends BlockEvent implements Cancellable{
/** @var Item */ /** @var Item */
private $result; private $result;
/**
* @param Furnace $furnace
* @param Item $source
* @param Item $result
*/
public function __construct(Furnace $furnace, Item $source, Item $result){ public function __construct(Furnace $furnace, Item $source, Item $result){
parent::__construct($furnace->getBlock()); parent::__construct($furnace->getBlock());
$this->source = clone $source; $this->source = clone $source;
@ -49,30 +44,18 @@ class FurnaceSmeltEvent extends BlockEvent implements Cancellable{
$this->furnace = $furnace; $this->furnace = $furnace;
} }
/**
* @return Furnace
*/
public function getFurnace() : Furnace{ public function getFurnace() : Furnace{
return $this->furnace; return $this->furnace;
} }
/**
* @return Item
*/
public function getSource() : Item{ public function getSource() : Item{
return $this->source; return $this->source;
} }
/**
* @return Item
*/
public function getResult() : Item{ public function getResult() : Item{
return $this->result; return $this->result;
} }
/**
* @param Item $result
*/
public function setResult(Item $result) : void{ public function setResult(Item $result) : void{
$this->result = $result; $this->result = $result;
} }

View File

@ -30,18 +30,11 @@ class InventoryCloseEvent extends InventoryEvent{
/** @var Player */ /** @var Player */
private $who; private $who;
/**
* @param Inventory $inventory
* @param Player $who
*/
public function __construct(Inventory $inventory, Player $who){ public function __construct(Inventory $inventory, Player $who){
$this->who = $who; $this->who = $who;
parent::__construct($inventory); parent::__construct($inventory);
} }
/**
* @return Player
*/
public function getPlayer() : Player{ public function getPlayer() : Player{
return $this->who; return $this->who;
} }

View File

@ -38,9 +38,6 @@ abstract class InventoryEvent extends Event{
$this->inventory = $inventory; $this->inventory = $inventory;
} }
/**
* @return Inventory
*/
public function getInventory() : Inventory{ public function getInventory() : Inventory{
return $this->inventory; return $this->inventory;
} }

View File

@ -31,18 +31,11 @@ class InventoryOpenEvent extends InventoryEvent implements Cancellable{
/** @var Player */ /** @var Player */
private $who; private $who;
/**
* @param Inventory $inventory
* @param Player $who
*/
public function __construct(Inventory $inventory, Player $who){ public function __construct(Inventory $inventory, Player $who){
$this->who = $who; $this->who = $who;
parent::__construct($inventory); parent::__construct($inventory);
} }
/**
* @return Player
*/
public function getPlayer() : Player{ public function getPlayer() : Player{
return $this->who; return $this->who;
} }

View File

@ -31,18 +31,11 @@ class InventoryPickupArrowEvent extends InventoryEvent implements Cancellable{
/** @var Arrow */ /** @var Arrow */
private $arrow; private $arrow;
/**
* @param Inventory $inventory
* @param Arrow $arrow
*/
public function __construct(Inventory $inventory, Arrow $arrow){ public function __construct(Inventory $inventory, Arrow $arrow){
$this->arrow = $arrow; $this->arrow = $arrow;
parent::__construct($inventory); parent::__construct($inventory);
} }
/**
* @return Arrow
*/
public function getArrow() : Arrow{ public function getArrow() : Arrow{
return $this->arrow; return $this->arrow;
} }

View File

@ -31,18 +31,11 @@ class InventoryPickupItemEvent extends InventoryEvent implements Cancellable{
/** @var ItemEntity */ /** @var ItemEntity */
private $item; private $item;
/**
* @param Inventory $inventory
* @param ItemEntity $item
*/
public function __construct(Inventory $inventory, ItemEntity $item){ public function __construct(Inventory $inventory, ItemEntity $item){
$this->item = $item; $this->item = $item;
parent::__construct($inventory); parent::__construct($inventory);
} }
/**
* @return ItemEntity
*/
public function getItem() : ItemEntity{ public function getItem() : ItemEntity{
return $this->item; return $this->item;
} }

View File

@ -35,16 +35,10 @@ class InventoryTransactionEvent extends Event implements Cancellable{
/** @var InventoryTransaction */ /** @var InventoryTransaction */
private $transaction; private $transaction;
/**
* @param InventoryTransaction $transaction
*/
public function __construct(InventoryTransaction $transaction){ public function __construct(InventoryTransaction $transaction){
$this->transaction = $transaction; $this->transaction = $transaction;
} }
/**
* @return InventoryTransaction
*/
public function getTransaction() : InventoryTransaction{ public function getTransaction() : InventoryTransaction{
return $this->transaction; return $this->transaction;
} }

View File

@ -34,18 +34,11 @@ abstract class ChunkEvent extends LevelEvent{
/** @var Chunk */ /** @var Chunk */
private $chunk; private $chunk;
/**
* @param Level $level
* @param Chunk $chunk
*/
public function __construct(Level $level, Chunk $chunk){ public function __construct(Level $level, Chunk $chunk){
parent::__construct($level); parent::__construct($level);
$this->chunk = $chunk; $this->chunk = $chunk;
} }
/**
* @return Chunk
*/
public function getChunk() : Chunk{ public function getChunk() : Chunk{
return $this->chunk; return $this->chunk;
} }

View File

@ -39,9 +39,6 @@ class ChunkLoadEvent extends ChunkEvent{
$this->newChunk = $newChunk; $this->newChunk = $newChunk;
} }
/**
* @return bool
*/
public function isNewChunk() : bool{ public function isNewChunk() : bool{
return $this->newChunk; return $this->newChunk;
} }

View File

@ -33,16 +33,10 @@ abstract class LevelEvent extends Event{
/** @var Level */ /** @var Level */
private $level; private $level;
/**
* @param Level $level
*/
public function __construct(Level $level){ public function __construct(Level $level){
$this->level = $level; $this->level = $level;
} }
/**
* @return Level
*/
public function getLevel() : Level{ public function getLevel() : Level{
return $this->level; return $this->level;
} }

View File

@ -34,18 +34,11 @@ class SpawnChangeEvent extends LevelEvent{
/** @var Position */ /** @var Position */
private $previousSpawn; private $previousSpawn;
/**
* @param Level $level
* @param Position $previousSpawn
*/
public function __construct(Level $level, Position $previousSpawn){ public function __construct(Level $level, Position $previousSpawn){
parent::__construct($level); parent::__construct($level);
$this->previousSpawn = $previousSpawn; $this->previousSpawn = $previousSpawn;
} }
/**
* @return Position
*/
public function getPreviousSpawn() : Position{ public function getPreviousSpawn() : Position{
return $this->previousSpawn; return $this->previousSpawn;
} }

View File

@ -33,18 +33,11 @@ class PlayerAchievementAwardedEvent extends PlayerEvent implements Cancellable{
/** @var string */ /** @var string */
protected $achievement; protected $achievement;
/**
* @param Player $player
* @param string $achievementId
*/
public function __construct(Player $player, string $achievementId){ public function __construct(Player $player, string $achievementId){
$this->player = $player; $this->player = $player;
$this->achievement = $achievementId; $this->achievement = $achievementId;
} }
/**
* @return string
*/
public function getAchievement() : string{ public function getAchievement() : string{
return $this->achievement; return $this->achievement;
} }

View File

@ -33,18 +33,11 @@ class PlayerAnimationEvent extends PlayerEvent implements Cancellable{
/** @var int */ /** @var int */
private $animationType; private $animationType;
/**
* @param Player $player
* @param int $animation
*/
public function __construct(Player $player, int $animation){ public function __construct(Player $player, int $animation){
$this->player = $player; $this->player = $player;
$this->animationType = $animation; $this->animationType = $animation;
} }
/**
* @return int
*/
public function getAnimationType() : int{ public function getAnimationType() : int{
return $this->animationType; return $this->animationType;
} }

Some files were not shown because too many files have changed in this diff Show More