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

@ -43,16 +43,12 @@ abstract class BaseInventory implements Inventory{
/** @var InventoryChangeListener[] */
protected $listeners = [];
/**
* @param int $size
*/
public function __construct(int $size){
$this->slots = new \SplFixedArray($size);
}
/**
* Returns the size of the inventory.
* @return int
*/
public function getSize() : int{
return $this->slots->getSize();
@ -67,8 +63,6 @@ abstract class BaseInventory implements Inventory{
}
/**
* @param bool $includeEmpty
*
* @return Item[]
*/
public function getContents(bool $includeEmpty = false) : array{
@ -87,7 +81,6 @@ abstract class BaseInventory implements Inventory{
/**
* @param Item[] $items
* @param bool $send
*/
public function setContents(array $items, bool $send = true) : void{
if(count($items) > $this->getSize()){

View File

@ -33,9 +33,6 @@ use function count;
class ChestInventory extends BlockInventory{
/**
* @param Position $holder
*/
public function __construct(Position $holder){
parent::__construct($holder, 27);
}

View File

@ -67,11 +67,6 @@ final class CreativeInventory{
return self::$creative;
}
/**
* @param int $index
*
* @return Item|null
*/
public static function getItem(int $index) : ?Item{
return self::$creative[$index] ?? null;
}
@ -89,8 +84,6 @@ final class CreativeInventory{
/**
* Adds an item to the creative menu.
* Note: Players who are already online when this is called will not see this change.
*
* @param Item $item
*/
public static function add(Item $item) : void{
self::$creative[] = clone $item;
@ -99,8 +92,6 @@ final class CreativeInventory{
/**
* Removes an item from the creative menu.
* Note: Players who are already online when this is called will not see this change.
*
* @param Item $item
*/
public static function remove(Item $item) : void{
$index = self::getItemIndex($item);

View File

@ -87,16 +87,10 @@ class DoubleChestInventory extends ChestInventory implements InventoryHolder{
parent::onClose($who);
}
/**
* @return ChestInventory
*/
public function getLeftSide() : ChestInventory{
return $this->left;
}
/**
* @return ChestInventory
*/
public function getRightSide() : ChestInventory{
return $this->right;
}

View File

@ -34,9 +34,6 @@ class EnderChestInventory extends ChestInventory{
parent::__construct(new Position(0, 0, 0, null));
}
/**
* @param Position $pos
*/
public function setHolderPosition(Position $pos) : void{
$this->holder = $pos->asPosition();
}

View File

@ -32,44 +32,26 @@ class FurnaceInventory extends BlockInventory{
parent::__construct($holder, 3);
}
/**
* @return Item
*/
public function getResult() : Item{
return $this->getItem(2);
}
/**
* @return Item
*/
public function getFuel() : Item{
return $this->getItem(1);
}
/**
* @return Item
*/
public function getSmelting() : Item{
return $this->getItem(0);
}
/**
* @param Item $item
*/
public function setResult(Item $item) : void{
$this->setItem(2, $item);
}
/**
* @param Item $item
*/
public function setFuel(Item $item) : void{
$this->setItem(1, $item);
}
/**
* @param Item $item
*/
public function setSmelting(Item $item) : void{
$this->setItem(0, $item);
}

View File

@ -32,34 +32,16 @@ use pocketmine\player\Player;
interface Inventory{
public const MAX_STACK = 64;
/**
* @return int
*/
public function getSize() : int;
/**
* @return int
*/
public function getMaxStackSize() : int;
/**
* @param int $size
*/
public function setMaxStackSize(int $size) : void;
/**
* @param int $index
*
* @return Item
*/
public function getItem(int $index) : Item;
/**
* Puts an Item in a slot.
*
* @param int $index
* @param Item $item
* @param bool $send
*/
public function setItem(int $index, Item $item, bool $send = true) : void;
@ -77,10 +59,6 @@ interface Inventory{
/**
* Checks if a given Item can be added to the inventory
*
* @param Item $item
*
* @return bool
*/
public function canAddItem(Item $item) : bool;
@ -95,25 +73,18 @@ interface Inventory{
public function removeItem(Item ...$slots) : array;
/**
* @param bool $includeEmpty
*
* @return Item[]
*/
public function getContents(bool $includeEmpty = false) : array;
/**
* @param Item[] $items
* @param bool $send
*/
public function setContents(array $items, bool $send = true) : void;
/**
* Checks if the inventory contains any Item with the same material data.
* It will check id, amount, and metadata (if not null)
*
* @param Item $item
*
* @return bool
*/
public function contains(Item $item) : bool;
@ -121,8 +92,6 @@ interface Inventory{
* Will return all the Items that has the same id and metadata (if not null).
* Won't check amount
*
* @param Item $item
*
* @return Item[]
*/
public function all(Item $item) : array;
@ -132,57 +101,36 @@ interface Inventory{
* and count >= to the count of the specified item stack.
*
* If $exact is true, only items with equal ID, damage, NBT and count will match.
*
* @param Item $item
* @param bool $exact
*
* @return int
*/
public function first(Item $item, bool $exact = false) : int;
/**
* Returns the first empty slot, or -1 if not found
*
* @return int
*/
public function firstEmpty() : int;
/**
* Returns whether the given slot is empty.
*
* @param int $index
*
* @return bool
*/
public function isSlotEmpty(int $index) : bool;
/**
* Will remove all the Items that has the same id and metadata (if not null)
*
* @param Item $item
*/
public function remove(Item $item) : void;
/**
* Will clear a specific slot
*
* @param int $index
* @param bool $send
*/
public function clear(int $index, bool $send = true) : void;
/**
* Clears all the slots
*
* @param bool $send
*/
public function clearAll(bool $send = true) : void;
/**
* Swaps the specified slots.
*
* @param int $slot1
* @param int $slot2
*/
public function swap(int $slot1, int $slot2) : void;
@ -196,8 +144,6 @@ interface Inventory{
/**
* Called when a player opens this inventory.
*
* @param Player $who
*/
public function onOpen(Player $who) : void;
@ -205,10 +151,6 @@ interface Inventory{
/**
* Returns whether the specified slot exists in the inventory.
*
* @param int $slot
*
* @return bool
*/
public function slotExists(int $slot) : bool;

View File

@ -35,9 +35,6 @@ class PlayerInventory extends BaseInventory{
/** @var int */
protected $itemInHandIndex = 0;
/**
* @param Human $player
*/
public function __construct(Human $player){
$this->holder = $player;
parent::__construct(36);
@ -48,8 +45,6 @@ class PlayerInventory extends BaseInventory{
}
/**
* @param int $slot
*
* @throws \InvalidArgumentException
*/
private function throwIfNotHotbarSlot(int $slot) : void{
@ -61,10 +56,6 @@ class PlayerInventory extends BaseInventory{
/**
* Returns the item in the specified hotbar slot.
*
* @param int $hotbarSlot
*
* @return Item
*
* @throws \InvalidArgumentException if the hotbar slot index is out of range
*/
public function getHotbarSlotItem(int $hotbarSlot) : Item{
@ -74,7 +65,6 @@ class PlayerInventory extends BaseInventory{
/**
* Returns the hotbar slot number the holder is currently holding.
* @return int
*/
public function getHeldItemIndex() : int{
return $this->itemInHandIndex;
@ -104,8 +94,6 @@ class PlayerInventory extends BaseInventory{
/**
* Returns the currently-held item.
*
* @return Item
*/
public function getItemInHand() : Item{
return $this->getHotbarSlotItem($this->itemInHandIndex);
@ -113,8 +101,6 @@ class PlayerInventory extends BaseInventory{
/**
* Sets the item in the currently-held slot to the specified item.
*
* @param Item $item
*/
public function setItemInHand(Item $item) : void{
$this->setItem($this->getHeldItemIndex(), $item);
@ -125,7 +111,6 @@ class PlayerInventory extends BaseInventory{
/**
* Returns the number of slots in the hotbar.
* @return int
*/
public function getHotbarSize() : int{
return 9;

View File

@ -61,10 +61,7 @@ class CraftingTransaction extends InventoryTransaction{
/**
* @param Item[] $txItems
* @param Item[] $recipeItems
* @param bool $wildcards
* @param int $iterations
*
* @return int
* @throws TransactionValidationException
*/
protected function matchRecipeItems(array $txItems, array $recipeItems, bool $wildcards, int $iterations = 0) : int{

View File

@ -66,7 +66,6 @@ class InventoryTransaction{
protected $actions = [];
/**
* @param Player $source
* @param InventoryAction[] $actions
*/
public function __construct(Player $source, array $actions = []){
@ -76,9 +75,6 @@ class InventoryTransaction{
}
}
/**
* @return Player
*/
public function getSource() : Player{
return $this->source;
}
@ -102,9 +98,6 @@ class InventoryTransaction{
return $this->actions;
}
/**
* @param InventoryAction $action
*/
public function addAction(InventoryAction $action) : void{
if(!isset($this->actions[$hash = spl_object_id($action)])){
$this->actions[$hash] = $action;
@ -130,8 +123,6 @@ class InventoryTransaction{
/**
* @internal This method should not be used by plugins, it's used to add tracked inventories for InventoryActions
* involving inventories.
*
* @param Inventory $inventory
*/
public function addInventory(Inventory $inventory) : void{
if(!isset($this->inventories[$hash = spl_object_id($inventory)])){
@ -233,10 +224,7 @@ class InventoryTransaction{
}
/**
* @param Item $needOrigin
* @param SlotChangeAction[] $possibleActions
*
* @return null|Item
*/
protected function findResultItem(Item $needOrigin, array $possibleActions) : ?Item{
assert(count($possibleActions) > 0);
@ -295,7 +283,6 @@ class InventoryTransaction{
/**
* Executes the group of actions, returning whether the transaction executed successfully or not.
* @return bool
*
* @throws TransactionValidationException
*/
@ -330,9 +317,6 @@ class InventoryTransaction{
return true;
}
/**
* @return bool
*/
public function hasExecuted() : bool{
return $this->hasExecuted;
}

View File

@ -53,8 +53,6 @@ class DropItemAction extends InventoryAction{
/**
* Drops the target item in front of the player.
*
* @param Player $source
*/
public function execute(Player $source) : void{
$source->dropItem($this->targetItem);

View File

@ -43,7 +43,6 @@ abstract class InventoryAction{
/**
* Returns the item that was present before the action took place.
* @return Item
*/
public function getSourceItem() : Item{
return clone $this->sourceItem;
@ -51,7 +50,6 @@ abstract class InventoryAction{
/**
* Returns the item that the action attempted to replace the source item with.
* @return Item
*/
public function getTargetItem() : Item{
return clone $this->targetItem;
@ -59,17 +57,11 @@ abstract class InventoryAction{
/**
* Returns whether this action is currently valid. This should perform any necessary sanity checks.
*
* @param Player $source
*
* @return bool
*/
abstract public function isValid(Player $source) : bool;
/**
* Called when the action is added to the specified InventoryTransaction.
*
* @param InventoryTransaction $transaction
*/
public function onAddToTransaction(InventoryTransaction $transaction) : void{
@ -78,10 +70,6 @@ abstract class InventoryAction{
/**
* Called by inventory transactions before any actions are processed. If this returns false, the transaction will
* be cancelled.
*
* @param Player $source
*
* @return bool
*/
public function onPreExecute(Player $source) : bool{
return true;
@ -90,8 +78,6 @@ abstract class InventoryAction{
/**
* Performs actions needed to complete the inventory-action server-side. This will only be called if the transaction
* which it is part of is considered valid.
*
* @param Player $source
*/
abstract public function execute(Player $source) : void;
}

View File

@ -38,12 +38,6 @@ class SlotChangeAction extends InventoryAction{
/** @var int */
private $inventorySlot;
/**
* @param Inventory $inventory
* @param int $inventorySlot
* @param Item $sourceItem
* @param Item $targetItem
*/
public function __construct(Inventory $inventory, int $inventorySlot, Item $sourceItem, Item $targetItem){
parent::__construct($sourceItem, $targetItem);
$this->inventory = $inventory;
@ -52,8 +46,6 @@ class SlotChangeAction extends InventoryAction{
/**
* Returns the inventory involved in this action.
*
* @return Inventory
*/
public function getInventory() : Inventory{
return $this->inventory;
@ -61,7 +53,6 @@ class SlotChangeAction extends InventoryAction{
/**
* Returns the slot in the inventory which this action modified.
* @return int
*/
public function getSlot() : int{
return $this->inventorySlot;
@ -69,10 +60,6 @@ class SlotChangeAction extends InventoryAction{
/**
* Checks if the item in the inventory at the specified slot is the same as this action's source item.
*
* @param Player $source
*
* @return bool
*/
public function isValid(Player $source) : bool{
return (
@ -83,9 +70,6 @@ class SlotChangeAction extends InventoryAction{
/**
* Adds this action's target inventory to the transaction's inventory list.
*
* @param InventoryTransaction $transaction
*
*/
public function onAddToTransaction(InventoryTransaction $transaction) : void{
$transaction->addInventory($this->inventory);
@ -93,8 +77,6 @@ class SlotChangeAction extends InventoryAction{
/**
* Sets the item into the target inventory.
*
* @param Player $source
*/
public function execute(Player $source) : void{
$this->inventory->setItem($this->inventorySlot, $this->targetItem, false);