diff --git a/src/pocketmine/inventory/transaction/InventoryTransaction.php b/src/pocketmine/inventory/transaction/InventoryTransaction.php index 02158c22b..199e8aa27 100644 --- a/src/pocketmine/inventory/transaction/InventoryTransaction.php +++ b/src/pocketmine/inventory/transaction/InventoryTransaction.php @@ -321,11 +321,7 @@ class InventoryTransaction{ } foreach($this->actions as $action){ - if($action->execute($this->source)){ - $action->onExecuteSuccess($this->source); - }else{ - $action->onExecuteFail($this->source); - } + $action->execute($this->source); } $this->hasExecuted = true; diff --git a/src/pocketmine/inventory/transaction/action/CreativeInventoryAction.php b/src/pocketmine/inventory/transaction/action/CreativeInventoryAction.php index 7c399bc95..139dda193 100644 --- a/src/pocketmine/inventory/transaction/action/CreativeInventoryAction.php +++ b/src/pocketmine/inventory/transaction/action/CreativeInventoryAction.php @@ -68,18 +68,8 @@ class CreativeInventoryAction extends InventoryAction{ * No need to do anything extra here: this type just provides a place for items to disappear or appear from. * * @param Player $source - * - * @return bool */ - public function execute(Player $source) : bool{ - return true; - } - - public function onExecuteSuccess(Player $source) : void{ - - } - - public function onExecuteFail(Player $source) : void{ + public function execute(Player $source) : void{ } } diff --git a/src/pocketmine/inventory/transaction/action/DropItemAction.php b/src/pocketmine/inventory/transaction/action/DropItemAction.php index 692af129f..3ffab2a72 100644 --- a/src/pocketmine/inventory/transaction/action/DropItemAction.php +++ b/src/pocketmine/inventory/transaction/action/DropItemAction.php @@ -55,19 +55,8 @@ class DropItemAction extends InventoryAction{ * Drops the target item in front of the player. * * @param Player $source - * - * @return bool */ - public function execute(Player $source) : bool{ + public function execute(Player $source) : void{ $source->dropItem($this->targetItem); - return true; - } - - public function onExecuteSuccess(Player $source) : void{ - - } - - public function onExecuteFail(Player $source) : void{ - } } diff --git a/src/pocketmine/inventory/transaction/action/InventoryAction.php b/src/pocketmine/inventory/transaction/action/InventoryAction.php index 7ca2a2afa..326dbe440 100644 --- a/src/pocketmine/inventory/transaction/action/InventoryAction.php +++ b/src/pocketmine/inventory/transaction/action/InventoryAction.php @@ -88,28 +88,10 @@ abstract class InventoryAction{ } /** - * 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 - * valid. - * - * @param Player $source - * - * @return bool - */ - abstract public function execute(Player $source) : bool; - - /** - * Performs additional actions when this inventory-action completed successfully. + * Performs actions needed to complete the inventory-action server-side. This will only be called if the transaction + * which it is part of is considered valid. * * @param Player $source */ - abstract public function onExecuteSuccess(Player $source) : void; - - /** - * Performs additional actions when this inventory-action did not complete successfully. - * - * @param Player $source - */ - abstract public function onExecuteFail(Player $source) : void; - + abstract public function execute(Player $source) : void; } diff --git a/src/pocketmine/inventory/transaction/action/SlotChangeAction.php b/src/pocketmine/inventory/transaction/action/SlotChangeAction.php index 9bb9d5f9c..8aaa70e15 100644 --- a/src/pocketmine/inventory/transaction/action/SlotChangeAction.php +++ b/src/pocketmine/inventory/transaction/action/SlotChangeAction.php @@ -95,33 +95,13 @@ class SlotChangeAction extends InventoryAction{ * Sets the item into the target inventory. * * @param Player $source - * - * @return bool */ - public function execute(Player $source) : bool{ + public function execute(Player $source) : void{ $this->inventory->setItem($this->inventorySlot, $this->targetItem, false); - return true; - } - - /** - * Sends slot changes to other viewers of the inventory. This will not send any change back to the source Player. - * - * @param Player $source - */ - public function onExecuteSuccess(Player $source) : void{ foreach($this->inventory->getViewers() as $viewer){ if($viewer !== $source){ $viewer->getNetworkSession()->syncInventorySlot($this->inventory, $this->inventorySlot); } } } - - /** - * Sends the original slot contents to the source player to revert the action. - * - * @param Player $source - */ - public function onExecuteFail(Player $source) : void{ - $source->getNetworkSession()->syncInventorySlot($this->inventory, $this->inventorySlot); - } }