Added InventoryAction->onPreExecute(), fixed PlayerDropItemEvent deleting items

This commit is contained in:
Dylan K. Taylor
2017-09-20 12:19:42 +01:00
parent 0262465a26
commit 55720d9f0a
4 changed files with 37 additions and 7 deletions

View File

@ -74,6 +74,18 @@ abstract class InventoryAction{
*/
abstract public function isValid(Player $source) : bool;
/**
* Called by inventory transactions before any actions are processed. If this returns false, the transaction will
* be cancelled.
*
* @param Player $source
*
* @return bool
*/
public function onPreExecute(Player $source) : bool{
return true;
}
/**
* Performs actions needed to complete the inventory-action server-side. Returns if it was successful. Will return
* false if plugins cancelled events. This will only be called if the transaction which it is part of is considered