PHP Interface pocketmine\inventory\Inventory

Afficher le fichier Open project: iTXTech/Genisys Interface Usage Examples

Méthodes publiques

Méthode Description
addItem ( $slots ) : Item[] Stores the given Items in the inventory. This will try to fill existing stacks and empty slots as well as it can.
all ( Item $item ) : Item[] Will return all the Items that has the same id and metadata (if not null).
canAddItem ( Item $item ) : boolean Checks if a given Item can be added to the inventory
clear ( integer $index ) : boolean Will clear a specific slot
clearAll ( ) Clears all the slots
close ( Player $who )
contains ( Item $item ) : boolean Checks if the inventory contains any Item with the same material data.
first ( Item $item ) : integer Will return the first slot has the same id and metadata (if not null) as the Item.
firstEmpty ( ) : integer Returns the first empty slot, or -1 if not found
getContents ( ) : Item[]
getHolder ( ) : pocketmine\inventory\InventoryHolder
getItem ( integer $index ) : Item
getMaxStackSize ( )
getName ( )
getSize ( )
getTitle ( )
getType ( ) : InventoryType
getViewers ( ) : Player[] Gets all the Players viewing the inventory Players will view their inventory at all times, even when not open.
onClose ( Player $who )
onOpen ( Player $who )
onSlotChange ( integer $index, Item $before, boolean $send )
open ( Player $who ) : boolean Tries to open the inventory to a player
remove ( Item $item ) Will remove all the Items that has the same id and metadata (if not null)
removeItem ( $slots ) : Item[] Removes the given Item from the inventory.
sendContents ( Player | Player[] $target )
sendSlot ( integer $index, Player | Player[] $target )
setContents ( array $items )
setItem ( integer $index, Item $item ) : boolean Puts an Item in a slot.
setMaxStackSize ( integer $size )

Method Details

addItem() public méthode

Returns the Items that did not fit.
public addItem ( $slots ) : Item[]
Résultat pocketmine\item\Item[]

all() public méthode

Won't check amount
public all ( Item $item ) : Item[]
$item pocketmine\item\Item
Résultat pocketmine\item\Item[]

canAddItem() public méthode

Checks if a given Item can be added to the inventory
public canAddItem ( Item $item ) : boolean
$item pocketmine\item\Item
Résultat boolean

clear() public méthode

Will clear a specific slot
public clear ( integer $index ) : boolean
$index integer
Résultat boolean

clearAll() public méthode

Clears all the slots
public clearAll ( )

close() public méthode

public close ( Player $who )
$who pocketmine\Player

contains() public méthode

It will check id, amount, and metadata (if not null)
public contains ( Item $item ) : boolean
$item pocketmine\item\Item
Résultat boolean

first() public méthode

-1 if not found, will check amount
public first ( Item $item ) : integer
$item pocketmine\item\Item
Résultat integer

firstEmpty() public méthode

Returns the first empty slot, or -1 if not found
public firstEmpty ( ) : integer
Résultat integer

getContents() public méthode

public getContents ( ) : Item[]
Résultat pocketmine\item\Item[]

getHolder() public méthode

public getHolder ( ) : pocketmine\inventory\InventoryHolder
Résultat pocketmine\inventory\InventoryHolder

getItem() public méthode

public getItem ( integer $index ) : Item
$index integer
Résultat pocketmine\item\Item

getMaxStackSize() public méthode

public getMaxStackSize ( )

getName() public méthode

public getName ( )

getSize() public méthode

public getSize ( )

getTitle() public méthode

public getTitle ( )

getType() public méthode

public getType ( ) : InventoryType
Résultat InventoryType

getViewers() public méthode

Gets all the Players viewing the inventory Players will view their inventory at all times, even when not open.
public getViewers ( ) : Player[]
Résultat pocketmine\Player[]

onClose() public méthode

public onClose ( Player $who )
$who pocketmine\Player

onOpen() public méthode

public onOpen ( Player $who )
$who pocketmine\Player

onSlotChange() public méthode

public onSlotChange ( integer $index, Item $before, boolean $send )
$index integer
$before pocketmine\item\Item
$send boolean

open() public méthode

Tries to open the inventory to a player
public open ( Player $who ) : boolean
$who pocketmine\Player
Résultat boolean

remove() public méthode

Will remove all the Items that has the same id and metadata (if not null)
public remove ( Item $item )
$item pocketmine\item\Item

removeItem() public méthode

It will return the Items that couldn't be removed.
public removeItem ( $slots ) : Item[]
Résultat pocketmine\item\Item[]

sendContents() public méthode

public sendContents ( Player | Player[] $target )
$target pocketmine\Player | pocketmine\Player[]

sendSlot() public méthode

public sendSlot ( integer $index, Player | Player[] $target )
$index integer
$target pocketmine\Player | pocketmine\Player[]

setContents() public méthode

public setContents ( array $items )
$items array

setItem() public méthode

If a plugin refuses the update or $index is invalid, it'll return false If a source Player is specified, it won't send a Inventory update to it
public setItem ( integer $index, Item $item ) : boolean
$index integer
$item pocketmine\item\Item
Résultat boolean

setMaxStackSize() public méthode

public setMaxStackSize ( integer $size )
$size integer