mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
phpdoc armageddon for master, pass 1
This commit is contained in:
@ -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{
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user