GenisysPro  for Minecraft PE/Windows 10 v1.1.x
Feature-rich server software for Minecraft PE and Windows 10 Edition
DropItemTransaction Class Reference

Public Member Functions

 __construct (Item $droppedItem)
 
 setSourceItem (Item $item)
 
 getInventory ()
 
 getSlot ()
 
 sendSlotUpdate (Player $source)
 
 getChange ()
 
 execute (Player $source)
 
- Public Member Functions inherited from BaseTransaction
 __construct ($inventory, $slot, Item $targetItem, $achievements=[], $transactionType=Transaction::TYPE_NORMAL)
 
 getCreationTime ()
 
 getInventory ()
 
 getSlot ()
 
 getTargetItem ()
 
 getSourceItem ()
 
 setTargetItem (Item $item)
 
 getFailures ()
 
 addFailure ()
 
 succeeded ()
 
 setSuccess ($value=true)
 
 getTransactionType ()
 
 getAchievements ()
 
 hasAchievements ()
 
 addAchievement (string $achievementName)
 
 sendSlotUpdate (Player $source)
 
 getChange ()
 
 execute (Player $source)
 

Data Fields

const TRANSACTION_TYPE = Transaction::TYPE_DROP_ITEM
 
- Data Fields inherited from Transaction
const TYPE_NORMAL = 0
 
const TYPE_DROP_ITEM = 1
 

Protected Attributes

 $inventory = null
 
 $slot = null
 
 $sourceItem = null
 
- Protected Attributes inherited from BaseTransaction
 $inventory
 
 $slot
 
 $targetItem
 
 $creationTime
 
 $transactionType = Transaction::TYPE_NORMAL
 
 $failures = 0
 
 $wasSuccessful = false
 
 $achievements = []
 

Constructor & Destructor Documentation

◆ __construct()

__construct ( Item  $droppedItem)
Parameters
Item$droppedItem
40  {
41  $this->targetItem = $droppedItem;
42  }

Member Function Documentation

◆ execute()

execute ( Player  $source)
Parameters
Player$source
Returns
bool

Implements Transaction.

85  : bool{
86  $droppedItem = $this->getTargetItem();
87  if(!$source->getServer()->allowInventoryCheats and !$source->isCreative()){
88  if(!$source->getFloatingInventory()->contains($droppedItem)){
89  return false;
90  }
91  $source->getFloatingInventory()->removeItem($droppedItem);
92  }
93  $source->dropItem($droppedItem);
94  return true;
95  }

◆ getChange()

getChange ( )
Returns
array
75  {
76  return ["in" => $this->getTargetItem(),
77  "out" => null];
78  }

◆ getInventory()

getInventory ( )
Returns
null

Implements Transaction.

54  {
55  return null;
56  }

◆ getSlot()

getSlot ( )
Returns
null

Implements Transaction.

61  {
62  return null;
63  }

◆ sendSlotUpdate()

sendSlotUpdate ( Player  $source)
Parameters
Player$source
68  {
69  //Nothing to update
70  }

◆ setSourceItem()

setSourceItem ( Item  $item)
Parameters
Item$item
47  {
48  //Nothing to update
49  }

Field Documentation

◆ $inventory

$inventory = null
protected

◆ $slot

$slot = null
protected

◆ $sourceItem

$sourceItem = null
protected

◆ TRANSACTION_TYPE

const TRANSACTION_TYPE = Transaction::TYPE_DROP_ITEM

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