PocketMine
PlayerInventory Class Reference
Inheritance diagram for PlayerInventory:
BaseInventory Inventory

Public Member Functions

 __construct (Human $player)
 
 getSize ()
 
 setSize ($size)
 
 getHotbarSlotIndex ($index)
 
 setHotbarSlotIndex ($index, $slot)
 
 getHeldItemIndex ()
 
 setHeldItemIndex ($index)
 
 getItemInHand ()
 
 setItemInHand (Item $item)
 
 getHeldItemSlot ()
 
 setHeldItemSlot ($slot)
 
 sendHeldItem ($target)
 
 onSlotChange ($index, $before)
 
 getHotbarSize ()
 
 getArmorItem ($index)
 
 setArmorItem ($index, Item $item)
 
 getHelmet ()
 
 getChestplate ()
 
 getLeggings ()
 
 getBoots ()
 
 setHelmet (Item $helmet)
 
 setChestplate (Item $chestplate)
 
 setLeggings (Item $leggings)
 
 setBoots (Item $boots)
 
 setItem ($index, Item $item)
 
 clear ($index)
 
 getArmorContents ()
 
 clearAll ()
 
 sendArmorContents ($target)
 
 setArmorContents (array $items)
 
 sendContents ($target)
 
 getHolder ()
 
- Public Member Functions inherited from BaseInventory
 __construct (InventoryHolder $holder, InventoryType $type, array $items=[], $overrideSize=null, $overrideTitle=null)
 
 getSize ()
 
 setSize ($size)
 
 getMaxStackSize ()
 
 getName ()
 
 getTitle ()
 
 getItem ($index)
 
 getContents ()
 
 setContents (array $items)
 
 setItem ($index, Item $item)
 
 contains (Item $item)
 
 all (Item $item)
 
 remove (Item $item)
 
 first (Item $item)
 
 firstEmpty ()
 
 canAddItem (Item $item)
 
 clear ($index)
 
 clearAll ()
 
 getViewers ()
 
 getHolder ()
 
 setMaxStackSize ($size)
 
 open (Player $who)
 
 close (Player $who)
 
 onOpen (Player $who)
 
 onClose (Player $who)
 
 onSlotChange ($index, $before)
 
 sendContents ($target)
 
 sendSlot ($index, $target)
 
 getType ()
 
- Public Member Functions inherited from Inventory
 addItem (...$slots)
 
 removeItem (...$slots)
 

Protected Attributes

 $itemInHandIndex = 0
 
 $hotbar
 
- Protected Attributes inherited from BaseInventory
 $type
 
 $maxStackSize = Inventory::MAX_STACK
 
 $size
 
 $name
 
 $title
 
 $slots = []
 
 $viewers = []
 
 $holder
 

Additional Inherited Members

- Data Fields inherited from Inventory
const MAX_STACK = 64
 

Member Function Documentation

clear (   $index)

Will clear a specific slot

Parameters
int$index
Returns
bool

Implements Inventory.

clearAll ( )

Clears all the slots

Implements Inventory.

getArmorContents ( )
Returns
Item[]
getHolder ( )
Returns
Human|Player

Implements Inventory.

onSlotChange (   $index,
  $before 
)
Parameters
int$index
Item$before

Implements Inventory.

sendArmorContents (   $target)
Parameters
Player|Player[]$target
sendContents (   $target)
Parameters
Player|Player[]$target

Implements Inventory.

sendHeldItem (   $target)
Parameters
Player|Player[]$target
setArmorContents ( array  $items)
Parameters
Item[]$items
setItem (   $index,
Item  $item 
)

Puts an Item in a slot. 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

Parameters
int$index
Item$item
Returns
bool

Implements Inventory.

setItemInHand ( Item  $item)
Parameters
Item$item
Returns
bool

The documentation for this class was generated from the following file: