phpdoc armageddon for master, pass 1

This commit is contained in:
Dylan K. Taylor 2020-01-22 11:55:03 +00:00
parent 4bae3baa74
commit 67bcc1c0fb
397 changed files with 0 additions and 5391 deletions

View File

@ -174,33 +174,20 @@ class MemoryManager{
gc_enable(); gc_enable();
} }
/**
* @return bool
*/
public function isLowMemory() : bool{ public function isLowMemory() : bool{
return $this->lowMemory; return $this->lowMemory;
} }
/**
* @return int
*/
public function getGlobalMemoryLimit() : int{ public function getGlobalMemoryLimit() : int{
return $this->globalMemoryLimit; return $this->globalMemoryLimit;
} }
/**
* @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;
@ -208,11 +195,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
*/ */
public function trigger(int $memory, int $limit, bool $global = false, int $triggerCount = 0) : void{ public function trigger(int $memory, int $limit, bool $global = false, int $triggerCount = 0) : void{
$this->logger->debug(sprintf("%sLow memory triggered, limit %gMB, using %gMB", $this->logger->debug(sprintf("%sLow memory triggered, limit %gMB, using %gMB",
@ -280,9 +262,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();
@ -305,10 +284,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
*/ */
public function dumpServerMemory(string $outputFolder, int $maxNesting, int $maxStringSize) : void{ public function dumpServerMemory(string $outputFolder, int $maxNesting, int $maxStringSize) : void{
$logger = new \PrefixedLogger($this->server->getLogger(), "Memory Dump"); $logger = new \PrefixedLogger($this->server->getLogger(), "Memory Dump");
@ -327,10 +302,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
* *
* @throws \ReflectionException * @throws \ReflectionException
*/ */
@ -488,9 +459,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

@ -284,72 +284,42 @@ class Server{
/** @var Player[] */ /** @var Player[] */
private $playerList = []; private $playerList = [];
/**
* @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;
} }
@ -357,8 +327,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;
@ -366,40 +334,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";
@ -412,45 +366,29 @@ class Server{
return $this->serverID; return $this->serverID;
} }
/**
* @return GameMode
*/
public function getGamemode() : GameMode{ public function getGamemode() : GameMode{
return GameMode::fromMagicNumber($this->getConfigInt("gamemode", 0) & 0b11); return GameMode::fromMagicNumber($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 Server global difficulty. Note that this may be overridden in individual worlds. * Returns Server global difficulty. Note that this may be overridden in individual worlds.
* @return int
*/ */
public function getDifficulty() : int{ public function getDifficulty() : int{
return $this->getConfigInt("difficulty", World::DIFFICULTY_NORMAL); return $this->getConfigInt("difficulty", World::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 bool
*/
public function isHardcore() : bool{ public function isHardcore() : bool{
return $this->getConfigBool("hardcore", false); return $this->getConfigBool("hardcore", false);
} }
/**
* @return string
*/
public function getMotd() : string{ public function getMotd() : string{
return $this->getConfigString("motd", \pocketmine\NAME . " Server"); return $this->getConfigString("motd", \pocketmine\NAME . " Server");
} }
@ -490,16 +428,10 @@ class Server{
return $this->craftingManager; return $this->craftingManager;
} }
/**
* @return ResourcePackManager
*/
public function getResourcePackManager() : ResourcePackManager{ public function getResourcePackManager() : ResourcePackManager{
return $this->resourceManager; return $this->resourceManager;
} }
/**
* @return WorldManager
*/
public function getWorldManager() : WorldManager{ public function getWorldManager() : WorldManager{
return $this->worldManager; return $this->worldManager;
} }
@ -508,17 +440,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);
@ -526,8 +453,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);
@ -535,8 +460,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);
@ -544,16 +467,11 @@ 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);
} }
/**
* @return float
*/
public function getStartTime() : float{ public function getStartTime() : float{
return $this->startTime; return $this->startTime;
} }
@ -577,8 +495,6 @@ class Server{
} }
/** /**
* @param string $name
*
* @return OfflinePlayer|Player * @return OfflinePlayer|Player
*/ */
public function getOfflinePlayer(string $name){ public function getOfflinePlayer(string $name){
@ -594,21 +510,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|null
*/
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/";
@ -624,10 +531,6 @@ class Server{
return null; return null;
} }
/**
* @param string $name
* @param CompoundTag $nbtTag
*/
public function saveOfflinePlayerData(string $name, CompoundTag $nbtTag) : void{ public function saveOfflinePlayerData(string $name, CompoundTag $nbtTag) : void{
$ev = new PlayerDataSaveEvent($nbtTag, $name); $ev = new PlayerDataSaveEvent($nbtTag, $name);
$ev->setCancelled(!$this->shouldSavePlayerData()); $ev->setCancelled(!$this->shouldSavePlayerData());
@ -650,10 +553,6 @@ class Server{
* The closest match will be returned, or null if there are no online matches. * The closest match will be returned, or null if there are no online matches.
* *
* @see Server::getPlayerExact() * @see Server::getPlayerExact()
*
* @param string $name
*
* @return Player|null
*/ */
public function getPlayer(string $name) : ?Player{ public function getPlayer(string $name) : ?Player{
$found = null; $found = null;
@ -677,10 +576,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
*/ */
public function getPlayerExact(string $name) : ?Player{ public function getPlayerExact(string $name) : ?Player{
$name = strtolower($name); $name = strtolower($name);
@ -697,8 +592,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{
@ -718,10 +611,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;
@ -729,17 +618,12 @@ 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());
} }
/** /**
* @param string $variable
* @param mixed $defaultValue * @param mixed $defaultValue
* *
* @return mixed * @return mixed
@ -757,12 +641,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])){
@ -772,20 +650,10 @@ class Server{
return $this->properties->exists($variable) ? (string) $this->properties->get($variable) : $defaultValue; return $this->properties->exists($variable) ? (string) $this->properties->get($variable) : $defaultValue;
} }
/**
* @param string $variable
* @param string $value
*/
public function setConfigString(string $variable, string $value) : void{ public function setConfigString(string $variable, string $value) : void{
$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])){
@ -795,20 +663,10 @@ class Server{
return $this->properties->exists($variable) ? (int) $this->properties->get($variable) : $defaultValue; return $this->properties->exists($variable) ? (int) $this->properties->get($variable) : $defaultValue;
} }
/**
* @param string $variable
* @param int $value
*/
public function setConfigInt(string $variable, int $value) : void{ public function setConfigInt(string $variable, int $value) : void{
$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])){
@ -831,17 +689,11 @@ class Server{
return false; return false;
} }
/**
* @param string $variable
* @param bool $value
*/
public function setConfigBool(string $variable, bool $value) : void{ public function setConfigBool(string $variable, bool $value) : void{
$this->properties->set($variable, $value ? "1" : "0"); $this->properties->set($variable, $value ? "1" : "0");
} }
/** /**
* @param string $name
*
* @return PluginIdentifiableCommand|null * @return PluginIdentifiableCommand|null
*/ */
public function getPluginCommand(string $name){ public function getPluginCommand(string $name){
@ -866,9 +718,6 @@ class Server{
return $this->banByIP; return $this->banByIP;
} }
/**
* @param string $name
*/
public function addOp(string $name) : void{ public function addOp(string $name) : void{
$this->operators->set(strtolower($name), true); $this->operators->set(strtolower($name), true);
@ -878,9 +727,6 @@ class Server{
$this->operators->save(); $this->operators->save();
} }
/**
* @param string $name
*/
public function removeOp(string $name) : void{ public function removeOp(string $name) : void{
$this->operators->remove(strtolower($name)); $this->operators->remove(strtolower($name));
@ -890,36 +736,20 @@ class Server{
$this->operators->save(); $this->operators->save();
} }
/**
* @param string $name
*/
public function addWhitelist(string $name) : void{ public function addWhitelist(string $name) : void{
$this->whitelist->set(strtolower($name), true); $this->whitelist->set(strtolower($name), true);
$this->whitelist->save(); $this->whitelist->save();
} }
/**
* @param string $name
*/
public function removeWhitelist(string $name) : void{ public function removeWhitelist(string $name) : void{
$this->whitelist->remove(strtolower($name)); $this->whitelist->remove(strtolower($name));
$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);
} }
@ -960,9 +790,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");
@ -970,12 +797,6 @@ class Server{
return self::$instance; return self::$instance;
} }
/**
* @param \DynamicClassLoader $autoloader
* @param \AttachableThreadedLogger $logger
* @param string $dataPath
* @param string $pluginPath
*/
public function __construct(\DynamicClassLoader $autoloader, \AttachableThreadedLogger $logger, string $dataPath, string $pluginPath){ public function __construct(\DynamicClassLoader $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");
@ -1316,8 +1137,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)){
@ -1343,10 +1162,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{
$recipients = $recipients ?? $this->selectPermittedPlayers(self::BROADCAST_CHANNEL_USERS); $recipients = $recipients ?? $this->selectPermittedPlayers(self::BROADCAST_CHANNEL_USERS);
@ -1359,10 +1175,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{
$recipients = $recipients ?? $this->selectPermittedPlayers(self::BROADCAST_CHANNEL_USERS); $recipients = $recipients ?? $this->selectPermittedPlayers(self::BROADCAST_CHANNEL_USERS);
@ -1375,14 +1188,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{
$recipients = $recipients ?? $this->selectPermittedPlayers(self::BROADCAST_CHANNEL_USERS); $recipients = $recipients ?? $this->selectPermittedPlayers(self::BROADCAST_CHANNEL_USERS);
@ -1396,9 +1205,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 */
@ -1421,8 +1227,6 @@ class Server{
/** /**
* @param Player[] $players * @param Player[] $players
* @param ClientboundPacket[] $packets * @param ClientboundPacket[] $packets
*
* @return bool
*/ */
public function broadcastPackets(array $players, array $packets) : bool{ public function broadcastPackets(array $players, array $packets) : bool{
if(count($packets) === 0){ if(count($packets) === 0){
@ -1467,11 +1271,6 @@ class Server{
/** /**
* Broadcasts a list of packets in a batch to a list of players * Broadcasts a list of packets in a batch to a list of players
*
* @param PacketBatch $stream
* @param bool $forceSync
*
* @return CompressBatchPromise
*/ */
public function prepareBatch(PacketBatch $stream, bool $forceSync = false) : CompressBatchPromise{ public function prepareBatch(PacketBatch $stream, bool $forceSync = false) : CompressBatchPromise{
try{ try{
@ -1498,9 +1297,6 @@ class Server{
} }
} }
/**
* @param PluginLoadOrder $type
*/
public function enablePlugins(PluginLoadOrder $type) : void{ public function enablePlugins(PluginLoadOrder $type) : void{
foreach($this->pluginManager->getPlugins() as $plugin){ foreach($this->pluginManager->getPlugins() as $plugin){
if(!$plugin->isEnabled() and $plugin->getDescription()->getOrder()->equals($type)){ if(!$plugin->isEnabled() and $plugin->getDescription()->getOrder()->equals($type)){
@ -1516,12 +1312,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){
@ -1627,7 +1417,6 @@ class Server{
} }
/** /**
* @param \Throwable $e
* @param array|null $trace * @param array|null $trace
*/ */
public function exceptionHandler(\Throwable $e, $trace = null) : void{ public function exceptionHandler(\Throwable $e, $trace = null) : void{
@ -1799,9 +1588,6 @@ class Server{
return $this->language; return $this->language;
} }
/**
* @return bool
*/
public function isLanguageForced() : bool{ public function isLanguageForced() : bool{
return $this->forceLanguage; return $this->forceLanguage;
} }

View File

@ -120,7 +120,6 @@ class Banner extends Transparent{
/** /**
* TODO: interface method? this is only the BASE colour... * TODO: interface method? this is only the BASE colour...
* @return DyeColor
*/ */
public function getColor() : DyeColor{ public function getColor() : DyeColor{
return $this->baseColor; return $this->baseColor;

View File

@ -124,10 +124,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{
@ -137,8 +133,6 @@ abstract class BaseRail extends Flowable{
/** /**
* Returns the connection directions of this rail (depending on the current block state) * Returns the connection directions of this rail (depending on the current block state)
* *
* @param int $meta
*
* @return int[] * @return int[]
*/ */
abstract protected function getConnectionsFromMeta(int $meta) : ?array; abstract protected function getConnectionsFromMeta(int $meta) : ?array;

View File

@ -99,9 +99,6 @@ class Bed extends Transparent{
return $this->head; return $this->head;
} }
/**
* @return bool
*/
public function isOccupied() : bool{ public function isOccupied() : bool{
return $this->occupied; return $this->occupied;
} }
@ -116,16 +113,10 @@ class Bed extends Transparent{
} }
} }
/**
* @return int
*/
private function getOtherHalfSide() : int{ private function getOtherHalfSide() : int{
return $this->head ? Facing::opposite($this->facing) : $this->facing; return $this->head ? Facing::opposite($this->facing) : $this->facing;
} }
/**
* @return Bed|null
*/
public function getOtherHalf() : ?Bed{ public function getOtherHalf() : ?Bed{
$other = $this->getSide($this->getOtherHalfSide()); $other = $this->getSide($this->getOtherHalfSide());
if($other instanceof Bed and $other->head !== $this->head and $other->facing === $this->facing){ if($other instanceof Bed and $other->head !== $this->head and $other->facing === $this->facing){

View File

@ -68,9 +68,7 @@ class Block{
protected $collisionBoxes = null; protected $collisionBoxes = null;
/** /**
* @param BlockIdentifier $idInfo
* @param string $name English name of the block type (TODO: implement translations) * @param string $name English name of the block type (TODO: implement translations)
* @param BlockBreakInfo $breakInfo
*/ */
public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){ public function __construct(BlockIdentifier $idInfo, string $name, BlockBreakInfo $breakInfo){
if(($idInfo->getVariant() & $this->getStateBitmask()) !== 0){ if(($idInfo->getVariant() & $this->getStateBitmask()) !== 0){
@ -90,23 +88,16 @@ class Block{
return $this->idInfo; return $this->idInfo;
} }
/**
* @return string
*/
public function getName() : string{ public function getName() : string{
return $this->fallbackName; return $this->fallbackName;
} }
/**
* @return int
*/
public function getId() : int{ public function getId() : int{
return $this->idInfo->getBlockId(); return $this->idInfo->getBlockId();
} }
/** /**
* @internal * @internal
* @return int
*/ */
public function getFullId() : int{ public function getFullId() : int{
return ($this->getId() << 4) | $this->getMeta(); return ($this->getId() << 4) | $this->getMeta();
@ -118,26 +109,19 @@ class Block{
/** /**
* @internal * @internal
* @return int
*/ */
public function getRuntimeId() : int{ public function getRuntimeId() : int{
return RuntimeBlockMapping::toStaticRuntimeId($this->getId(), $this->getMeta()); return RuntimeBlockMapping::toStaticRuntimeId($this->getId(), $this->getMeta());
} }
/**
* @return int
*/
public function getMeta() : int{ public function getMeta() : int{
$stateMeta = $this->writeStateToMeta(); $stateMeta = $this->writeStateToMeta();
assert(($stateMeta & ~$this->getStateBitmask()) === 0); assert(($stateMeta & ~$this->getStateBitmask()) === 0);
return $this->idInfo->getVariant() | $stateMeta; return $this->idInfo->getVariant() | $stateMeta;
} }
/** /**
* Returns a bitmask used to extract state bits from block metadata. * Returns a bitmask used to extract state bits from block metadata.
*
* @return int
*/ */
public function getStateBitmask() : int{ public function getStateBitmask() : int{
return 0; return 0;
@ -148,9 +132,6 @@ class Block{
} }
/** /**
* @param int $id
* @param int $stateMeta
*
* @throws InvalidBlockStateException * @throws InvalidBlockStateException
*/ */
public function readStateFromData(int $id, int $stateMeta) : void{ public function readStateFromData(int $id, int $stateMeta) : void{
@ -191,10 +172,6 @@ class Block{
* *
* Note: This ignores additional IDs used to represent additional states. This means that, for example, a lit * Note: This ignores additional IDs used to represent additional states. This means that, for example, a lit
* furnace and unlit furnace are considered the same type. * furnace and unlit furnace are considered the same type.
*
* @param Block $other
*
* @return bool
*/ */
public function isSameType(Block $other) : bool{ public function isSameType(Block $other) : bool{
return $this->idInfo->getBlockId() === $other->idInfo->getBlockId() and $this->idInfo->getVariant() === $other->idInfo->getVariant(); return $this->idInfo->getBlockId() === $other->idInfo->getBlockId() and $this->idInfo->getVariant() === $other->idInfo->getVariant();
@ -202,10 +179,6 @@ class Block{
/** /**
* Returns whether the given block has the same type and properties as this block. * Returns whether the given block has the same type and properties as this block.
*
* @param Block $other
*
* @return bool
*/ */
public function isSameState(Block $other) : bool{ public function isSameState(Block $other) : bool{
return $this->isSameType($other) and $this->writeStateToMeta() === $other->writeStateToMeta(); return $this->isSameType($other) and $this->writeStateToMeta() === $other->writeStateToMeta();
@ -213,15 +186,11 @@ class Block{
/** /**
* 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;
} }
@ -232,16 +201,6 @@ class Block{
/** /**
* 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 BlockTransaction $tx
* @param Item $item
* @param Block $blockReplace
* @param Block $blockClicked
* @param int $face
* @param Vector3 $clickVector
* @param Player|null $player
*
* @return bool
*/ */
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{ public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
$tx->addBlock($blockReplace->pos, $this); $tx->addBlock($blockReplace->pos, $this);
@ -254,8 +213,6 @@ class Block{
/** /**
* Returns an object containing information about the destruction requirements of this block. * Returns an object containing information about the destruction requirements of this block.
*
* @return BlockBreakInfo
*/ */
public function getBreakInfo() : BlockBreakInfo{ public function getBreakInfo() : BlockBreakInfo{
return $this->breakInfo; return $this->breakInfo;
@ -263,11 +220,6 @@ class Block{
/** /**
* 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{
if(($t = $this->pos->getWorld()->getTile($this->pos)) !== null){ if(($t = $this->pos->getWorld()->getTile($this->pos)) !== null){
@ -286,8 +238,6 @@ class Block{
/** /**
* 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;
@ -310,13 +260,6 @@ class Block{
/** /**
* Do actions when interacted by Item. Returns if it has done anything * Do actions when interacted by Item. Returns if it has done anything
*
* @param Item $item
* @param int $face
* @param Vector3 $clickVector
* @param Player|null $player
*
* @return bool
*/ */
public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{ public function onInteract(Item $item, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
return false; return false;
@ -326,19 +269,12 @@ class Block{
* Called when this block is attacked (left-clicked). This is called when a player left-clicks the block to try and * Called when this block is attacked (left-clicked). This is called when a player left-clicks the block to try and
* start to break it in survival mode. * start to break it in survival mode.
* *
* @param Item $item
* @param int $face
* @param Player|null $player
*
* @return bool if an action took place, prevents starting to break the block if true. * @return bool if an action took place, prevents starting to break the block if true.
*/ */
public function onAttack(Item $item, int $face, ?Player $player = null) : bool{ public function onAttack(Item $item, int $face, ?Player $player = null) : bool{
return false; return false;
} }
/**
* @return float
*/
public function getFrictionFactor() : float{ public function getFrictionFactor() : float{
return 0.6; return 0.6;
} }
@ -366,16 +302,11 @@ class Block{
* 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;
} }
@ -386,7 +317,6 @@ class Block{
/** /**
* AKA: Block->isFlowable * AKA: Block->isFlowable
* @return bool
*/ */
public function canBeFlowedInto() : bool{ public function canBeFlowedInto() : bool{
return false; return false;
@ -398,7 +328,6 @@ class Block{
/** /**
* 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;
@ -415,11 +344,6 @@ class Block{
/** /**
* @internal * @internal
*
* @param World $world
* @param int $x
* @param int $y
* @param int $z
*/ */
final public function position(World $world, int $x, int $y, int $z) : void{ final public function position(World $world, int $x, int $y, int $z) : void{
$this->pos->x = $x; $this->pos->x = $x;
@ -431,8 +355,6 @@ class Block{
/** /**
* 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{
@ -450,8 +372,6 @@ class Block{
/** /**
* 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{
@ -461,8 +381,6 @@ class Block{
/** /**
* 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{
@ -471,10 +389,6 @@ class Block{
/** /**
* 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->breakInfo->isToolCompatible($item)){ if($item->hasEnchantment(Enchantment::SILK_TOUCH()) or !$this->breakInfo->isToolCompatible($item)){
@ -486,8 +400,6 @@ class Block{
/** /**
* 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;
@ -496,8 +408,6 @@ class Block{
/** /**
* 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;
@ -505,10 +415,6 @@ class Block{
/** /**
* 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.
*
* @param bool $addUserData
*
* @return Item
*/ */
public function getPickedItem(bool $addUserData = false) : Item{ public function getPickedItem(bool $addUserData = false) : Item{
$item = $this->asItem(); $item = $this->asItem();
@ -527,7 +433,6 @@ class Block{
/** /**
* 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;
@ -536,8 +441,6 @@ class Block{
/** /**
* 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;
@ -545,8 +448,6 @@ class Block{
/** /**
* 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;
@ -554,8 +455,6 @@ class Block{
/** /**
* 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;
@ -563,8 +462,6 @@ class Block{
/** /**
* 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;
@ -580,9 +477,6 @@ class Block{
/** /**
* 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){
@ -641,10 +535,6 @@ class Block{
/** /**
* 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){
@ -659,8 +549,6 @@ class Block{
/** /**
* Called when an entity's bounding box clips inside this block's cell. Note that the entity may not be intersecting * Called when an entity's bounding box clips inside this block's cell. Note that the entity may not be intersecting
* with the collision box or bounding box. * with the collision box or bounding box.
*
* @param Entity $entity
*/ */
public function onEntityInside(Entity $entity) : void{ public function onEntityInside(Entity $entity) : void{
@ -687,21 +575,12 @@ class Block{
return [AxisAlignedBB::one()]; return [AxisAlignedBB::one()];
} }
/**
* @return bool
*/
public function isFullCube() : bool{ public function isFullCube() : bool{
$bb = $this->getCollisionBoxes(); $bb = $this->getCollisionBoxes();
return count($bb) === 1 and $bb[0]->getAverageEdgeLength() >= 1; //TODO: average length 1 != cube return count($bb) === 1 and $bb[0]->getAverageEdgeLength() >= 1; //TODO: average length 1 != cube
} }
/**
* @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

@ -38,9 +38,6 @@ class BlockBreakInfo{
private $toolHarvestLevel; private $toolHarvestLevel;
/** /**
* @param float $hardness
* @param int $toolType
* @param int $toolHarvestLevel
* @param float|null $blastResistance default 5x hardness * @param float|null $blastResistance default 5x hardness
*/ */
public function __construct(float $hardness, int $toolType = BlockToolType::NONE, int $toolHarvestLevel = 0, ?float $blastResistance = null){ public function __construct(float $hardness, int $toolType = BlockToolType::NONE, int $toolHarvestLevel = 0, ?float $blastResistance = null){
@ -60,8 +57,6 @@ class BlockBreakInfo{
/** /**
* 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 $this->hardness; return $this->hardness;
@ -69,8 +64,6 @@ class BlockBreakInfo{
/** /**
* Returns whether the block can be broken at all. * Returns whether the block can be broken at all.
*
* @return bool
*/ */
public function isBreakable() : bool{ public function isBreakable() : bool{
return $this->hardness >= 0; return $this->hardness >= 0;
@ -78,8 +71,6 @@ class BlockBreakInfo{
/** /**
* Returns whether this block can be instantly broken. * Returns whether this block can be instantly broken.
*
* @return bool
*/ */
public function breaksInstantly() : bool{ public function breaksInstantly() : bool{
return $this->hardness == 0.0; return $this->hardness == 0.0;
@ -87,16 +78,11 @@ class BlockBreakInfo{
/** /**
* 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->blastResistance; return $this->blastResistance;
} }
/**
* @return int
*/
public function getToolType() : int{ public function getToolType() : int{
return $this->toolType; return $this->toolType;
} }
@ -110,8 +96,6 @@ class BlockBreakInfo{
* 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 $this->toolHarvestLevel; return $this->toolHarvestLevel;
@ -123,10 +107,6 @@ class BlockBreakInfo{
* *
* 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 isToolCompatible(Item $tool) : bool{ public function isToolCompatible(Item $tool) : bool{
if($this->hardness < 0){ if($this->hardness < 0){
@ -140,9 +120,6 @@ class BlockBreakInfo{
/** /**
* 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{

View File

@ -763,7 +763,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
@ -828,11 +827,6 @@ 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
*
* @return Block
*/ */
public static function get(int $id, int $meta = 0) : Block{ public static function get(int $id, int $meta = 0) : Block{
if($meta < 0 or $meta > 0xf){ if($meta < 0 or $meta > 0xf){
@ -863,11 +857,6 @@ class BlockFactory{
/** /**
* Returns whether a specified block state is already registered in the block factory. * Returns whether a specified block state is already registered in the block factory.
*
* @param int $id
* @param int $meta
*
* @return bool
*/ */
public static function isRegistered(int $id, int $meta = 0) : bool{ public static function isRegistered(int $id, int $meta = 0) : bool{
$b = self::$fullList[($id << 4) | $meta]; $b = self::$fullList[($id << 4) | $meta];

View File

@ -41,9 +41,6 @@ class BlockIdentifier{
$this->tileClass = $tileClass; $this->tileClass = $tileClass;
} }
/**
* @return int
*/
public function getBlockId() : int{ public function getBlockId() : int{
return $this->blockId; return $this->blockId;
} }
@ -55,23 +52,14 @@ class BlockIdentifier{
return [$this->blockId]; return [$this->blockId];
} }
/**
* @return int
*/
public function getVariant() : int{ public function getVariant() : int{
return $this->variant; return $this->variant;
} }
/**
* @return int
*/
public function getItemId() : int{ public function getItemId() : int{
return $this->itemId ?? ($this->blockId > 255 ? 255 - $this->blockId : $this->blockId); return $this->itemId ?? ($this->blockId > 255 ? 255 - $this->blockId : $this->blockId);
} }
/**
* @return string|null
*/
public function getTileClass() : ?string{ public function getTileClass() : ?string{
return $this->tileClass; return $this->tileClass;
} }

View File

@ -33,9 +33,6 @@ class BlockIdentifierFlattened extends BlockIdentifier{
$this->secondId = $secondId; $this->secondId = $secondId;
} }
/**
* @return int
*/
public function getSecondId() : int{ public function getSecondId() : int{
return $this->secondId; return $this->secondId;
} }

View File

@ -44,16 +44,10 @@ class ConcretePowder extends Opaque implements 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{
foreach(Facing::ALL as $i){ foreach(Facing::ALL as $i){
if($i === Facing::DOWN){ if($i === Facing::DOWN){

View File

@ -70,8 +70,6 @@ class DaylightSensor extends Transparent{
} }
/** /**
* @param bool $inverted
*
* @return $this * @return $this
*/ */
public function setInverted(bool $inverted = true) : self{ public function setInverted(bool $inverted = true) : self{

View File

@ -64,7 +64,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{
$other = $this->getSide($this->top ? Facing::DOWN : Facing::UP); $other = $this->getSide($this->top ? Facing::DOWN : Facing::UP);

View File

@ -39,23 +39,14 @@ class Element extends Opaque{
$this->symbol = $symbol; $this->symbol = $symbol;
} }
/**
* @return int
*/
public function getAtomicWeight() : int{ public function getAtomicWeight() : int{
return $this->atomicWeight; return $this->atomicWeight;
} }
/**
* @return int
*/
public function getGroup() : int{ public function getGroup() : int{
return $this->group; return $this->group;
} }
/**
* @return string
*/
public function getSymbol() : string{ public function getSymbol() : string{
return $this->symbol; return $this->symbol;
} }

View File

@ -77,16 +77,10 @@ class FlowerPot extends Flowable{
$tile->setPlant($this->plant); $tile->setPlant($this->plant);
} }
/**
* @return Block|null
*/
public function getPlant() : ?Block{ public function getPlant() : ?Block{
return $this->plant; return $this->plant;
} }
/**
* @param Block|null $plant
*/
public function setPlant(?Block $plant) : void{ public function setPlant(?Block $plant) : void{
if($plant === null or $plant instanceof Air){ if($plant === null or $plant instanceof Air){
$this->plant = null; $this->plant = null;

View File

@ -71,8 +71,6 @@ class Furnace extends Opaque{
} }
/** /**
* @param bool $lit
*
* @return $this * @return $this
*/ */
public function setLit(bool $lit = true) : self{ public function setLit(bool $lit = true) : self{

View File

@ -86,30 +86,18 @@ class ItemFrame extends Flowable{
return 0b111; return 0b111;
} }
/**
* @return int
*/
public function getFacing() : int{ public function getFacing() : int{
return $this->facing; return $this->facing;
} }
/**
* @param int $facing
*/
public function setFacing(int $facing) : void{ public function setFacing(int $facing) : void{
$this->facing = $facing; $this->facing = $facing;
} }
/**
* @return Item|null
*/
public function getFramedItem() : ?Item{ public function getFramedItem() : ?Item{
return $this->framedItem !== null ? clone $this->framedItem : null; return $this->framedItem !== null ? clone $this->framedItem : null;
} }
/**
* @param Item|null $item
*/
public function setFramedItem(?Item $item) : void{ public function setFramedItem(?Item $item) : void{
if($item === null or $item->isNull()){ if($item === null or $item->isNull()){
$this->framedItem = null; $this->framedItem = null;
@ -119,30 +107,18 @@ class ItemFrame extends Flowable{
} }
} }
/**
* @return int
*/
public function getItemRotation() : int{ public function getItemRotation() : int{
return $this->itemRotation; return $this->itemRotation;
} }
/**
* @param int $itemRotation
*/
public function setItemRotation(int $itemRotation) : void{ public function setItemRotation(int $itemRotation) : void{
$this->itemRotation = $itemRotation; $this->itemRotation = $itemRotation;
} }
/**
* @return float
*/
public function getItemDropChance() : float{ public function getItemDropChance() : float{
return $this->itemDropChance; return $this->itemDropChance;
} }
/**
* @param float $itemDropChance
*/
public function setItemDropChance(float $itemDropChance) : void{ public function setItemDropChance(float $itemDropChance) : void{
$this->itemDropChance = $itemDropChance; $this->itemDropChance = $itemDropChance;
} }

View File

@ -143,8 +143,6 @@ abstract class Liquid extends Transparent{
} }
/** /**
* @param bool $still
*
* @return $this * @return $this
*/ */
public function setStill(bool $still = true) : self{ public function setStill(bool $still = true) : self{
@ -247,8 +245,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

@ -48,15 +48,11 @@ class NetherPortal extends Transparent{
return 0b11; return 0b11;
} }
/**
* @return int
*/
public function getAxis() : int{ public function getAxis() : int{
return $this->axis; return $this->axis;
} }
/** /**
* @param int $axis
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public function setAxis(int $axis) : void{ public function setAxis(int $axis) : void{

View File

@ -58,16 +58,10 @@ class Note extends Opaque{
return 300; return 300;
} }
/**
* @return int
*/
public function getPitch() : int{ public function getPitch() : int{
return $this->pitch; return $this->pitch;
} }
/**
* @param int $pitch
*/
public function setPitch(int $pitch) : void{ public function setPitch(int $pitch) : void{
if($pitch < self::MIN_PITCH or $pitch > self::MAX_PITCH){ if($pitch < self::MIN_PITCH or $pitch > self::MAX_PITCH){
throw new \InvalidArgumentException("Pitch must be in range " . self::MIN_PITCH . " - " . self::MAX_PITCH); throw new \InvalidArgumentException("Pitch must be in range " . self::MIN_PITCH . " - " . self::MAX_PITCH);

View File

@ -87,7 +87,6 @@ class RedstoneComparator extends Flowable{
/** /**
* TODO: ad hoc, move to interface * TODO: ad hoc, move to interface
* @return int
*/ */
public function getFacing() : int{ public function getFacing() : int{
return $this->facing; return $this->facing;
@ -95,50 +94,31 @@ class RedstoneComparator extends Flowable{
/** /**
* TODO: ad hoc, move to interface * TODO: ad hoc, move to interface
* @param int $facing
*/ */
public function setFacing(int $facing) : void{ public function setFacing(int $facing) : void{
$this->facing = $facing; $this->facing = $facing;
} }
/**
* @return bool
*/
public function isSubtractMode() : bool{ public function isSubtractMode() : bool{
return $this->isSubtractMode; return $this->isSubtractMode;
} }
/**
* @param bool $isSubtractMode
*/
public function setSubtractMode(bool $isSubtractMode) : void{ public function setSubtractMode(bool $isSubtractMode) : void{
$this->isSubtractMode = $isSubtractMode; $this->isSubtractMode = $isSubtractMode;
} }
/**
* @return bool
*/
public function isPowered() : bool{ public function isPowered() : bool{
return $this->powered; return $this->powered;
} }
/**
* @param bool $powered
*/
public function setPowered(bool $powered) : void{ public function setPowered(bool $powered) : void{
$this->powered = $powered; $this->powered = $powered;
} }
/**
* @return int
*/
public function getSignalStrength() : int{ public function getSignalStrength() : int{
return $this->signalStrength; return $this->signalStrength;
} }
/**
* @param int $signalStrength
*/
public function setSignalStrength(int $signalStrength) : void{ public function setSignalStrength(int $signalStrength) : void{
$this->signalStrength = $signalStrength; $this->signalStrength = $signalStrength;
} }

View File

@ -48,8 +48,6 @@ class RedstoneLamp extends Opaque{
} }
/** /**
* @param bool $lit
*
* @return $this * @return $this
*/ */
public function setLit(bool $lit = true) : self{ public function setLit(bool $lit = true) : self{

View File

@ -54,8 +54,6 @@ class RedstoneOre extends Opaque{
} }
/** /**
* @param bool $lit
*
* @return $this * @return $this
*/ */
public function setLit(bool $lit = true) : self{ public function setLit(bool $lit = true) : self{

View File

@ -76,8 +76,6 @@ class RedstoneRepeater extends Flowable{
} }
/** /**
* @param bool $powered
*
* @return $this * @return $this
*/ */
public function setPowered(bool $powered = true) : self{ public function setPowered(bool $powered = true) : self{

View File

@ -49,8 +49,6 @@ class RedstoneTorch extends Torch{
} }
/** /**
* @param bool $lit
*
* @return $this * @return $this
*/ */
public function setLit(bool $lit = true) : self{ public function setLit(bool $lit = true) : self{

View File

@ -135,8 +135,6 @@ class Sign extends Transparent{
/** /**
* Returns an object containing information about the sign text. * Returns an object containing information about the sign text.
*
* @return SignText
*/ */
public function getText() : SignText{ public function getText() : SignText{
return $this->text; return $this->text;
@ -145,9 +143,6 @@ class Sign extends Transparent{
/** /**
* Called by the player controller (network session) to update the sign text, firing events as appropriate. * Called by the player controller (network session) to update the sign text, firing events as appropriate.
* *
* @param Player $author
* @param SignText $text
*
* @return bool if the sign update was successful. * @return bool if the sign update was successful.
* @throws \UnexpectedValueException if the text payload is too large * @throws \UnexpectedValueException if the text payload is too large
*/ */

View File

@ -83,9 +83,6 @@ class Skull extends Flowable{
$tile->setSkullType($this->skullType); $tile->setSkullType($this->skullType);
} }
/**
* @return SkullType
*/
public function getSkullType() : SkullType{ public function getSkullType() : SkullType{
return $this->skullType; return $this->skullType;
} }

View File

@ -72,16 +72,12 @@ class Slab extends Transparent{
/** /**
* Returns the type of slab block. * Returns the type of slab block.
*
* @return SlabType
*/ */
public function getSlabType() : SlabType{ public function getSlabType() : SlabType{
return $this->slabType; return $this->slabType;
} }
/** /**
* @param SlabType $slabType
*
* @return $this * @return $this
*/ */
public function setSlabType(SlabType $slabType) : self{ public function setSlabType(SlabType $slabType) : self{

View File

@ -675,11 +675,6 @@ final class VanillaBlocks{
self::_registryRegister($name, $block); self::_registryRegister($name, $block);
} }
/**
* @param string $name
*
* @return Block
*/
public static function fromString(string $name) : Block{ public static function fromString(string $name) : Block{
$result = self::_registryFromString($name); $result = self::_registryFromString($name);
assert($result instanceof Block); assert($result instanceof Block);

View File

@ -37,7 +37,6 @@ class Wood extends Opaque{
/** /**
* TODO: this is ad hoc, but add an interface for this to all tree-related blocks * TODO: this is ad hoc, but add an interface for this to all tree-related blocks
* @return TreeType
*/ */
public function getTreeType() : TreeType{ public function getTreeType() : TreeType{
return $this->treeType; return $this->treeType;

View File

@ -98,8 +98,6 @@ class Banner extends Spawnable{
/** /**
* Returns the color of the banner base. * Returns the color of the banner base.
*
* @return DyeColor
*/ */
public function getBaseColor() : DyeColor{ public function getBaseColor() : DyeColor{
return $this->baseColor; return $this->baseColor;
@ -107,8 +105,6 @@ class Banner extends Spawnable{
/** /**
* Sets the color of the banner base. * Sets the color of the banner base.
*
* @param DyeColor $color
*/ */
public function setBaseColor(DyeColor $color) : void{ public function setBaseColor(DyeColor $color) : void{
$this->baseColor = $color; $this->baseColor = $color;

View File

@ -163,9 +163,6 @@ class Chest extends Spawnable implements Container, Nameable{
} }
} }
/**
* @return string
*/
public function getDefaultName() : string{ public function getDefaultName() : string{
return "Chest"; return "Chest";
} }
@ -174,9 +171,6 @@ class Chest extends Spawnable implements Container, Nameable{
return $this->pairX !== null and $this->pairZ !== null; return $this->pairX !== null and $this->pairZ !== null;
} }
/**
* @return Chest|null
*/
public function getPair() : ?Chest{ public function getPair() : ?Chest{
if($this->isPaired()){ if($this->isPaired()){
$tile = $this->pos->getWorld()->getTileAt($this->pairX, $this->pos->y, $this->pairZ); $tile = $this->pos->getWorld()->getTileAt($this->pairX, $this->pos->y, $this->pairZ);

View File

@ -36,16 +36,10 @@ class Comparator extends Tile{
/** @var int */ /** @var int */
protected $signalStrength = 0; protected $signalStrength = 0;
/**
* @return int
*/
public function getSignalStrength() : int{ public function getSignalStrength() : int{
return $this->signalStrength; return $this->signalStrength;
} }
/**
* @param int $signalStrength
*/
public function setSignalStrength(int $signalStrength) : void{ public function setSignalStrength(int $signalStrength) : void{
$this->signalStrength = $signalStrength; $this->signalStrength = $signalStrength;
} }

View File

@ -37,10 +37,6 @@ interface Container extends InventoryHolder{
/** /**
* Returns whether this container can be opened by an item with the given custom name. * Returns whether this container can be opened by an item with the given custom name.
*
* @param string $key
*
* @return bool
*/ */
public function canOpenWith(string $key) : bool; public function canOpenWith(string $key) : bool;
} }

View File

@ -78,10 +78,6 @@ trait ContainerTrait{
/** /**
* @see Container::canOpenWith() * @see Container::canOpenWith()
*
* @param string $key
*
* @return bool
*/ */
public function canOpenWith(string $key) : bool{ public function canOpenWith(string $key) : bool{
return $this->lock === null or $this->lock === $key; return $this->lock === null or $this->lock === $key;
@ -89,7 +85,6 @@ trait ContainerTrait{
/** /**
* @see Position::asPosition() * @see Position::asPosition()
* @return Position
*/ */
abstract protected function getPos() : Position; abstract protected function getPos() : Position;

View File

@ -29,9 +29,6 @@ class EnchantTable extends Spawnable implements Nameable{
saveName as writeSaveData; saveName as writeSaveData;
} }
/**
* @return string
*/
public function getDefaultName() : string{ public function getDefaultName() : string{
return "Enchanting Table"; return "Enchanting Table";
} }

View File

@ -90,9 +90,6 @@ class Furnace extends Spawnable implements Container, Nameable{
$this->saveItems($nbt); $this->saveItems($nbt);
} }
/**
* @return string
*/
public function getDefaultName() : string{ public function getDefaultName() : string{
return "Furnace"; return "Furnace";
} }

View File

@ -26,23 +26,11 @@ namespace pocketmine\block\tile;
interface Nameable{ interface Nameable{
public const TAG_CUSTOM_NAME = "CustomName"; public const TAG_CUSTOM_NAME = "CustomName";
/**
* @return string
*/
public function getDefaultName() : string; public function getDefaultName() : string;
/**
* @return string
*/
public function getName() : string; public function getName() : string;
/**
* @param string $str
*/
public function setName(string $str) : void; public function setName(string $str) : void;
/**
* @return bool
*/
public function hasName() : bool; public function hasName() : bool;
} }

View File

@ -34,21 +34,12 @@ trait NameableTrait{
/** @var string|null */ /** @var string|null */
private $customName = null; private $customName = null;
/**
* @return string
*/
abstract public function getDefaultName() : string; abstract public function getDefaultName() : string;
/**
* @return string
*/
public function getName() : string{ public function getName() : string{
return $this->customName ?? $this->getDefaultName(); return $this->customName ?? $this->getDefaultName();
} }
/**
* @param string $name
*/
public function setName(string $name) : void{ public function setName(string $name) : void{
if($name === ""){ if($name === ""){
$this->customName = null; $this->customName = null;
@ -57,9 +48,6 @@ trait NameableTrait{
} }
} }
/**
* @return bool
*/
public function hasName() : bool{ public function hasName() : bool{
return $this->customName !== null; return $this->customName !== null;
} }
@ -83,7 +71,6 @@ trait NameableTrait{
} }
/** /**
* @param Item $item
* @see Tile::copyDataFromItem() * @see Tile::copyDataFromItem()
*/ */
public function copyDataFromItem(Item $item) : void{ public function copyDataFromItem(Item $item) : void{

View File

@ -43,16 +43,10 @@ class Note extends Tile{
$nbt->setByte("note", $this->pitch); $nbt->setByte("note", $this->pitch);
} }
/**
* @return int
*/
public function getPitch() : int{ public function getPitch() : int{
return $this->pitch; return $this->pitch;
} }
/**
* @param int $pitch
*/
public function setPitch(int $pitch) : void{ public function setPitch(int $pitch) : void{
if($pitch < BlockNote::MIN_PITCH or $pitch > BlockNote::MAX_PITCH){ if($pitch < BlockNote::MIN_PITCH or $pitch > BlockNote::MAX_PITCH){
throw new \InvalidArgumentException("Pitch must be in range " . BlockNote::MIN_PITCH . " - " . BlockNote::MAX_PITCH); throw new \InvalidArgumentException("Pitch must be in range " . BlockNote::MIN_PITCH . " - " . BlockNote::MAX_PITCH);

View File

@ -78,16 +78,10 @@ class Sign extends Spawnable{
} }
} }
/**
* @return SignText
*/
public function getText() : SignText{ public function getText() : SignText{
return $this->text; return $this->text;
} }
/**
* @param SignText $text
*/
public function setText(SignText $text) : void{ public function setText(SignText $text) : void{
$this->text = $text; $this->text = $text;
} }

View File

@ -39,16 +39,11 @@ abstract class Spawnable extends Tile{
/** /**
* Returns whether the tile needs to be respawned to viewers. * Returns whether the tile needs to be respawned to viewers.
*
* @return bool
*/ */
public function isDirty() : bool{ public function isDirty() : bool{
return $this->dirty; return $this->dirty;
} }
/**
* @param bool $dirty
*/
public function setDirty(bool $dirty = true) : void{ public function setDirty(bool $dirty = true) : void{
if($dirty){ if($dirty){
$this->spawnCompoundCache = null; $this->spawnCompoundCache = null;
@ -74,9 +69,6 @@ abstract class Spawnable extends Tile{
return $this->spawnCompoundCache; return $this->spawnCompoundCache;
} }
/**
* @return CompoundTag
*/
final public function getSpawnCompound() : CompoundTag{ final public function getSpawnCompound() : CompoundTag{
$nbt = CompoundTag::create() $nbt = CompoundTag::create()
->setString(self::TAG_ID, TileFactory::getSaveId(get_class($this))) //TODO: disassociate network ID from save ID ->setString(self::TAG_ID, TileFactory::getSaveId(get_class($this))) //TODO: disassociate network ID from save ID
@ -90,8 +82,6 @@ abstract class Spawnable extends Tile{
/** /**
* An extension to getSpawnCompound() for * An extension to getSpawnCompound() for
* further modifying the generic tile NBT. * further modifying the generic tile NBT.
*
* @param CompoundTag $nbt
*/ */
abstract protected function addAdditionalSpawnData(CompoundTag $nbt) : void; abstract protected function addAdditionalSpawnData(CompoundTag $nbt) : void;
} }

View File

@ -59,15 +59,11 @@ abstract class Tile{
/** /**
* @internal * @internal
* Reads additional data from the CompoundTag on tile creation. * Reads additional data from the CompoundTag on tile creation.
*
* @param CompoundTag $nbt
*/ */
abstract public function readSaveData(CompoundTag $nbt) : void; abstract public function readSaveData(CompoundTag $nbt) : void;
/** /**
* Writes additional save data to a CompoundTag, not including generic things like ID and coordinates. * Writes additional save data to a CompoundTag, not including generic things like ID and coordinates.
*
* @param CompoundTag $nbt
*/ */
abstract protected function writeSaveData(CompoundTag $nbt) : void; abstract protected function writeSaveData(CompoundTag $nbt) : void;
@ -90,8 +86,6 @@ abstract class Tile{
/** /**
* @internal * @internal
* *
* @param Item $item
*
* @throws \RuntimeException * @throws \RuntimeException
*/ */
public function copyDataFromItem(Item $item) : void{ public function copyDataFromItem(Item $item) : void{
@ -100,16 +94,10 @@ abstract class Tile{
} }
} }
/**
* @return Block
*/
public function getBlock() : Block{ public function getBlock() : Block{
return $this->pos->getWorld()->getBlock($this->pos); return $this->pos->getWorld()->getBlock($this->pos);
} }
/**
* @return Position
*/
public function getPos() : Position{ public function getPos() : Position{
return $this->pos; return $this->pos;
} }

View File

@ -89,7 +89,6 @@ final class TileFactory{
} }
/** /**
* @param string $className
* @param string[] $saveNames * @param string[] $saveNames
*/ */
public static function register(string $className, array $saveNames = []) : void{ public static function register(string $className, array $saveNames = []) : void{
@ -125,10 +124,6 @@ final class TileFactory{
} }
/** /**
* @param string $baseClass
* @param World $world
* @param Vector3 $pos
*
* @return Tile (will be an instanceof $baseClass) * @return Tile (will be an instanceof $baseClass)
* @throws \InvalidArgumentException if the specified class is not a registered tile * @throws \InvalidArgumentException if the specified class is not a registered tile
*/ */
@ -149,12 +144,7 @@ final class TileFactory{
} }
/** /**
* @param World $world
* @param CompoundTag $nbt
*
* @return Tile|null
*@internal *@internal
*
*/ */
public static function createFromData(World $world, CompoundTag $nbt) : ?Tile{ public static function createFromData(World $world, CompoundTag $nbt) : ?Tile{
$type = $nbt->getString(Tile::TAG_ID, "", true); $type = $nbt->getString(Tile::TAG_ID, "", true);

View File

@ -79,16 +79,10 @@ class BannerPattern{
$this->color = $color; $this->color = $color;
} }
/**
* @return string
*/
public function getId() : string{ public function getId() : string{
return $this->id; return $this->id;
} }
/**
* @return DyeColor
*/
public function getColor() : DyeColor{ public function getColor() : DyeColor{
return $this->color; return $this->color;
} }

View File

@ -32,9 +32,6 @@ final class BlockDataSerializer{
} }
/** /**
* @param int $raw
*
* @return int
* @throws InvalidBlockStateException * @throws InvalidBlockStateException
*/ */
public static function readFacing(int $raw) : int{ public static function readFacing(int $raw) : int{
@ -68,9 +65,6 @@ final class BlockDataSerializer{
} }
/** /**
* @param int $facing
*
* @return int
* @throws InvalidBlockStateException * @throws InvalidBlockStateException
*/ */
public static function readHorizontalFacing(int $facing) : int{ public static function readHorizontalFacing(int $facing) : int{
@ -89,9 +83,6 @@ final class BlockDataSerializer{
} }
/** /**
* @param int $raw
*
* @return int
* @throws InvalidBlockStateException * @throws InvalidBlockStateException
*/ */
public static function readLegacyHorizontalFacing(int $raw) : int{ public static function readLegacyHorizontalFacing(int $raw) : int{
@ -121,9 +112,6 @@ final class BlockDataSerializer{
} }
/** /**
* @param int $value
*
* @return int
* @throws InvalidBlockStateException * @throws InvalidBlockStateException
*/ */
public static function read5MinusHorizontalFacing(int $value) : int{ public static function read5MinusHorizontalFacing(int $value) : int{

View File

@ -87,10 +87,8 @@ final class DyeColor{
* Returns a DyeColor object matching the given magic number * Returns a DyeColor object matching the given magic number
* @internal * @internal
* *
* @param int $magicNumber
* @param bool $inverted Invert the ID before using it (useful for actual dye magic IDs) * @param bool $inverted Invert the ID before using it (useful for actual dye magic IDs)
* *
* @return DyeColor
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public static function fromMagicNumber(int $magicNumber, bool $inverted = false) : DyeColor{ public static function fromMagicNumber(int $magicNumber, bool $inverted = false) : DyeColor{
@ -116,30 +114,18 @@ final class DyeColor{
$this->rgbValue = $rgbValue; $this->rgbValue = $rgbValue;
} }
/**
* @return string
*/
public function getDisplayName() : string{ public function getDisplayName() : string{
return $this->displayName; return $this->displayName;
} }
/**
* @return Color
*/
public function getRgbValue() : Color{ public function getRgbValue() : Color{
return $this->rgbValue; return $this->rgbValue;
} }
/**
* @return int
*/
public function getMagicNumber() : int{ public function getMagicNumber() : int{
return $this->magicNumber; return $this->magicNumber;
} }
/**
* @return int
*/
public function getInvertedMagicNumber() : int{ public function getInvertedMagicNumber() : int{
return ~$this->magicNumber & 0xf; return ~$this->magicNumber & 0xf;
} }

View File

@ -31,8 +31,6 @@ interface Fallable{
* Called every tick by FallingBlock to update the falling state of this block. Used by concrete to check when it * Called every tick by FallingBlock to update the falling state of this block. Used by concrete to check when it
* hits water. * hits water.
* Return null if you don't want to change the usual behaviour. * Return null if you don't want to change the usual behaviour.
*
* @return Block|null
*/ */
public function tickFalling() : ?Block; public function tickFalling() : ?Block;
} }

View File

@ -41,7 +41,6 @@ trait PillarRotationTrait{
/** /**
* @see Block::writeStateToMeta() * @see Block::writeStateToMeta()
* @return int
*/ */
protected function writeStateToMeta() : int{ protected function writeStateToMeta() : int{
return $this->writeAxisToMeta(); return $this->writeAxisToMeta();
@ -49,9 +48,6 @@ trait PillarRotationTrait{
/** /**
* @see Block::readStateFromData() * @see Block::readStateFromData()
*
* @param int $id
* @param int $stateMeta
*/ */
public function readStateFromData(int $id, int $stateMeta) : void{ public function readStateFromData(int $id, int $stateMeta) : void{
$this->readAxisFromMeta($stateMeta); $this->readAxisFromMeta($stateMeta);
@ -59,7 +55,6 @@ trait PillarRotationTrait{
/** /**
* @see Block::getStateBitmask() * @see Block::getStateBitmask()
* @return int
*/ */
public function getStateBitmask() : int{ public function getStateBitmask() : int{
return 0b11 << $this->getAxisMetaShift(); return 0b11 << $this->getAxisMetaShift();
@ -89,16 +84,6 @@ trait PillarRotationTrait{
/** /**
* @see Block::place() * @see Block::place()
*
* @param BlockTransaction $tx
* @param Item $item
* @param Block $blockReplace
* @param Block $blockClicked
* @param int $face
* @param Vector3 $clickVector
* @param Player|null $player
*
* @return bool
*/ */
public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{ public function place(BlockTransaction $tx, Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector, ?Player $player = null) : bool{
$this->axis = Facing::axis($face); $this->axis = Facing::axis($face);

View File

@ -50,9 +50,6 @@ class SignText{
* Parses sign lines from the given string blob. * Parses sign lines from the given string blob.
* TODO: add a strict mode for this * TODO: add a strict mode for this
* *
* @param string $blob
*
* @return SignText
* @throws \InvalidArgumentException if the text is not valid UTF-8 * @throws \InvalidArgumentException if the text is not valid UTF-8
*/ */
public static function fromBlob(string $blob) : SignText{ public static function fromBlob(string $blob) : SignText{
@ -101,9 +98,6 @@ class SignText{
/** /**
* Returns the sign line at the given offset. * Returns the sign line at the given offset.
* *
* @param int $index
*
* @return string
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public function getLine(int $index) : string{ public function getLine(int $index) : string{
@ -114,9 +108,6 @@ class SignText{
/** /**
* Sets the line at the given offset. * Sets the line at the given offset.
* *
* @param int $index
* @param string $line
*
* @throws \InvalidArgumentException if the text is not valid UTF-8 * @throws \InvalidArgumentException if the text is not valid UTF-8
* @throws \InvalidArgumentException if the text contains a newline * @throws \InvalidArgumentException if the text contains a newline
*/ */

View File

@ -64,9 +64,7 @@ final class SkullType{
/** /**
* @internal * @internal
* @param int $magicNumber
* *
* @return SkullType
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public static function fromMagicNumber(int $magicNumber) : SkullType{ public static function fromMagicNumber(int $magicNumber) : SkullType{
@ -87,16 +85,10 @@ final class SkullType{
$this->magicNumber = $magicNumber; $this->magicNumber = $magicNumber;
} }
/**
* @return string
*/
public function getDisplayName() : string{ public function getDisplayName() : string{
return $this->displayName; return $this->displayName;
} }
/**
* @return int
*/
public function getMagicNumber() : int{ public function getMagicNumber() : int{
return $this->magicNumber; return $this->magicNumber;
} }

View File

@ -65,9 +65,6 @@ final class TreeType{
/** /**
* @internal * @internal
* *
* @param int $magicNumber
*
* @return TreeType
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public static function fromMagicNumber(int $magicNumber) : TreeType{ public static function fromMagicNumber(int $magicNumber) : TreeType{
@ -83,27 +80,16 @@ final class TreeType{
/** @var int */ /** @var int */
private $magicNumber; private $magicNumber;
/**
* @param string $enumName
* @param string $displayName
* @param int $magicNumber
*/
private function __construct(string $enumName, string $displayName, int $magicNumber){ private function __construct(string $enumName, string $displayName, int $magicNumber){
$this->Enum___construct($enumName); $this->Enum___construct($enumName);
$this->displayName = $displayName; $this->displayName = $displayName;
$this->magicNumber = $magicNumber; $this->magicNumber = $magicNumber;
} }
/**
* @return string
*/
public function getDisplayName() : string{ public function getDisplayName() : string{
return $this->displayName; return $this->displayName;
} }
/**
* @return int
*/
public function getMagicNumber() : int{ public function getMagicNumber() : int{
return $this->magicNumber; return $this->magicNumber;
} }

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,33 +93,18 @@ 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;
} }
/**
* @return string|null
*/
public function getPermission() : ?string{ public function getPermission() : ?string{
return $this->permission; return $this->permission;
} }
/**
* @param string|null $permission
*/
public function setPermission(?string $permission) : void{ public function setPermission(?string $permission) : void{
$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;
@ -138,11 +119,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;
@ -157,9 +133,6 @@ abstract class Command{
return false; return false;
} }
/**
* @return string
*/
public function getLabel() : string{ public function getLabel() : string{
return $this->label; return $this->label;
} }
@ -181,10 +154,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)){
@ -196,11 +165,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;
@ -213,18 +177,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;
} }
@ -236,23 +192,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;
} }
@ -267,31 +214,20 @@ abstract class Command{
} }
} }
/**
* @param string $description
*/
public function setDescription(string $description) : void{ public function setDescription(string $description) : void{
$this->description = $description; $this->description = $description;
} }
/**
* @param string $permissionMessage
*/
public function setPermissionMessage(string $permissionMessage) : void{ public function setPermissionMessage(string $permissionMessage) : void{
$this->permissionMessage = $permissionMessage; $this->permissionMessage = $permissionMessage;
} }
/**
* @param string $usage
*/
public function setUsage(string $usage) : void{ public function setUsage(string $usage) : void{
$this->usageMessage = $usage; $this->usageMessage = $usage;
} }
/** /**
* @param CommandSender $source
* @param TextContainer|string $message * @param TextContainer|string $message
* @param bool $sendToSource
*/ */
public static function broadcastCommandMessage(CommandSender $source, $message, bool $sendToSource = true) : void{ public static function broadcastCommandMessage(CommandSender $source, $message, bool $sendToSource = true) : void{
$users = PermissionManager::getInstance()->getPermissionSubscriptions(Server::BROADCAST_CHANNEL_ADMINISTRATIVE); $users = PermissionManager::getInstance()->getPermissionSubscriptions(Server::BROADCAST_CHANNEL_ADMINISTRATIVE);
@ -325,9 +261,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,38 +27,16 @@ namespace pocketmine\command;
interface CommandMap{ interface CommandMap{
/** /**
* @param string $fallbackPrefix
* @param Command[] $commands * @param Command[] $commands
*/ */
public function registerAll(string $fallbackPrefix, array $commands) : void; public function registerAll(string $fallbackPrefix, array $commands) : void;
/**
* @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;
/**
* @return void
*/
public function clearCommands() : void; public function clearCommands() : void;
/**
* @param string $name
*
* @return Command|null
*/
public function getCommand(string $name) : ?Command; public function getCommand(string $name) : ?Command;

View File

@ -114,8 +114,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));
@ -177,8 +175,6 @@ class CommandReader extends Thread{
/** /**
* Reads a line from console, if available. Returns null if not available * Reads a line from console, if available. Returns null if not available
*
* @return string|null
*/ */
public function getLine() : ?string{ public function getLine() : ?string{
if($this->buffer->count() !== 0){ if($this->buffer->count() !== 0){

View File

@ -34,28 +34,18 @@ interface CommandSender extends Permissible{
*/ */
public function sendMessage($message) : void; public function sendMessage($message) : void;
/**
* @return Server
*/
public function getServer() : Server; public function getServer() : Server;
/**
* @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
*/ */
public function setScreenLineHeight(?int $height) : void; public function setScreenLineHeight(?int $height) : void;
} }

View File

@ -41,9 +41,6 @@ class ConsoleCommandSender implements CommandSender{
$this->perm = new PermissibleBase($this); $this->perm = new PermissibleBase($this);
} }
/**
* @return Server
*/
public function getServer() : Server{ public function getServer() : Server{
return Server::getInstance(); return Server::getInstance();
} }
@ -64,23 +61,14 @@ 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
*/
public function setOp(bool $value) : void{ public function setOp(bool $value) : void{
} }

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,11 +34,6 @@ class PluginCommand extends Command implements PluginIdentifiableCommand{
/** @var CommandExecutor */ /** @var CommandExecutor */
private $executor; private $executor;
/**
* @param string $name
* @param Plugin $owner
* @param CommandExecutor $executor
*/
public function __construct(string $name, Plugin $owner, CommandExecutor $executor){ public function __construct(string $name, Plugin $owner, CommandExecutor $executor){
parent::__construct($name); parent::__construct($name);
$this->owningPlugin = $owner; $this->owningPlugin = $owner;
@ -69,16 +64,10 @@ class PluginCommand extends Command implements PluginIdentifiableCommand{
return $this->executor; return $this->executor;
} }
/**
* @param CommandExecutor $executor
*/
public function setExecutor(CommandExecutor $executor) : void{ public function setExecutor(CommandExecutor $executor) : void{
$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

@ -142,13 +142,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();
@ -175,11 +168,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){
@ -192,14 +180,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])){
@ -226,8 +206,6 @@ class SimpleCommandMap implements CommandMap{
* *
* @param string $commandName reference parameter * @param string $commandName reference parameter
* @param string[] $args reference parameter * @param string[] $args reference parameter
*
* @return Command|null
*/ */
public function matchCommand(string &$commandName, array &$args) : ?Command{ public function matchCommand(string &$commandName, array &$args) : ?Command{
$count = min(count($args), 255); $count = min(count($args), 255);
@ -294,10 +272,6 @@ class SimpleCommandMap implements CommandMap{
return $this->knownCommands; return $this->knownCommands;
} }
/**
* @return void
*/
public function registerServerAliases() : void{ public function registerServerAliases() : void{
$values = $this->server->getCommandAliases(); $values = $this->server->getCommandAliases();

View File

@ -137,12 +137,6 @@ class ParticleCommand extends VanillaCommand{
return true; return true;
} }
/**
* @param string $name
* @param int|null $data
*
* @return Particle|null
*/
private function getParticle(string $name, ?int $data = null) : ?Particle{ private function getParticle(string $name, ?int $data = null) : ?Particle{
switch($name){ switch($name){
case "explode": case "explode":

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

@ -105,11 +105,6 @@ class CraftingGrid extends BaseInventory{
/** /**
* Returns the item at offset x,y, offset by where the starts of the recipe rectangle are. * Returns the item at offset x,y, offset by where the starts of the recipe rectangle are.
*
* @param int $x
* @param int $y
*
* @return Item
*/ */
public function getIngredient(int $x, int $y) : Item{ public function getIngredient(int $x, int $y) : Item{
if($this->startX !== null and $this->startY !== null){ if($this->startX !== null and $this->startY !== null){
@ -121,8 +116,6 @@ class CraftingGrid extends BaseInventory{
/** /**
* Returns the width of the recipe we're trying to craft, based on items currently in the grid. * Returns the width of the recipe we're trying to craft, based on items currently in the grid.
*
* @return int
*/ */
public function getRecipeWidth() : int{ public function getRecipeWidth() : int{
return $this->xLen ?? 0; return $this->xLen ?? 0;
@ -130,7 +123,6 @@ class CraftingGrid extends BaseInventory{
/** /**
* Returns the height of the recipe we're trying to craft, based on items currently in the grid. * Returns the height of the recipe we're trying to craft, based on items currently in the grid.
* @return int
*/ */
public function getRecipeHeight() : int{ public function getRecipeHeight() : int{
return $this->yLen ?? 0; return $this->yLen ?? 0;

View File

@ -124,8 +124,6 @@ class CraftingManager{
/** /**
* Returns a pre-compressed CraftingDataPacket for sending to players. Rebuilds the cache if it is not found. * Returns a pre-compressed CraftingDataPacket for sending to players. Rebuilds the cache if it is not found.
*
* @return CompressBatchPromise
*/ */
public function getCraftingDataPacket() : CompressBatchPromise{ public function getCraftingDataPacket() : CompressBatchPromise{
if($this->craftingDataCache === null){ if($this->craftingDataCache === null){
@ -137,11 +135,6 @@ class CraftingManager{
/** /**
* Function used to arrange Shapeless Recipe ingredient lists into a consistent order. * Function used to arrange Shapeless Recipe ingredient lists into a consistent order.
*
* @param Item $i1
* @param Item $i2
*
* @return int
*/ */
public static function sort(Item $i1, Item $i2) : int{ public static function sort(Item $i1, Item $i2) : int{
//Use spaceship operator to compare each property, then try the next one if they are equivalent. //Use spaceship operator to compare each property, then try the next one if they are equivalent.
@ -206,27 +199,18 @@ class CraftingManager{
return $this->furnaceRecipes; return $this->furnaceRecipes;
} }
/**
* @param ShapedRecipe $recipe
*/
public function registerShapedRecipe(ShapedRecipe $recipe) : void{ public function registerShapedRecipe(ShapedRecipe $recipe) : void{
$this->shapedRecipes[self::hashOutputs($recipe->getResults())][] = $recipe; $this->shapedRecipes[self::hashOutputs($recipe->getResults())][] = $recipe;
$this->craftingDataCache = null; $this->craftingDataCache = null;
} }
/**
* @param ShapelessRecipe $recipe
*/
public function registerShapelessRecipe(ShapelessRecipe $recipe) : void{ public function registerShapelessRecipe(ShapelessRecipe $recipe) : void{
$this->shapelessRecipes[self::hashOutputs($recipe->getResults())][] = $recipe; $this->shapelessRecipes[self::hashOutputs($recipe->getResults())][] = $recipe;
$this->craftingDataCache = null; $this->craftingDataCache = null;
} }
/**
* @param FurnaceRecipe $recipe
*/
public function registerFurnaceRecipe(FurnaceRecipe $recipe) : void{ public function registerFurnaceRecipe(FurnaceRecipe $recipe) : void{
$input = $recipe->getInput(); $input = $recipe->getInput();
$this->furnaceRecipes[$input->getId() . ":" . ($input->hasAnyDamageValue() ? "?" : $input->getMeta())] = $recipe; $this->furnaceRecipes[$input->getId() . ":" . ($input->hasAnyDamageValue() ? "?" : $input->getMeta())] = $recipe;
@ -234,10 +218,7 @@ class CraftingManager{
} }
/** /**
* @param CraftingGrid $grid
* @param Item[] $outputs * @param Item[] $outputs
*
* @return CraftingRecipe|null
*/ */
public function matchRecipe(CraftingGrid $grid, array $outputs) : ?CraftingRecipe{ public function matchRecipe(CraftingGrid $grid, array $outputs) : ?CraftingRecipe{
//TODO: try to match special recipes before anything else (first they need to be implemented!) //TODO: try to match special recipes before anything else (first they need to be implemented!)
@ -286,11 +267,6 @@ class CraftingManager{
} }
} }
/**
* @param Item $input
*
* @return FurnaceRecipe|null
*/
public function matchFurnaceRecipe(Item $input) : ?FurnaceRecipe{ public function matchFurnaceRecipe(Item $input) : ?FurnaceRecipe{
return $this->furnaceRecipes[$input->getId() . ":" . $input->getMeta()] ?? $this->furnaceRecipes[$input->getId() . ":?"] ?? null; return $this->furnaceRecipes[$input->getId() . ":" . $input->getMeta()] ?? $this->furnaceRecipes[$input->getId() . ":?"] ?? null;
} }

View File

@ -36,18 +36,12 @@ interface CraftingRecipe{
/** /**
* Returns a list of results this recipe will produce when the inputs in the given crafting grid are consumed. * Returns a list of results this recipe will produce when the inputs in the given crafting grid are consumed.
* *
* @param CraftingGrid $grid
*
* @return Item[] * @return Item[]
*/ */
public function getResultsFor(CraftingGrid $grid) : array; public function getResultsFor(CraftingGrid $grid) : array;
/** /**
* Returns whether the given crafting grid meets the requirements to craft this recipe. * Returns whether the given crafting grid meets the requirements to craft this recipe.
*
* @param CraftingGrid $grid
*
* @return bool
*/ */
public function matchesCraftingGrid(CraftingGrid $grid) : bool; public function matchesCraftingGrid(CraftingGrid $grid) : bool;
} }

View File

@ -33,25 +33,15 @@ class FurnaceRecipe{
/** @var Item */ /** @var Item */
private $ingredient; private $ingredient;
/**
* @param Item $result
* @param Item $ingredient
*/
public function __construct(Item $result, Item $ingredient){ public function __construct(Item $result, Item $ingredient){
$this->output = clone $result; $this->output = clone $result;
$this->ingredient = clone $ingredient; $this->ingredient = clone $ingredient;
} }
/**
* @return Item
*/
public function getInput() : Item{ public function getInput() : Item{
return clone $this->ingredient; return clone $this->ingredient;
} }
/**
* @return Item
*/
public function getResult() : Item{ public function getResult() : Item{
return clone $this->output; return clone $this->output;
} }

View File

@ -114,8 +114,6 @@ class ShapedRecipe implements CraftingRecipe{
} }
/** /**
* @param CraftingGrid $grid
*
* @return Item[] * @return Item[]
*/ */
public function getResultsFor(CraftingGrid $grid) : array{ public function getResultsFor(CraftingGrid $grid) : array{
@ -155,12 +153,6 @@ class ShapedRecipe implements CraftingRecipe{
return $ingredients; return $ingredients;
} }
/**
* @param int $x
* @param int $y
*
* @return Item
*/
public function getIngredient(int $x, int $y) : Item{ public function getIngredient(int $x, int $y) : Item{
$exists = $this->ingredientList[$this->shape[$y]{$x}] ?? null; $exists = $this->ingredientList[$this->shape[$y]{$x}] ?? null;
return $exists !== null ? clone $exists : ItemFactory::air(); return $exists !== null ? clone $exists : ItemFactory::air();
@ -174,12 +166,6 @@ class ShapedRecipe implements CraftingRecipe{
return $this->shape; return $this->shape;
} }
/**
* @param CraftingGrid $grid
* @param bool $reverse
*
* @return bool
*/
private function matchInputMap(CraftingGrid $grid, bool $reverse) : bool{ private function matchInputMap(CraftingGrid $grid, bool $reverse) : bool{
for($y = 0; $y < $this->height; ++$y){ for($y = 0; $y < $this->height; ++$y){
for($x = 0; $x < $this->width; ++$x){ for($x = 0; $x < $this->width; ++$x){
@ -195,11 +181,6 @@ class ShapedRecipe implements CraftingRecipe{
return true; return true;
} }
/**
* @param CraftingGrid $grid
*
* @return bool
*/
public function matchesCraftingGrid(CraftingGrid $grid) : bool{ public function matchesCraftingGrid(CraftingGrid $grid) : bool{
if($this->width !== $grid->getRecipeWidth() or $this->height !== $grid->getRecipeHeight()){ if($this->width !== $grid->getRecipeWidth() or $this->height !== $grid->getRecipeHeight()){
return false; return false;

View File

@ -67,9 +67,6 @@ class ShapelessRecipe implements CraftingRecipe{
return Utils::cloneObjectArray($this->ingredients); return Utils::cloneObjectArray($this->ingredients);
} }
/**
* @return int
*/
public function getIngredientCount() : int{ public function getIngredientCount() : int{
$count = 0; $count = 0;
foreach($this->ingredients as $ingredient){ foreach($this->ingredients as $ingredient){
@ -79,11 +76,6 @@ class ShapelessRecipe implements CraftingRecipe{
return $count; return $count;
} }
/**
* @param CraftingGrid $grid
*
* @return bool
*/
public function matchesCraftingGrid(CraftingGrid $grid) : bool{ public function matchesCraftingGrid(CraftingGrid $grid) : bool{
//don't pack the ingredients - shapeless recipes require that each ingredient be in a separate slot //don't pack the ingredients - shapeless recipes require that each ingredient be in a separate slot
$input = $grid->getContents(); $input = $grid->getContents();

View File

@ -86,14 +86,6 @@ class Attribute{
} }
/** /**
* @param string $id
* @param float $minValue
* @param float $maxValue
* @param float $defaultValue
* @param bool $shouldSend
*
* @return Attribute
*
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public static function register(string $id, float $minValue, float $maxValue, float $defaultValue, bool $shouldSend = true) : Attribute{ public static function register(string $id, float $minValue, float $maxValue, float $defaultValue, bool $shouldSend = true) : Attribute{
@ -104,11 +96,6 @@ class Attribute{
return self::$attributes[$id] = new Attribute($id, $minValue, $maxValue, $defaultValue, $shouldSend); return self::$attributes[$id] = new Attribute($id, $minValue, $maxValue, $defaultValue, $shouldSend);
} }
/**
* @param string $id
*
* @return Attribute|null
*/
public static function get(string $id) : ?Attribute{ public static function get(string $id) : ?Attribute{
return isset(self::$attributes[$id]) ? clone self::$attributes[$id] : null; return isset(self::$attributes[$id]) ? clone self::$attributes[$id] : null;
} }
@ -128,8 +115,6 @@ class Attribute{
} }
/** /**
* @param float $minValue
*
* @return $this * @return $this
*/ */
public function setMinValue(float $minValue){ public function setMinValue(float $minValue){
@ -149,8 +134,6 @@ class Attribute{
} }
/** /**
* @param float $maxValue
*
* @return $this * @return $this
*/ */
public function setMaxValue(float $maxValue){ public function setMaxValue(float $maxValue){
@ -170,8 +153,6 @@ class Attribute{
} }
/** /**
* @param float $defaultValue
*
* @return $this * @return $this
*/ */
public function setDefaultValue(float $defaultValue){ public function setDefaultValue(float $defaultValue){
@ -195,10 +176,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

@ -33,11 +33,6 @@ class AttributeMap{
$this->attributes[$attribute->getId()] = $attribute; $this->attributes[$attribute->getId()] = $attribute;
} }
/**
* @param string $id
*
* @return Attribute|null
*/
public function get(string $id) : ?Attribute{ public function get(string $id) : ?Attribute{
return $this->attributes[$id] ?? null; return $this->attributes[$id] ?? null;
} }

View File

@ -281,72 +281,42 @@ abstract class Entity{
} }
/**
* @return string
*/
public function getNameTag() : string{ public function getNameTag() : string{
return $this->nameTag; return $this->nameTag;
} }
/**
* @return bool
*/
public function isNameTagVisible() : bool{ public function isNameTagVisible() : bool{
return $this->nameTagVisible; return $this->nameTagVisible;
} }
/**
* @return bool
*/
public function isNameTagAlwaysVisible() : bool{ public function isNameTagAlwaysVisible() : bool{
return $this->alwaysShowNameTag; return $this->alwaysShowNameTag;
} }
/**
* @param string $name
*/
public function setNameTag(string $name) : void{ public function setNameTag(string $name) : void{
$this->nameTag = $name; $this->nameTag = $name;
} }
/**
* @param bool $value
*/
public function setNameTagVisible(bool $value = true) : void{ public function setNameTagVisible(bool $value = true) : void{
$this->nameTagVisible = $value; $this->nameTagVisible = $value;
} }
/**
* @param bool $value
*/
public function setNameTagAlwaysVisible(bool $value = true) : void{ public function setNameTagAlwaysVisible(bool $value = true) : void{
$this->alwaysShowNameTag = $value; $this->alwaysShowNameTag = $value;
} }
/**
* @return string|null
*/
public function getScoreTag() : ?string{ public function getScoreTag() : ?string{
return $this->scoreTag; //TODO: maybe this shouldn't be nullable? return $this->scoreTag; //TODO: maybe this shouldn't be nullable?
} }
/**
* @param string $score
*/
public function setScoreTag(string $score) : void{ public function setScoreTag(string $score) : void{
$this->scoreTag = $score; $this->scoreTag = $score;
} }
/**
* @return float
*/
public function getScale() : float{ public function getScale() : float{
return $this->scale; return $this->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");
@ -417,7 +387,6 @@ abstract class Entity{
/** /**
* 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->canClimb; return $this->canClimb;
@ -425,8 +394,6 @@ abstract class Entity{
/** /**
* 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->canClimb = $value; $this->canClimb = $value;
@ -434,8 +401,6 @@ abstract class Entity{
/** /**
* 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->canClimbWalls; return $this->canClimbWalls;
@ -443,8 +408,6 @@ abstract class Entity{
/** /**
* 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->canClimbWalls = $value; $this->canClimbWalls = $value;
@ -452,7 +415,6 @@ abstract class Entity{
/** /**
* 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->ownerId; return $this->ownerId;
@ -460,7 +422,6 @@ abstract class Entity{
/** /**
* 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{
return $this->ownerId !== null ? $this->server->getWorldManager()->findEntity($this->ownerId) : null; return $this->ownerId !== null ? $this->server->getWorldManager()->findEntity($this->ownerId) : null;
@ -469,8 +430,6 @@ abstract class Entity{
/** /**
* 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{
@ -485,7 +444,6 @@ abstract class Entity{
/** /**
* 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->targetId; return $this->targetId;
@ -494,8 +452,6 @@ abstract class Entity{
/** /**
* 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{
return $this->targetId !== null ? $this->server->getWorldManager()->findEntity($this->targetId) : null; return $this->targetId !== null ? $this->server->getWorldManager()->findEntity($this->targetId) : null;
@ -504,8 +460,6 @@ abstract class Entity{
/** /**
* 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{
@ -520,7 +474,6 @@ abstract class Entity{
/** /**
* 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;
@ -529,8 +482,6 @@ abstract class Entity{
/** /**
* 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;
@ -596,9 +547,6 @@ abstract class Entity{
} }
/**
* @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()){
@ -610,9 +558,6 @@ abstract class Entity{
$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()){
@ -639,10 +584,6 @@ abstract class Entity{
/** /**
* 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;
@ -652,17 +593,12 @@ abstract class Entity{
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){
@ -680,30 +616,18 @@ abstract class Entity{
} }
} }
/**
* @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;
} }
@ -764,15 +688,11 @@ abstract class Entity{
} }
} }
/**
* @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{
@ -1033,9 +953,6 @@ abstract class Entity{
return Facing::EAST; return Facing::EAST;
} }
/**
* @return Vector3
*/
public function getDirectionVector() : Vector3{ public function getDirectionVector() : Vector3{
$y = -sin(deg2rad($this->location->pitch)); $y = -sin(deg2rad($this->location->pitch));
$xz = cos(deg2rad($this->location->pitch)); $xz = cos(deg2rad($this->location->pitch));
@ -1125,8 +1042,6 @@ abstract class Entity{
/** /**
* 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;
@ -1136,7 +1051,6 @@ abstract class Entity{
/** /**
* 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 (
@ -1152,10 +1066,6 @@ abstract class Entity{
$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){
@ -1169,8 +1079,6 @@ abstract class Entity{
/** /**
* 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{
@ -1397,8 +1305,6 @@ abstract class Entity{
/** /**
* 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;
@ -1533,10 +1439,6 @@ abstract class Entity{
/** /**
* Adds the given values to the entity's motion vector. * Adds the given values to the entity's motion vector.
*
* @param float $x
* @param float $y
* @param float $z
*/ */
public function addMotion(float $x, float $y, float $z) : void{ public function addMotion(float $x, float $y, float $z) : void{
$this->motion->x += $x; $this->motion->x += $x;
@ -1550,10 +1452,6 @@ abstract class Entity{
/** /**
* @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){
@ -1615,8 +1513,6 @@ abstract class Entity{
/** /**
* 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();
@ -1633,9 +1529,6 @@ abstract class Entity{
$player->getNetworkSession()->sendDataPacket($pk); $player->getNetworkSession()->sendDataPacket($pk);
} }
/**
* @param Player $player
*/
public function spawnTo(Player $player) : void{ public function spawnTo(Player $player) : void{
$id = spl_object_id($player); $id = spl_object_id($player);
if(!isset($this->hasSpawned[$id]) and $player->isUsingChunk($this->location->getFloorX() >> 4, $this->location->getFloorZ() >> 4)){ if(!isset($this->hasSpawned[$id]) and $player->isUsingChunk($this->location->getFloorX() >> 4, $this->location->getFloorZ() >> 4)){
@ -1664,9 +1557,6 @@ abstract class Entity{
/** /**
* @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{
$id = spl_object_id($player); $id = spl_object_id($player);
@ -1702,7 +1592,6 @@ abstract class Entity{
/** /**
* 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;
@ -1773,8 +1662,6 @@ abstract class Entity{
} }
/** /**
* @param bool $dirtyOnly
*
* @return MetadataProperty[] * @return MetadataProperty[]
*/ */
final protected function getSyncedNetworkData(bool $dirtyOnly) : array{ final protected function getSyncedNetworkData(bool $dirtyOnly) : array{

View File

@ -163,8 +163,6 @@ final class EntityFactory{
/** /**
* Returns a new runtime entity ID for a new entity. * Returns a new runtime entity ID for a new entity.
*
* @return int
*/ */
public static function nextRuntimeId() : int{ public static function nextRuntimeId() : int{
return self::$entityCount++; return self::$entityCount++;
@ -176,9 +174,6 @@ final class EntityFactory{
* *
* TODO: make this NBT-independent * TODO: make this NBT-independent
* *
* @param string $baseClass
* @param World $world
* @param CompoundTag $nbt
* @param mixed ...$args * @param mixed ...$args
* *
* @return Entity instanceof $baseClass * @return Entity instanceof $baseClass
@ -203,10 +198,6 @@ final class EntityFactory{
/** /**
* Creates an entity from data stored on a chunk. * Creates an entity from data stored on a chunk.
* *
* @param World $world
* @param CompoundTag $nbt
*
* @return Entity|null
* @throws \RuntimeException * @throws \RuntimeException
*@internal *@internal
* *
@ -243,13 +234,6 @@ final class EntityFactory{
/** /**
* 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 CompoundTag::create() return CompoundTag::create()

View File

@ -64,7 +64,6 @@ class ExperienceManager{
/** /**
* 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->levelAttr->getValue(); return (int) $this->levelAttr->getValue();
@ -72,10 +71,6 @@ class ExperienceManager{
/** /**
* 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);
@ -83,11 +78,6 @@ class ExperienceManager{
/** /**
* 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();
@ -107,10 +97,6 @@ class ExperienceManager{
/** /**
* 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);
@ -118,7 +104,6 @@ class ExperienceManager{
/** /**
* 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->progressAttr->getValue(); return $this->progressAttr->getValue();
@ -126,10 +111,6 @@ class ExperienceManager{
/** /**
* 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);
@ -137,7 +118,6 @@ class ExperienceManager{
/** /**
* 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());
@ -147,8 +127,6 @@ class ExperienceManager{
* 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();
@ -157,10 +135,6 @@ class ExperienceManager{
/** /**
* 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);
@ -172,10 +146,7 @@ class ExperienceManager{
* 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;
@ -201,10 +172,6 @@ class ExperienceManager{
/** /**
* 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);
@ -234,9 +201,6 @@ class ExperienceManager{
/** /**
* @internal * @internal
*
* @param int $level
* @param float $progress
*/ */
public function setXpAndProgressNoEvent(int $level, float $progress) : void{ public function setXpAndProgressNoEvent(int $level, float $progress) : void{
$this->levelAttr->setValue($level); $this->levelAttr->setValue($level);
@ -246,8 +210,6 @@ class ExperienceManager{
/** /**
* 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;
@ -256,8 +218,6 @@ class ExperienceManager{
/** /**
* 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){
@ -270,7 +230,6 @@ class ExperienceManager{
/** /**
* 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;
@ -314,8 +273,6 @@ class ExperienceManager{
/** /**
* 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;

View File

@ -112,25 +112,17 @@ class Human extends Living 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
*/
public function getUniqueId() : UUID{ public function getUniqueId() : UUID{
return $this->uuid; return $this->uuid;
} }
/** /**
* 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;
@ -139,8 +131,6 @@ class Human extends Living 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{
$this->skin = $skin; $this->skin = $skin;
@ -168,9 +158,6 @@ class Human extends Living implements ProjectileSource, InventoryHolder{
} }
} }
/**
* @return HungerManager
*/
public function getHungerManager() : HungerManager{ public function getHungerManager() : HungerManager{
return $this->hungerManager; return $this->hungerManager;
} }
@ -188,9 +175,6 @@ class Human extends Living implements ProjectileSource, InventoryHolder{
return parent::consumeObject($consumable); return parent::consumeObject($consumable);
} }
/**
* @return ExperienceManager
*/
public function getXpManager() : ExperienceManager{ public function getXpManager() : ExperienceManager{
return $this->xpManager; return $this->xpManager;
} }
@ -214,8 +198,6 @@ class Human extends Living implements ProjectileSource, InventoryHolder{
/** /**
* For Human entities which are not players, sets their properties such as nametag, skin and UUID from NBT. * For Human entities which are not players, sets their properties such as nametag, skin and UUID from NBT.
*
* @param CompoundTag $nbt
*/ */
protected function initHumanData(CompoundTag $nbt) : void{ protected function initHumanData(CompoundTag $nbt) : void{
if($nbt->hasTag("NameTag", StringTag::class)){ if($nbt->hasTag("NameTag", StringTag::class)){

View File

@ -69,8 +69,6 @@ class HungerManager{
* 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.
* @see HungerManager::addFood() * @see HungerManager::addFood()
* *
* @param float $new
*
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public function setFood(float $new) : void{ public function setFood(float $new) : void{
@ -98,8 +96,6 @@ class HungerManager{
/** /**
* 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();
@ -113,8 +109,6 @@ class HungerManager{
* 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.
* @see HungerManager::addSaturation() * @see HungerManager::addSaturation()
* *
* @param float $saturation
*
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public function setSaturation(float $saturation) : void{ public function setSaturation(float $saturation) : void{
@ -132,8 +126,6 @@ class HungerManager{
/** /**
* 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.
* @see HungerManager::exhaust() * @see HungerManager::exhaust()
*
* @param float $exhaustion
*/ */
public function setExhaustion(float $exhaustion) : void{ public function setExhaustion(float $exhaustion) : void{
$this->exhaustionAttr->setValue($exhaustion); $this->exhaustionAttr->setValue($exhaustion);
@ -142,9 +134,6 @@ class HungerManager{
/** /**
* Increases exhaustion level. * Increases 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{
@ -180,16 +169,10 @@ class HungerManager{
return $ev->getAmount(); return $ev->getAmount();
} }
/**
* @return int
*/
public function getFoodTickTimer() : int{ public function getFoodTickTimer() : int{
return $this->foodTickTimer; return $this->foodTickTimer;
} }
/**
* @param int $foodTickTimer
*/
public function setFoodTickTimer(int $foodTickTimer) : void{ public function setFoodTickTimer(int $foodTickTimer) : void{
if($foodTickTimer < 0){ if($foodTickTimer < 0){
throw new \InvalidArgumentException("Expected a non-negative value"); throw new \InvalidArgumentException("Expected a non-negative value");
@ -238,16 +221,10 @@ class HungerManager{
} }
} }
/**
* @return bool
*/
public function isEnabled() : bool{ public function isEnabled() : bool{
return $this->enabled; return $this->enabled;
} }
/**
* @param bool $enabled
*/
public function setEnabled(bool $enabled) : void{ public function setEnabled(bool $enabled) : void{
$this->enabled = $enabled; $this->enabled = $enabled;
} }

View File

@ -217,10 +217,6 @@ abstract class Living extends Entity{
/** /**
* 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){
@ -234,7 +230,6 @@ abstract class Living extends Entity{
/** /**
* 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->effectManager->has(VanillaEffects::JUMP_BOOST()) ? ($this->effectManager->get(VanillaEffects::JUMP_BOOST())->getEffectLevel() / 10) : 0); return $this->jumpVelocity + ($this->effectManager->has(VanillaEffects::JUMP_BOOST()) ? ($this->effectManager->get(VanillaEffects::JUMP_BOOST())->getEffectLevel() / 10) : 0);
@ -261,8 +256,6 @@ abstract class Living extends Entity{
* 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;
@ -275,10 +268,6 @@ abstract class Living extends Entity{
/** /**
* 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 Enchantment $enchantment
*
* @return int
*/ */
public function getHighestArmorEnchantmentLevel(Enchantment $enchantment) : int{ public function getHighestArmorEnchantmentLevel(Enchantment $enchantment) : int{
$result = 0; $result = 0;
@ -289,9 +278,6 @@ abstract class Living extends Entity{
return $result; return $result;
} }
/**
* @return ArmorInventory
*/
public function getArmorInventory() : ArmorInventory{ public function getArmorInventory() : ArmorInventory{
return $this->armorInventory; return $this->armorInventory;
} }
@ -303,8 +289,6 @@ abstract class Living extends Entity{
/** /**
* 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()){
@ -332,8 +316,6 @@ abstract class Living extends Entity{
* 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)));
@ -363,8 +345,6 @@ abstract class Living extends Entity{
/** /**
* 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);
@ -544,10 +524,6 @@ abstract class Living extends Entity{
/** /**
* 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();
@ -583,7 +559,6 @@ abstract class Living extends Entity{
/** /**
* 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->effectManager->has(VanillaEffects::WATER_BREATHING()) or $this->effectManager->has(VanillaEffects::CONDUIT_POWER()) or !$this->isUnderwater(); return $this->effectManager->has(VanillaEffects::WATER_BREATHING()) or $this->effectManager->has(VanillaEffects::CONDUIT_POWER()) or !$this->isUnderwater();
@ -591,7 +566,6 @@ abstract class Living extends Entity{
/** /**
* 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->breathing; return $this->breathing;
@ -600,8 +574,6 @@ abstract class Living extends Entity{
/** /**
* 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->breathing = $value; $this->breathing = $value;
@ -610,8 +582,6 @@ abstract class Living extends Entity{
/** /**
* 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->breathTicks; return $this->breathTicks;
@ -619,8 +589,6 @@ abstract class Living extends Entity{
/** /**
* 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->breathTicks = $ticks; $this->breathTicks = $ticks;
@ -628,7 +596,6 @@ abstract class Living extends Entity{
/** /**
* 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->maxBreathTicks; return $this->maxBreathTicks;
@ -636,8 +603,6 @@ abstract class Living extends Entity{
/** /**
* 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->maxBreathTicks = $ticks; $this->maxBreathTicks = $ticks;
@ -661,17 +626,12 @@ abstract class Living extends Entity{
/** /**
* 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{
@ -711,12 +671,6 @@ abstract class Living extends Entity{
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){
@ -729,8 +683,6 @@ abstract class Living extends Entity{
/** /**
* 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->location->x) ** 2 + ($target->z - $this->location->z) ** 2); $horizontal = sqrt(($target->x - $this->location->x) ** 2 + ($target->z - $this->location->z) ** 2);

View File

@ -38,8 +38,6 @@ class Location extends Position{
* @param float|int $x * @param float|int $x
* @param float|int $y * @param float|int $y
* @param float|int $z * @param float|int $z
* @param float $yaw
* @param float $pitch
* @param World $world * @param World $world
*/ */
public function __construct($x = 0, $y = 0, $z = 0, float $yaw = 0.0, float $pitch = 0.0, ?World $world = null){ public function __construct($x = 0, $y = 0, $z = 0, float $yaw = 0.0, float $pitch = 0.0, ?World $world = null){
@ -49,7 +47,6 @@ class Location extends Position{
} }
/** /**
* @param Vector3 $pos
* @param World|null $world default null * @param World|null $world default null
* @param float $yaw default 0.0 * @param float $yaw default 0.0
* @param float $pitch default 0.0 * @param float $pitch default 0.0
@ -62,8 +59,6 @@ class Location extends Position{
/** /**
* Return a Location instance * Return a Location instance
*
* @return Location
*/ */
public function asLocation() : Location{ public function asLocation() : Location{
return new Location($this->x, $this->y, $this->z, $this->yaw, $this->pitch, $this->world); return new Location($this->x, $this->y, $this->z, $this->yaw, $this->pitch, $this->world);

View File

@ -83,37 +83,22 @@ final class Skin{
$this->geometryData = $geometryData; $this->geometryData = $geometryData;
} }
/**
* @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

@ -71,8 +71,6 @@ class Villager extends Living implements 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->profession = $profession; //TODO: validation $this->profession = $profession; //TODO: validation

View File

@ -57,7 +57,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;
@ -65,7 +64,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;
@ -73,7 +71,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 $this->color; return $this->color;
@ -82,8 +79,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;
@ -91,7 +86,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 600; return 600;
@ -99,7 +93,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;
@ -107,10 +100,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{
return false; return false;
@ -118,11 +107,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
*/ */
public function applyEffect(Living $entity, EffectInstance $instance, float $potency = 1.0, ?Entity $source = null) : void{ public function applyEffect(Living $entity, EffectInstance $instance, float $potency = 1.0, ?Entity $source = null) : void{
@ -130,9 +114,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{
@ -140,9 +121,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{

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{
@ -155,16 +132,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{
@ -177,16 +150,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{
@ -198,8 +167,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 $this->color; return $this->color;
@ -207,10 +174,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 = $color; $this->color = $color;
@ -220,8 +183,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

@ -73,8 +73,6 @@ class EffectManager{
/** /**
* Removes the effect with the specified ID from the mob. * Removes the effect with the specified ID from the mob.
*
* @param Effect $effectType
*/ */
public function remove(Effect $effectType) : void{ public function remove(Effect $effectType) : void{
$index = $effectType->getId(); $index = $effectType->getId();
@ -105,10 +103,6 @@ class EffectManager{
/** /**
* 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 Effect $effect
*
* @return EffectInstance|null
*/ */
public function get(Effect $effect) : ?EffectInstance{ public function get(Effect $effect) : ?EffectInstance{
return $this->effects[$effect->getId()] ?? null; return $this->effects[$effect->getId()] ?? null;
@ -116,10 +110,6 @@ class EffectManager{
/** /**
* Returns whether the specified effect is active on the mob. * Returns whether the specified effect is active on the mob.
*
* @param Effect $effect
*
* @return bool
*/ */
public function has(Effect $effect) : bool{ public function has(Effect $effect) : bool{
return isset($this->effects[$effect->getId()]); return isset($this->effects[$effect->getId()]);
@ -130,8 +120,6 @@ class EffectManager{
* 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 add(EffectInstance $effect) : bool{ public function add(EffectInstance $effect) : bool{
@ -203,16 +191,10 @@ class EffectManager{
} }
} }
/**
* @return Color
*/
public function getBubbleColor() : Color{ public function getBubbleColor() : Color{
return $this->bubbleColor; return $this->bubbleColor;
} }
/**
* @return bool
*/
public function hasOnlyAmbientEffects() : bool{ public function hasOnlyAmbientEffects() : bool{
return $this->onlyAmbientEffects; return $this->onlyAmbientEffects;
} }

View File

@ -104,11 +104,6 @@ final class VanillaEffects{
self::$mcpeIdMap[$member->getId()] = $member; self::$mcpeIdMap[$member->getId()] = $member;
} }
/**
* @param int $id
*
* @return Effect|null
*/
public static function byMcpeId(int $id) : ?Effect{ public static function byMcpeId(int $id) : ?Effect{
self::checkInit(); self::checkInit();
return self::$mcpeIdMap[$id] ?? null; return self::$mcpeIdMap[$id] ?? null;
@ -121,11 +116,6 @@ final class VanillaEffects{
return self::_registryGetAll(); return self::_registryGetAll();
} }
/**
* @param string $name
*
* @return Effect
*/
public static function fromString(string $name) : Effect{ public static function fromString(string $name) : Effect{
$result = self::_registryFromString($name); $result = self::_registryFromString($name);
assert($result instanceof Effect); assert($result instanceof Effect);

View File

@ -52,10 +52,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){
@ -70,8 +66,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

@ -154,9 +154,6 @@ class ItemEntity extends Entity{
return $nbt; return $nbt;
} }
/**
* @return Item
*/
public function getItem() : Item{ public function getItem() : Item{
return $this->item; return $this->item;
} }
@ -169,32 +166,22 @@ 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;
} }
/** /**
* Returns the number of ticks left before this item will despawn. If -1, the item will never despawn. * Returns the number of ticks left before this item will despawn. If -1, the item will never despawn.
*
* @return int
*/ */
public function getDespawnDelay() : int{ public function getDespawnDelay() : int{
return $this->despawnDelay; return $this->despawnDelay;
} }
/** /**
* @param int $despawnDelay
*
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */
public function setDespawnDelay(int $despawnDelay) : void{ public function setDespawnDelay(int $despawnDelay) : void{
@ -204,30 +191,18 @@ class ItemEntity extends Entity{
$this->despawnDelay = $despawnDelay; $this->despawnDelay = $despawnDelay;
} }
/**
* @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

@ -164,7 +164,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);
@ -176,11 +175,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 int $facing
* @param PaintingMotive $motive
*
* @return AxisAlignedBB
*/ */
private static function getPaintingBB(int $facing, PaintingMotive $motive) : AxisAlignedBB{ private static function getPaintingBB(int $facing, PaintingMotive $motive) : AxisAlignedBB{
$width = $motive->getWidth(); $width = $motive->getWidth();
@ -199,14 +193,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 World $world
* @param Vector3 $blockIn
* @param int $facing
* @param bool $checkOverlap
* @param PaintingMotive $motive
*
* @return bool
*/ */
public static function canFit(World $world, Vector3 $blockIn, int $facing, bool $checkOverlap, PaintingMotive $motive) : bool{ public static function canFit(World $world, 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

@ -106,16 +106,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;
} }
@ -161,16 +155,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

@ -116,8 +116,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;
@ -125,8 +123,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;
@ -134,7 +130,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);
@ -275,10 +270,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{
@ -288,8 +279,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{
@ -297,9 +286,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();
@ -327,9 +313,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 = clone $blockHit; $this->blockHit = clone $blockHit;

View File

@ -142,22 +142,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->potionId; return $this->potionId;
} }
/**
* @param int $id
*/
public function setPotionId(int $id) : void{ public function setPotionId(int $id) : void{
$this->potionId = $id; //TODO: validation $this->potionId = $id; //TODO: validation
} }
/** /**
* 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->linger; return $this->linger;
@ -165,8 +160,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->linger = $value; $this->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,13 +28,7 @@ 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
*/
public function setCancelled(bool $value = true) : void; public function setCancelled(bool $value = true) : void;
} }

View File

@ -31,16 +31,10 @@ trait CancellableTrait{
/** @var bool */ /** @var bool */
private $isCancelled = false; private $isCancelled = false;
/**
* @return bool
*/
public function isCancelled() : bool{ public function isCancelled() : bool{
return $this->isCancelled; return $this->isCancelled;
} }
/**
* @param bool $value
*/
public function setCancelled(bool $value = true) : void{ public function setCancelled(bool $value = true) : void{
$this->isCancelled = $value; $this->isCancelled = $value;
} }

View File

@ -36,9 +36,6 @@ abstract class Event{
/** @var string|null */ /** @var string|null */
protected $eventName = null; protected $eventName = null;
/**
* @return string
*/
final public function getEventName() : string{ final public function getEventName() : string{
return $this->eventName ?? get_class($this); return $this->eventName ?? get_class($this);
} }

View File

@ -81,10 +81,6 @@ final 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

@ -43,8 +43,6 @@ class HandlerList{
} }
/** /**
* @param RegisteredListener $listener
*
* @throws \Exception * @throws \Exception
*/ */
public function register(RegisteredListener $listener) : void{ public function register(RegisteredListener $listener) : void{
@ -89,17 +87,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

@ -61,8 +61,6 @@ class HandlerListManager{
/** /**
* @param ReflectionClass $class * @param ReflectionClass $class
* @phpstan-param \ReflectionClass<Event> $class * @phpstan-param \ReflectionClass<Event> $class
*
* @return bool
*/ */
private static function isValidClass(\ReflectionClass $class) : bool{ private static function isValidClass(\ReflectionClass $class) : bool{
$tags = Utils::parseDocComment((string) $class->getDocComment()); $tags = Utils::parseDocComment((string) $class->getDocComment());
@ -70,10 +68,8 @@ class HandlerListManager{
} }
/** /**
* @param \ReflectionClass $class
* @phpstan-param \ReflectionClass<Event> $class * @phpstan-param \ReflectionClass<Event> $class
* *
* @return \ReflectionClass|null
* @phpstan-return \ReflectionClass<Event>|null * @phpstan-return \ReflectionClass<Event>|null
*/ */
private static function resolveNearestHandleableParent(\ReflectionClass $class) : ?\ReflectionClass{ private static function resolveNearestHandleableParent(\ReflectionClass $class) : ?\ReflectionClass{
@ -88,9 +84,6 @@ class HandlerListManager{
* *
* 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 HandlerList
* @throws \ReflectionException * @throws \ReflectionException
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
*/ */

View File

@ -44,14 +44,6 @@ class RegisteredListener{
/** @var TimingsHandler */ /** @var TimingsHandler */
private $timings; private $timings;
/**
* @param \Closure $handler
* @param int $priority
* @param Plugin $plugin
* @param bool $handleCancelled
* @param TimingsHandler $timings
*/
public function __construct(\Closure $handler, int $priority, Plugin $plugin, bool $handleCancelled, TimingsHandler $timings){ public function __construct(\Closure $handler, int $priority, Plugin $plugin, bool $handleCancelled, TimingsHandler $timings){
if(!in_array($priority, EventPriority::ALL, true)){ if(!in_array($priority, EventPriority::ALL, true)){
throw new \InvalidArgumentException("Invalid priority number $priority"); throw new \InvalidArgumentException("Invalid priority number $priority");
@ -67,23 +59,14 @@ class RegisteredListener{
return $this->handler; return $this->handler;
} }
/**
* @return Plugin
*/
public function getPlugin() : Plugin{ public function getPlugin() : Plugin{
return $this->plugin; return $this->plugin;
} }
/**
* @return int
*/
public function getPriority() : int{ public function getPriority() : int{
return $this->priority; return $this->priority;
} }
/**
* @param Event $event
*/
public function callEvent(Event $event) : void{ public function callEvent(Event $event) : void{
if($event instanceof Cancellable and $event->isCancelled() and !$this->isHandlingCancelled()){ if($event instanceof Cancellable and $event->isCancelled() and !$this->isHandlingCancelled()){
return; return;
@ -97,9 +80,6 @@ class RegisteredListener{
$this->timings->remove(); $this->timings->remove();
} }
/**
* @return bool
*/
public function isHandlingCancelled() : bool{ public function isHandlingCancelled() : bool{
return $this->handleCancelled; return $this->handleCancelled;
} }

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