mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-12 16:59:44 +00:00
backport f84a1729c: Inventory: added swap() function
This commit is contained in:
parent
0fabc0c199
commit
b38c81c96f
@ -378,6 +378,13 @@ abstract class BaseInventory implements Inventory{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function swap(int $slot1, int $slot2) : void{
|
||||||
|
$i1 = $this->getItem($slot1);
|
||||||
|
$i2 = $this->getItem($slot2);
|
||||||
|
$this->setItem($slot1, $i2);
|
||||||
|
$this->setItem($slot2, $i1);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Player[]
|
* @return Player[]
|
||||||
*/
|
*/
|
||||||
|
@ -215,6 +215,14 @@ interface Inventory{
|
|||||||
*/
|
*/
|
||||||
public function clearAll(bool $send = true) : void;
|
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all the Players viewing the inventory
|
* Gets all the Players viewing the inventory
|
||||||
* Players will view their inventory at all times, even when not open.
|
* Players will view their inventory at all times, even when not open.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user