mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Modernize property type declarations
This commit is contained in:
@ -48,15 +48,13 @@ use function intdiv;
|
||||
* results, with no remainder. Any leftovers are expected to be emitted back to the crafting grid.
|
||||
*/
|
||||
class CraftingTransaction extends InventoryTransaction{
|
||||
/** @var CraftingRecipe|null */
|
||||
protected $recipe;
|
||||
/** @var int|null */
|
||||
protected $repetitions;
|
||||
protected ?CraftingRecipe $recipe;
|
||||
protected ?int $repetitions;
|
||||
|
||||
/** @var Item[] */
|
||||
protected $inputs = [];
|
||||
protected array $inputs = [];
|
||||
/** @var Item[] */
|
||||
protected $outputs = [];
|
||||
protected array $outputs = [];
|
||||
|
||||
private CraftingManager $craftingManager;
|
||||
|
||||
|
@ -55,22 +55,21 @@ use function spl_object_id;
|
||||
* @see InventoryAction
|
||||
*/
|
||||
class InventoryTransaction{
|
||||
/** @var bool */
|
||||
protected $hasExecuted = false;
|
||||
/** @var Player */
|
||||
protected $source;
|
||||
protected bool $hasExecuted = false;
|
||||
|
||||
/** @var Inventory[] */
|
||||
protected $inventories = [];
|
||||
protected array $inventories = [];
|
||||
|
||||
/** @var InventoryAction[] */
|
||||
protected $actions = [];
|
||||
protected array $actions = [];
|
||||
|
||||
/**
|
||||
* @param InventoryAction[] $actions
|
||||
*/
|
||||
public function __construct(Player $source, array $actions = []){
|
||||
$this->source = $source;
|
||||
public function __construct(
|
||||
protected Player $source,
|
||||
array $actions = []
|
||||
){
|
||||
foreach($actions as $action){
|
||||
$this->addAction($action);
|
||||
}
|
||||
|
@ -32,15 +32,10 @@ use pocketmine\player\Player;
|
||||
* Represents an action involving a change that applies in some way to an inventory or other item-source.
|
||||
*/
|
||||
abstract class InventoryAction{
|
||||
/** @var Item */
|
||||
protected $sourceItem;
|
||||
/** @var Item */
|
||||
protected $targetItem;
|
||||
|
||||
public function __construct(Item $sourceItem, Item $targetItem){
|
||||
$this->sourceItem = $sourceItem;
|
||||
$this->targetItem = $targetItem;
|
||||
}
|
||||
public function __construct(
|
||||
protected Item $sourceItem,
|
||||
protected Item $targetItem
|
||||
){}
|
||||
|
||||
/**
|
||||
* Returns the item that was present before the action took place.
|
||||
|
@ -33,15 +33,13 @@ use pocketmine\player\Player;
|
||||
* Represents an action causing a change in an inventory slot.
|
||||
*/
|
||||
class SlotChangeAction extends InventoryAction{
|
||||
|
||||
/** @var Inventory */
|
||||
protected $inventory;
|
||||
private int $inventorySlot;
|
||||
|
||||
public function __construct(Inventory $inventory, int $inventorySlot, Item $sourceItem, Item $targetItem){
|
||||
public function __construct(
|
||||
protected Inventory $inventory,
|
||||
private int $inventorySlot,
|
||||
Item $sourceItem,
|
||||
Item $targetItem
|
||||
){
|
||||
parent::__construct($sourceItem, $targetItem);
|
||||
$this->inventory = $inventory;
|
||||
$this->inventorySlot = $inventorySlot;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user