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

@@ -45,8 +45,6 @@ class ChunkCache implements ChunkListener{
/**
* Fetches the ChunkCache instance for the given world. This lazily creates cache systems as needed.
*
* @param World $world
*
* @return ChunkCache
*/
public static function getInstance(World $world) : self{
@@ -64,9 +62,6 @@ class ChunkCache implements ChunkListener{
/** @var int */
private $misses = 0;
/**
* @param World $world
*/
private function __construct(World $world){
$this->world = $world;
}
@@ -74,9 +69,6 @@ class ChunkCache implements ChunkListener{
/**
* Requests asynchronous preparation of the chunk at the given coordinates.
*
* @param int $chunkX
* @param int $chunkZ
*
* @return CompressBatchPromise a promise of resolution which will contain a compressed chunk packet.
*/
public function request(int $chunkX, int $chunkZ) : CompressBatchPromise{
@@ -125,9 +117,6 @@ class ChunkCache implements ChunkListener{
/**
* Restarts an async request for an unresolved chunk.
*
* @param int $chunkX
* @param int $chunkZ
*
* @throws \InvalidArgumentException
*/
private function restartPendingRequest(int $chunkX, int $chunkZ) : void{
@@ -143,9 +132,6 @@ class ChunkCache implements ChunkListener{
}
/**
* @param int $chunkX
* @param int $chunkZ
*
* @throws \InvalidArgumentException
*/
private function destroyOrRestart(int $chunkX, int $chunkZ) : void{
@@ -170,7 +156,6 @@ class ChunkCache implements ChunkListener{
/**
* @see ChunkListener::onChunkChanged()
* @param Chunk $chunk
*/
public function onChunkChanged(Chunk $chunk) : void{
//FIXME: this gets fired for stuff that doesn't change terrain related things (like lighting updates)
@@ -179,7 +164,6 @@ class ChunkCache implements ChunkListener{
/**
* @see ChunkListener::onBlockChanged()
* @param Vector3 $block
*/
public function onBlockChanged(Vector3 $block) : void{
//FIXME: requesters will still receive this chunk after it's been dropped, but we can't mark this for a simple
@@ -189,7 +173,6 @@ class ChunkCache implements ChunkListener{
/**
* @see ChunkListener::onChunkUnloaded()
* @param Chunk $chunk
*/
public function onChunkUnloaded(Chunk $chunk) : void{
$this->destroy($chunk->getX(), $chunk->getZ());
@@ -199,8 +182,6 @@ class ChunkCache implements ChunkListener{
/**
* Returns the number of bytes occupied by the cache data in this cache. This does not include the size of any
* promises referenced by the cache.
*
* @return int
*/
public function calculateCacheSize() : int{
$result = 0;
@@ -214,8 +195,6 @@ class ChunkCache implements ChunkListener{
/**
* Returns the percentage of requests to the cache which resulted in a cache hit.
*
* @return float
*/
public function getHitPercentage() : float{
$total = $this->hits + $this->misses;

View File

@@ -205,7 +205,6 @@ class NetworkSession{
/**
* TODO: this shouldn't be accessible after the initial login phase
*
* @param PlayerInfo $info
* @throws \InvalidStateException
*/
public function setPlayerInfo(PlayerInfo $info) : void{
@@ -221,16 +220,10 @@ class NetworkSession{
return $this->connected;
}
/**
* @return string
*/
public function getIp() : string{
return $this->ip;
}
/**
* @return int
*/
public function getPort() : int{
return $this->port;
}
@@ -241,8 +234,6 @@ class NetworkSession{
/**
* Returns the last recorded ping measurement for this session, in milliseconds.
*
* @return int
*/
public function getPing() : int{
return $this->ping;
@@ -250,8 +241,6 @@ class NetworkSession{
/**
* @internal Called by the network interface to update last recorded ping measurements.
*
* @param int $ping
*/
public function updatePing(int $ping) : void{
$this->ping = $ping;
@@ -269,8 +258,6 @@ class NetworkSession{
}
/**
* @param string $payload
*
* @throws BadPacketException
*/
public function handleEncoded(string $payload) : void{
@@ -323,8 +310,6 @@ class NetworkSession{
}
/**
* @param Packet $packet
*
* @throws BadPacketException
*/
public function handleDataPacket(Packet $packet) : void{
@@ -384,7 +369,6 @@ class NetworkSession{
/**
* @internal
* @param ClientboundPacket $packet
*/
public function addToSendBuffer(ClientboundPacket $packet) : void{
$timings = Timings::getSendDataPacketTimings($packet);
@@ -462,9 +446,6 @@ class NetworkSession{
/**
* Disconnects the session, destroying the associated player (if it exists).
*
* @param string $reason
* @param bool $notify
*/
public function disconnect(string $reason, bool $notify = true) : void{
$this->tryDisconnect(function() use ($reason, $notify){
@@ -478,10 +459,6 @@ class NetworkSession{
/**
* Instructs the remote client to connect to a different server.
*
* @param string $ip
* @param int $port
* @param string $reason
*
* @throws \UnsupportedOperationException
*/
public function transfer(string $ip, int $port, string $reason = "transfer") : void{
@@ -497,9 +474,6 @@ class NetworkSession{
/**
* Called by the Player when it is closed (for example due to getting kicked).
*
* @param string $reason
* @param bool $notify
*/
public function onPlayerDestroyed(string $reason, bool $notify = true) : void{
$this->tryDisconnect(function() use ($reason, $notify){
@@ -509,9 +483,6 @@ class NetworkSession{
/**
* Internal helper function used to handle server disconnections.
*
* @param string $reason
* @param bool $notify
*/
private function doServerDisconnect(string $reason, bool $notify = true) : void{
if($notify){
@@ -524,8 +495,6 @@ class NetworkSession{
/**
* Called by the network interface to close the session when the client disconnects without server input, for
* example in a timeout condition or voluntary client disconnect.
*
* @param string $reason
*/
public function onClientDisconnect(string $reason) : void{
$this->tryDisconnect(function() use ($reason){
@@ -662,8 +631,6 @@ class NetworkSession{
/**
* TODO: make this less specialized
*
* @param Player $for
*/
public function syncAdventureSettings(Player $for) : void{
$pk = new AdventureSettingsPacket();
@@ -763,8 +730,6 @@ class NetworkSession{
/**
* Instructs the networksession to start using the chunk at the given coordinates. This may occur asynchronously.
* @param int $chunkX
* @param int $chunkZ
* @param \Closure $onCompletion To be called when chunk sending has completed.
*/
public function startUsingChunk(int $chunkX, int $chunkZ, \Closure $onCompletion) : void{
@@ -805,9 +770,6 @@ class NetworkSession{
$world->sendDifficulty($this->player);
}
/**
* @return InventoryManager
*/
public function getInvManager() : InventoryManager{
return $this->invManager;
}
@@ -815,8 +777,6 @@ class NetworkSession{
/**
* TODO: expand this to more than just humans
* TODO: offhand
*
* @param Human $mob
*/
public function onMobEquipmentChange(Human $mob) : void{
//TODO: we could send zero for slot here because remote players don't need to know which slot was selected
@@ -891,9 +851,6 @@ class NetworkSession{
* This function takes care of handling gamemodes known to MCPE (as of 1.1.0.3, that includes Survival, Creative and Adventure)
*
* @internal
* @param GameMode $gamemode
*
* @return int
*/
public static function getClientFriendlyGamemode(GameMode $gamemode) : int{
if($gamemode->equals(GameMode::SPECTATOR())){

View File

@@ -36,7 +36,6 @@ class PacketBatch extends NetworkBinaryStream{
}
/**
* @return Packet
* @throws BinaryDataException
*/
public function getPacket() : Packet{

View File

@@ -27,16 +27,11 @@ interface PacketSender{
/**
* Pushes a packet into the channel to be processed.
*
* @param string $payload
* @param bool $immediate
*/
public function send(string $payload, bool $immediate) : void;
/**
* Closes the channel, terminating the connection.
*
* @param string $reason
*/
public function close(string $reason = "unknown reason") : void;
}

View File

@@ -111,10 +111,6 @@ class ProcessLoginTask extends AsyncTask{
}
/**
* @param string $jwt
* @param null|string $currentPublicKey
* @param bool $first
*
* @throws VerifyLoginException if errors are encountered
*/
private function validateToken(string $jwt, ?string &$currentPublicKey, bool $first = false) : void{

View File

@@ -82,9 +82,6 @@ class CompressBatchPromise{
return $this->result !== null;
}
/**
* @return bool
*/
public function isCancelled() : bool{
return $this->cancelled;
}

View File

@@ -34,11 +34,6 @@ class CompressBatchTask extends AsyncTask{
/** @var string */
private $data;
/**
* @param string $data
* @param int $compressionLevel
* @param CompressBatchPromise $promise
*/
public function __construct(string $data, int $compressionLevel, CompressBatchPromise $promise){
$this->data = $data;
$this->level = $compressionLevel;

View File

@@ -38,10 +38,8 @@ final class Zlib{
}
/**
* @param string $payload
* @param int $maxDecodedLength default 2MB
*
* @return string
* @throws \ErrorException
*/
public static function decompress(string $payload, int $maxDecodedLength = 1024 * 1024 * 2) : string{
@@ -49,10 +47,7 @@ final class Zlib{
}
/**
* @param string $payload
* @param int $compressionLevel
*
* @return string
*/
public static function compress(string $payload, ?int $compressionLevel = null) : string{
return zlib_encode($payload, ZLIB_ENCODING_DEFLATE, $compressionLevel ?? self::$LEVEL);

View File

@@ -65,9 +65,6 @@ class NetworkCipher{
}
/**
* @param string $encrypted
*
* @return string
* @throws \UnexpectedValueException
*/
public function decrypt(string $encrypted) : string{

View File

@@ -319,9 +319,6 @@ class InGamePacketHandler extends PacketHandler{
/**
* Internal function used to execute rollbacks when an action fails on a block.
*
* @param Vector3 $blockPos
* @param int|null $face
*/
private function onFailedBlockAction(Vector3 $blockPos, ?int $face) : void{
$this->session->getInvManager()->syncSlot($this->player->getInventory(), $this->player->getInventory()->getHeldItemIndex());
@@ -685,9 +682,6 @@ class InGamePacketHandler extends PacketHandler{
/**
* Hack to work around a stupid bug in Minecraft W10 which causes empty strings to be sent unquoted in form responses.
*
* @param string $json
* @param bool $assoc
*
* @return mixed
* @throws BadPacketException
*/

View File

@@ -151,9 +151,6 @@ class LoginPacketHandler extends PacketHandler{
* TODO: This is separated for the purposes of allowing plugins (like Specter) to hack it and bypass authentication.
* In the future this won't be necessary.
*
* @param LoginPacket $packet
* @param bool $authRequired
*
* @throws \InvalidArgumentException
*/
protected function processLogin(LoginPacket $packet, bool $authRequired) : void{

View File

@@ -39,9 +39,6 @@ class AddEntityPacket extends DataPacket implements ClientboundPacket{
return $result;
}
/**
* @return int
*/
public function getUvarint1() : int{
return $this->uvarint1;
}

View File

@@ -150,7 +150,6 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
/**
* @param string[] $enumValueList
*
* @return CommandEnum
* @throws BadPacketException
* @throws BinaryDataException
*/
@@ -173,7 +172,6 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
}
/**
* @return CommandEnum
* @throws BinaryDataException
*/
protected function getSoftEnum() : CommandEnum{
@@ -189,7 +187,6 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
}
/**
* @param CommandEnum $enum
* @param int[] $enumValueMap
*/
protected function putEnum(CommandEnum $enum, array $enumValueMap) : void{
@@ -218,9 +215,6 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
}
/**
* @param int $valueCount
*
* @return int
* @throws BinaryDataException
*/
protected function getEnumValueIndex(int $valueCount) : int{
@@ -247,7 +241,6 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
* @param CommandEnum[] $enums
* @param string[] $enumValues
*
* @return CommandEnumConstraint
* @throws BadPacketException
* @throws BinaryDataException
*/
@@ -276,7 +269,6 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
}
/**
* @param CommandEnumConstraint $constraint
* @param int[] $enumIndexes string enum name -> int index
* @param int[] $enumValueIndexes string value -> int index
*/
@@ -293,7 +285,6 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
* @param CommandEnum[] $enums
* @param string[] $postfixes
*
* @return CommandData
* @throws BadPacketException
* @throws BinaryDataException
*/
@@ -338,7 +329,6 @@ class AvailableCommandsPacket extends DataPacket implements ClientboundPacket{
}
/**
* @param CommandData $data
* @param int[] $enumIndexes string enum name -> int index
* @param int[] $postfixIndexes
*/

View File

@@ -39,8 +39,6 @@ class ClientCacheBlobStatusPacket extends DataPacket implements ServerboundPacke
/**
* @param int[] $hitHashes
* @param int[] $missHashes
*
* @return self
*/
public static function create(array $hitHashes, array $missHashes) : self{
//type checks

View File

@@ -37,8 +37,6 @@ class ClientCacheMissResponsePacket extends DataPacket implements ClientboundPac
/**
* @param ChunkCacheBlob[] $blobs
*
* @return self
*/
public static function create(array $blobs) : self{
//type check

View File

@@ -39,9 +39,6 @@ class ClientCacheStatusPacket extends DataPacket implements ServerboundPacket{
return $result;
}
/**
* @return bool
*/
public function isEnabled() : bool{
return $this->enabled;
}

View File

@@ -60,7 +60,6 @@ class CommandOutputPacket extends DataPacket implements ClientboundPacket{
}
/**
* @return CommandOutputMessage
* @throws BinaryDataException
*/
protected function getCommandMessage() : CommandOutputMessage{

View File

@@ -163,10 +163,6 @@ class CraftingDataPacket extends DataPacket implements ClientboundPacket{
/**
* @param object $entry
* @param NetworkBinaryStream $stream
* @param int $pos
*
* @return int
*/
private static function writeEntry($entry, NetworkBinaryStream $stream, int $pos) : int{
if($entry instanceof ShapelessRecipe){

View File

@@ -49,7 +49,6 @@ class EmotePacket extends DataPacket implements ClientboundPacket, ServerboundPa
/**
* TODO: we can't call this getEntityRuntimeId() because of base class collision (crap architecture, thanks Shoghi)
* @return int
*/
public function getEntityRuntimeIdField() : int{
return $this->entityRuntimeId;

View File

@@ -38,7 +38,6 @@ class InventoryContentPacket extends DataPacket implements ClientboundPacket{
public $items = [];
/**
* @param int $windowId
* @param Item[] $items
*
* @return InventoryContentPacket

View File

@@ -70,30 +70,18 @@ class LevelChunkPacket extends DataPacket implements ClientboundPacket{
return $result;
}
/**
* @return int
*/
public function getChunkX() : int{
return $this->chunkX;
}
/**
* @return int
*/
public function getChunkZ() : int{
return $this->chunkZ;
}
/**
* @return int
*/
public function getSubChunkCount() : int{
return $this->subChunkCount;
}
/**
* @return bool
*/
public function isCacheEnabled() : bool{
return $this->cacheEnabled;
}
@@ -105,9 +93,6 @@ class LevelChunkPacket extends DataPacket implements ClientboundPacket{
return $this->usedBlobHashes;
}
/**
* @return string
*/
public function getExtraPayload() : string{
return $this->extraPayload;
}

View File

@@ -45,16 +45,10 @@ class LevelEventGenericPacket extends DataPacket implements ClientboundPacket{
return $result;
}
/**
* @return int
*/
public function getEventId() : int{
return $this->eventId;
}
/**
* @return string
*/
public function getEventData() : string{
return $this->eventData;
}

View File

@@ -109,8 +109,6 @@ class LoginPacket extends DataPacket implements ServerboundPacket{
}
/**
* @param Validator $v
* @param string $name
* @param mixed $data
*
* @throws BadPacketException

View File

@@ -56,9 +56,6 @@ class MoveActorDeltaPacket extends DataPacket implements ClientboundPacket{
public $zRot = 0.0;
/**
* @param int $flag
*
* @return int
* @throws BinaryDataException
*/
private function maybeReadCoord(int $flag) : int{
@@ -69,9 +66,6 @@ class MoveActorDeltaPacket extends DataPacket implements ClientboundPacket{
}
/**
* @param int $flag
*
* @return float
* @throws BinaryDataException
*/
private function maybeReadRotation(int $flag) : float{

View File

@@ -34,9 +34,6 @@ interface Packet{
* TODO: this can't have a native return type yet because of incompatibility with BinaryUtils
* really this should be addressed by making packets not extend BinaryStream, but that's a task for another day.
*
* @param string $buffer
* @param int $offset
*
* @return void
*/
public function setBuffer(string $buffer = "", int $offset = 0);
@@ -47,7 +44,6 @@ interface Packet{
/**
* Returns whether the offset has reached the end of the buffer.
* @return bool
*/
public function feof() : bool;
@@ -74,8 +70,6 @@ interface Packet{
* Typically this method returns the return value of the handler in the supplied PacketHandler. See other packets
* for examples how to implement this.
*
* @param PacketHandler $handler
*
* @return bool true if the packet was handled successfully, false if not.
* @throws BadPacketException if broken data was found in the packet
*/

View File

@@ -177,26 +177,15 @@ class PacketPool{
static::registerPacket(new PlayerAuthInputPacket());
}
/**
* @param Packet $packet
*/
public static function registerPacket(Packet $packet) : void{
static::$pool[$packet->pid()] = clone $packet;
}
/**
* @param int $pid
*
* @return Packet
*/
public static function getPacketById(int $pid) : Packet{
return isset(static::$pool[$pid]) ? clone static::$pool[$pid] : new UnknownPacket();
}
/**
* @param string $buffer
*
* @return Packet
* @throws BinaryDataException
*/
public static function getPacket(string $buffer) : Packet{

View File

@@ -56,18 +56,9 @@ class PlayerAuthInputPacket extends DataPacket implements ServerboundPacket{
private $vrGazeDirection = null;
/**
* @param Vector3 $position
* @param float $pitch
* @param float $yaw
* @param float $headYaw
* @param float $moveVecX
* @param float $moveVecZ
* @param int $inputFlags
* @param int $inputMode @see InputMode
* @param int $playMode @see PlayMode
* @param Vector3|null $vrGazeDirection only used when PlayMode::VR
*
* @return self
*/
public static function create(Vector3 $position, float $pitch, float $yaw, float $headYaw, float $moveVecX, float $moveVecZ, int $inputFlags, int $inputMode, int $playMode, ?Vector3 $vrGazeDirection = null) : self{
if($playMode === PlayMode::VR and $vrGazeDirection === null){
@@ -120,7 +111,6 @@ class PlayerAuthInputPacket extends DataPacket implements ServerboundPacket{
/**
* @see InputMode
* @return int
*/
public function getInputMode() : int{
return $this->inputMode;
@@ -128,7 +118,6 @@ class PlayerAuthInputPacket extends DataPacket implements ServerboundPacket{
/**
* @see PlayMode
* @return int
*/
public function getPlayMode() : int{
return $this->playMode;

View File

@@ -39,9 +39,6 @@ class RemoveEntityPacket extends DataPacket implements ClientboundPacket{
return $result;
}
/**
* @return int
*/
public function getUvarint1() : int{
return $this->uvarint1;
}

View File

@@ -50,8 +50,6 @@ class ResourcePackStackPacket extends DataPacket implements ClientboundPacket{
/**
* @param ResourcePackStackEntry[] $resourcePacks
* @param ResourcePackStackEntry[] $behaviorPacks
* @param bool $mustAccept
* @param bool $isExperimental
*
* @return ResourcePackStackPacket
*/

View File

@@ -45,8 +45,6 @@ class ResourcePacksInfoPacket extends DataPacket implements ClientboundPacket{
/**
* @param ResourcePackInfoEntry[] $resourcePacks
* @param ResourcePackInfoEntry[] $behaviorPacks
* @param bool $mustAccept
* @param bool $hasScripts
*
* @return ResourcePacksInfoPacket
*/

View File

@@ -79,7 +79,6 @@ class TextPacket extends DataPacket implements ClientboundPacket, ServerboundPac
}
/**
* @param string $key
* @param string[] $parameters
*
* @return TextPacket
@@ -93,7 +92,6 @@ class TextPacket extends DataPacket implements ClientboundPacket, ServerboundPac
}
/**
* @param string $key
* @param string[] $parameters
*
* @return TextPacket
@@ -103,7 +101,6 @@ class TextPacket extends DataPacket implements ClientboundPacket, ServerboundPac
}
/**
* @param string $key
* @param string[] $parameters
*
* @return TextPacket

View File

@@ -39,7 +39,6 @@ class UpdateAttributesPacket extends DataPacket implements ClientboundPacket{
public $entries = [];
/**
* @param int $entityRuntimeId
* @param Attribute[] $attributes
*
* @return UpdateAttributesPacket

View File

@@ -31,25 +31,16 @@ class ChunkCacheBlob{
/**
* ChunkCacheBlob constructor.
*
* @param int $hash
* @param string $payload
*/
public function __construct(int $hash, string $payload){
$this->hash = $hash;
$this->payload = $payload;
}
/**
* @return int
*/
public function getHash() : int{
return $this->hash;
}
/**
* @return string
*/
public function getPayload() : string{
return $this->payload;
}

View File

@@ -128,12 +128,6 @@ final class RuntimeBlockMapping{
return $table;
}
/**
* @param int $id
* @param int $meta
*
* @return int
*/
public static function toStaticRuntimeId(int $id, int $meta = 0) : int{
self::lazyInit();
/*
@@ -145,8 +139,6 @@ final class RuntimeBlockMapping{
}
/**
* @param int $runtimeId
*
* @return int[] [id, meta]
*/
public static function fromStaticRuntimeId(int $runtimeId) : array{

View File

@@ -32,17 +32,11 @@ interface SkinAdapter{
/**
* Allows you to convert a skin entity to skin data.
*
* @param Skin $skin
* @return SkinData
*/
public function toSkinData(Skin $skin) : SkinData;
/**
* Allows you to convert skin data to a skin entity.
*
* @param SkinData $data
* @return Skin
*/
public function fromSkinData(SkinData $data) : Skin;
}

View File

@@ -44,8 +44,6 @@ class SkinAnimation{
/**
* Image of the animation.
*
* @return SkinImage
*/
public function getImage() : SkinImage{
return $this->image;
@@ -53,8 +51,6 @@ class SkinAnimation{
/**
* The type of animation you are applying.
*
* @return int
*/
public function getType() : int{
return $this->type;
@@ -62,8 +58,6 @@ class SkinAnimation{
/**
* The total amount of frames in an animation.
*
* @return float
*/
public function getFrames() : float{
return $this->frames;

View File

@@ -49,17 +49,7 @@ class SkinData{
private $capeId;
/**
* @param string $skinId
* @param string $resourcePatch
* @param SkinImage $skinImage
* @param SkinAnimation[] $animations
* @param SkinImage|null $capeImage
* @param string $geometryData
* @param string $animationData
* @param bool $premium
* @param bool $persona
* @param bool $personaCapeOnClassic
* @param string $capeId
*/
public function __construct(string $skinId, string $resourcePatch, SkinImage $skinImage, array $animations = [], SkinImage $capeImage = null, string $geometryData = "", string $animationData = "", bool $premium = false, bool $persona = false, bool $personaCapeOnClassic = false, string $capeId = ""){
$this->skinId = $skinId;
@@ -75,23 +65,14 @@ class SkinData{
$this->capeId = $capeId;
}
/**
* @return string
*/
public function getSkinId() : string{
return $this->skinId;
}
/**
* @return string
*/
public function getResourcePatch() : string{
return $this->resourcePatch;
}
/**
* @return SkinImage
*/
public function getSkinImage() : SkinImage{
return $this->skinImage;
}
@@ -103,51 +84,30 @@ class SkinData{
return $this->animations;
}
/**
* @return SkinImage
*/
public function getCapeImage() : SkinImage{
return $this->capeImage;
}
/**
* @return string
*/
public function getGeometryData() : string{
return $this->geometryData;
}
/**
* @return string
*/
public function getAnimationData() : string{
return $this->animationData;
}
/**
* @return bool
*/
public function isPersona() : bool{
return $this->persona;
}
/**
* @return bool
*/
public function isPremium() : bool{
return $this->premium;
}
/**
* @return bool
*/
public function isPersonaCapeOnClassic() : bool{
return $this->personaCapeOnClassic;
}
/**
* @return string
*/
public function getCapeId() : string{
return $this->capeId;
}

View File

@@ -38,11 +38,6 @@ class CommandData{
public $overloads = [];
/**
* @param string $name
* @param string $description
* @param int $flags
* @param int $permission
* @param CommandEnum|null $aliases
* @param CommandParameter[][] $overloads
*/
public function __construct(string $name, string $description, int $flags, int $permission, ?CommandEnum $aliases, array $overloads){
@@ -59,37 +54,22 @@ class CommandData{
$this->overloads = $overloads;
}
/**
* @return string
*/
public function getName() : string{
return $this->name;
}
/**
* @return string
*/
public function getDescription() : string{
return $this->description;
}
/**
* @return int
*/
public function getFlags() : int{
return $this->flags;
}
/**
* @return int
*/
public function getPermission() : int{
return $this->permission;
}
/**
* @return CommandEnum|null
*/
public function getAliases() : ?CommandEnum{
return $this->aliases;
}

View File

@@ -30,7 +30,6 @@ class CommandEnum{
private $enumValues = [];
/**
* @param string $enumName
* @param string[] $enumValues
*/
public function __construct(string $enumName, array $enumValues){
@@ -38,9 +37,6 @@ class CommandEnum{
$this->enumValues = $enumValues;
}
/**
* @return string
*/
public function getName() : string{
return $this->enumName;
}

View File

@@ -32,8 +32,6 @@ class CommandEnumConstraint{
private $constraints; //TODO: find constants
/**
* @param CommandEnum $enum
* @param int $valueOffset
* @param int[] $constraints
*/
public function __construct(CommandEnum $enum, int $valueOffset, array $constraints){

View File

@@ -31,16 +31,10 @@ final class BlockPosMetadataProperty implements MetadataProperty{
/** @var Vector3 */
private $value;
/**
* @param Vector3 $value
*/
public function __construct(Vector3 $value){
$this->value = $value->floor();
}
/**
* @return Vector3
*/
public function getValue() : Vector3{
return $this->value;
}

View File

@@ -34,16 +34,10 @@ final class CompoundTagMetadataProperty implements MetadataProperty{
/** @var CompoundTag */
private $value;
/**
* @param CompoundTag $value
*/
public function __construct(CompoundTag $value){
$this->value = clone $value;
}
/**
* @return CompoundTag
*/
public function getValue() : CompoundTag{
return clone $this->value;
}
@@ -57,9 +51,6 @@ final class CompoundTagMetadataProperty implements MetadataProperty{
}
/**
* @param NetworkBinaryStream $in
*
* @return self
* @throws BadPacketException
*/
public static function read(NetworkBinaryStream $in) : self{

View File

@@ -38,93 +38,43 @@ class EntityMetadataCollection{
}
/**
* @param int $key
* @param int $value
* @param bool $force
*/
public function setByte(int $key, int $value, bool $force = false) : void{
$this->set($key, new ByteMetadataProperty($value), $force);
}
/**
* @param int $key
* @param int $value
* @param bool $force
*/
public function setShort(int $key, int $value, bool $force = false) : void{
$this->set($key, new ShortMetadataProperty($value), $force);
}
/**
* @param int $key
* @param int $value
* @param bool $force
*/
public function setInt(int $key, int $value, bool $force = false) : void{
$this->set($key, new IntMetadataProperty($value), $force);
}
/**
* @param int $key
* @param float $value
* @param bool $force
*/
public function setFloat(int $key, float $value, bool $force = false) : void{
$this->set($key, new FloatMetadataProperty($value), $force);
}
/**
* @param int $key
* @param string $value
* @param bool $force
*/
public function setString(int $key, string $value, bool $force = false) : void{
$this->set($key, new StringMetadataProperty($value), $force);
}
/**
* @param int $key
* @param CompoundTag $value
* @param bool $force
*/
public function setCompoundTag(int $key, CompoundTag $value, bool $force = false) : void{
$this->set($key, new CompoundTagMetadataProperty($value), $force);
}
/**
* @param int $key
* @param null|Vector3 $value
* @param bool $force
*/
public function setBlockPos(int $key, ?Vector3 $value, bool $force = false) : void{
$this->set($key, new BlockPosMetadataProperty($value ?? new Vector3(0, 0, 0)), $force);
}
/**
* @param int $key
* @param int $value
* @param bool $force
*/
public function setLong(int $key, int $value, bool $force = false) : void{
$this->set($key, new LongMetadataProperty($value), $force);
}
/**
* @param int $key
* @param null|Vector3 $value
* @param bool $force
*/
public function setVector3(int $key, ?Vector3 $value, bool $force = false) : void{
$this->set($key, new Vec3MetadataProperty($value ?? new Vector3(0, 0, 0)), $force);
}
/**
* @param int $key
* @param MetadataProperty $value
* @param bool $force
*/
public function set(int $key, MetadataProperty $value, bool $force = false) : void{
if(!$force and isset($this->properties[$key]) and !($this->properties[$key] instanceof $value)){
throw new \InvalidArgumentException("Can't overwrite property with mismatching types (have " . get_class($this->properties[$key]) . ")");

View File

@@ -30,16 +30,10 @@ final class FloatMetadataProperty implements MetadataProperty{
/** @var float */
private $value;
/**
* @param float $value
*/
public function __construct(float $value){
$this->value = $value;
}
/**
* @return float
*/
public function getValue() : float{
return $this->value;
}

View File

@@ -27,9 +27,6 @@ trait IntegerishMetadataProperty{
/** @var int */
private $value;
/**
* @param int $value
*/
public function __construct(int $value){
if($value < $this->min() or $value > $this->max()){
throw new \InvalidArgumentException("Value is out of range " . $this->min() . " - " . $this->max());
@@ -41,9 +38,6 @@ trait IntegerishMetadataProperty{
abstract protected function max() : int;
/**
* @return int
*/
public function getValue() : int{
return $this->value;
}

View File

@@ -29,9 +29,6 @@ final class StringMetadataProperty implements MetadataProperty{
/** @var string */
private $value;
/**
* @param string $value
*/
public function __construct(string $value){
$this->value = $value;
}

View File

@@ -30,16 +30,10 @@ class Vec3MetadataProperty implements MetadataProperty{
/** @var Vector3 */
private $value;
/**
* @param Vector3 $value
*/
public function __construct(Vector3 $value){
$this->value = $value->asVector3();
}
/**
* @return Vector3
*/
public function getValue() : Vector3{
return clone $this->value;
}

View File

@@ -88,8 +88,6 @@ class NetworkInventoryAction{
public $newItem;
/**
* @param NetworkBinaryStream $packet
*
* @return $this
*
* @throws BinaryDataException
@@ -122,8 +120,6 @@ class NetworkInventoryAction{
}
/**
* @param NetworkBinaryStream $packet
*
* @throws \InvalidArgumentException
*/
public function write(NetworkBinaryStream $packet) : void{
@@ -151,10 +147,6 @@ class NetworkInventoryAction{
}
/**
* @param Player $player
*
* @return InventoryAction|null
*
* @throws \UnexpectedValueException
*/
public function createInventoryAction(Player $player) : ?InventoryAction{

View File

@@ -41,30 +41,18 @@ class ReleaseItemTransactionData extends TransactionData{
/** @var Vector3 */
private $headPos;
/**
* @return int
*/
public function getActionType() : int{
return $this->actionType;
}
/**
* @return int
*/
public function getHotbarSlot() : int{
return $this->hotbarSlot;
}
/**
* @return Item
*/
public function getItemInHand() : Item{
return $this->itemInHand;
}
/**
* @return Vector3
*/
public function getHeadPos() : Vector3{
return $this->headPos;
}

View File

@@ -39,14 +39,9 @@ abstract class TransactionData{
return $this->actions;
}
/**
* @return int
*/
abstract public function getTypeId() : int;
/**
* @param NetworkBinaryStream $stream
*
* @throws BinaryDataException
* @throws BadPacketException
*/
@@ -59,8 +54,6 @@ abstract class TransactionData{
}
/**
* @param NetworkBinaryStream $stream
*
* @throws BinaryDataException
* @throws BadPacketException
*/

View File

@@ -45,44 +45,26 @@ class UseItemOnEntityTransactionData extends TransactionData{
/** @var Vector3 */
private $clickPos;
/**
* @return int
*/
public function getEntityRuntimeId() : int{
return $this->entityRuntimeId;
}
/**
* @return int
*/
public function getActionType() : int{
return $this->actionType;
}
/**
* @return int
*/
public function getHotbarSlot() : int{
return $this->hotbarSlot;
}
/**
* @return Item
*/
public function getItemInHand() : Item{
return $this->itemInHand;
}
/**
* @return Vector3
*/
public function getPlayerPos() : Vector3{
return $this->playerPos;
}
/**
* @return Vector3
*/
public function getClickPos() : Vector3{
return $this->clickPos;
}

View File

@@ -50,58 +50,34 @@ class UseItemTransactionData extends TransactionData{
/** @var int */
private $blockRuntimeId;
/**
* @return int
*/
public function getActionType() : int{
return $this->actionType;
}
/**
* @return Vector3
*/
public function getBlockPos() : Vector3{
return $this->blockPos;
}
/**
* @return int
*/
public function getFace() : int{
return $this->face;
}
/**
* @return int
*/
public function getHotbarSlot() : int{
return $this->hotbarSlot;
}
/**
* @return Item
*/
public function getItemInHand() : Item{
return $this->itemInHand;
}
/**
* @return Vector3
*/
public function getPlayerPos() : Vector3{
return $this->playerPos;
}
/**
* @return Vector3
*/
public function getClickPos() : Vector3{
return $this->clickPos;
}
/**
* @return int
*/
public function getBlockRuntimeId() : int{
return $this->blockRuntimeId;
}

View File

@@ -52,51 +52,30 @@ class ResourcePackInfoEntry{
$this->hasScripts = $hasScripts;
}
/**
* @return string
*/
public function getPackId() : string{
return $this->packId;
}
/**
* @return string
*/
public function getVersion() : string{
return $this->version;
}
/**
* @return int
*/
public function getSizeBytes() : int{
return $this->sizeBytes;
}
/**
* @return string
*/
public function getEncryptionKey() : string{
return $this->encryptionKey;
}
/**
* @return string
*/
public function getSubPackName() : string{
return $this->subPackName;
}
/**
* @return string
*/
public function getContentId() : string{
return $this->contentId;
}
/**
* @return bool
*/
public function hasScripts() : bool{
return $this->hasScripts;
}

View File

@@ -40,23 +40,14 @@ class ResourcePackStackEntry{
$this->subPackName = $subPackName;
}
/**
* @return string
*/
public function getPackId() : string{
return $this->packId;
}
/**
* @return string
*/
public function getVersion() : string{
return $this->version;
}
/**
* @return string
*/
public function getSubPackName() : string{
return $this->subPackName;
}

View File

@@ -38,9 +38,6 @@ final class ChunkSerializer{
/**
* Returns the number of subchunks that will be sent from the given chunk.
* Chunks are sent in a stack, so every chunk below the top non-empty one must be sent.
* @param Chunk $chunk
*
* @return int
*/
public static function getSubChunkCount(Chunk $chunk) : int{
for($count = $chunk->getSubChunks()->count(); $count > 0; --$count){
@@ -53,13 +50,6 @@ final class ChunkSerializer{
return $count;
}
/**
* @param Chunk $chunk
*
* @param string|null $tiles
*
* @return string
*/
public static function serialize(Chunk $chunk, ?string $tiles = null) : string{
$stream = new NetworkBinaryStream();
$subChunkCount = self::getSubChunkCount($chunk);

View File

@@ -64,7 +64,6 @@ class NetworkBinaryStream extends BinaryStream{
private const DAMAGE_TAG_CONFLICT_RESOLUTION = "___Damage_ProtocolCollisionResolution___";
/**
* @return string
* @throws BinaryDataException
*/
public function getString() : string{
@@ -77,7 +76,6 @@ class NetworkBinaryStream extends BinaryStream{
}
/**
* @return UUID
* @throws BinaryDataException
*/
public function getUUID() : UUID{
@@ -162,8 +160,6 @@ class NetworkBinaryStream extends BinaryStream{
}
/**
* @return Item
*
* @throws BadPacketException
* @throws BinaryDataException
*/
@@ -401,7 +397,6 @@ class NetworkBinaryStream extends BinaryStream{
/**
* Reads and returns an EntityUniqueID
* @return int
*
* @throws BinaryDataException
*/
@@ -411,8 +406,6 @@ class NetworkBinaryStream extends BinaryStream{
/**
* Writes an EntityUniqueID
*
* @param int $eid
*/
public function putEntityUniqueId(int $eid) : void{
$this->putVarLong($eid);
@@ -420,7 +413,6 @@ class NetworkBinaryStream extends BinaryStream{
/**
* Reads and returns an EntityRuntimeID
* @return int
*
* @throws BinaryDataException
*/
@@ -430,8 +422,6 @@ class NetworkBinaryStream extends BinaryStream{
/**
* Writes an EntityRuntimeID
*
* @param int $eid
*/
public function putEntityRuntimeId(int $eid) : void{
$this->putUnsignedVarLong($eid);
@@ -454,10 +444,6 @@ class NetworkBinaryStream extends BinaryStream{
/**
* Writes a block position with unsigned Y coordinate.
*
* @param int $x
* @param int $y
* @param int $z
*/
public function putBlockPosition(int $x, int $y, int $z) : void{
$this->putVarInt($x);
@@ -482,10 +468,6 @@ class NetworkBinaryStream extends BinaryStream{
/**
* Writes a block position with a signed Y coordinate.
*
* @param int $x
* @param int $y
* @param int $z
*/
public function putSignedBlockPosition(int $x, int $y, int $z) : void{
$this->putVarInt($x);
@@ -496,8 +478,6 @@ class NetworkBinaryStream extends BinaryStream{
/**
* Reads a floating-point Vector3 object with coordinates rounded to 4 decimal places.
*
* @return Vector3
*
* @throws BinaryDataException
*/
public function getVector3() : Vector3{
@@ -515,8 +495,6 @@ class NetworkBinaryStream extends BinaryStream{
* For all other purposes, use the non-nullable version.
*
* @see NetworkBinaryStream::putVector3()
*
* @param Vector3|null $vector
*/
public function putVector3Nullable(?Vector3 $vector) : void{
if($vector){
@@ -530,8 +508,6 @@ class NetworkBinaryStream extends BinaryStream{
/**
* Writes a floating-point Vector3 object
*
* @param Vector3 $vector
*/
public function putVector3(Vector3 $vector) : void{
$this->putLFloat($vector->x);
@@ -540,7 +516,6 @@ class NetworkBinaryStream extends BinaryStream{
}
/**
* @return float
* @throws BinaryDataException
*/
public function getByteRotation() : float{
@@ -590,8 +565,6 @@ class NetworkBinaryStream extends BinaryStream{
/**
* Writes a gamerule array, members should be in the structure [name => [type, value]]
* TODO: implement this properly
*
* @param array $rules
*/
public function putGameRules(array $rules) : void{
$this->putUnsignedVarInt(count($rules));
@@ -615,8 +588,6 @@ class NetworkBinaryStream extends BinaryStream{
}
/**
* @return EntityLink
*
* @throws BinaryDataException
*/
protected function getEntityLink() : EntityLink{
@@ -630,9 +601,6 @@ class NetworkBinaryStream extends BinaryStream{
return $link;
}
/**
* @param EntityLink $link
*/
protected function putEntityLink(EntityLink $link) : void{
$this->putEntityUniqueId($link->fromEntityUniqueId);
$this->putEntityUniqueId($link->toEntityUniqueId);
@@ -641,7 +609,6 @@ class NetworkBinaryStream extends BinaryStream{
}
/**
* @return CommandOriginData
* @throws BinaryDataException
*/
protected function getCommandOriginData() : CommandOriginData{