PlayerInteractEvent: cleanup constructor now that block isn't optional anymore

This commit is contained in:
Dylan K. Taylor 2018-09-14 16:30:22 +01:00
parent db2567f965
commit 0e5cbca983

View File

@ -61,11 +61,10 @@ class PlayerInteractEvent extends PlayerEvent implements Cancellable{
* @param int $face * @param int $face
* @param int $action * @param int $action
*/ */
public function __construct(Player $player, Item $item, ?Block $block, ?Vector3 $touchVector, int $face, int $action = PlayerInteractEvent::RIGHT_CLICK_BLOCK){ public function __construct(Player $player, Item $item, Block $block, ?Vector3 $touchVector, int $face, int $action = PlayerInteractEvent::RIGHT_CLICK_BLOCK){
assert($block !== null or $touchVector !== null);
$this->player = $player; $this->player = $player;
$this->item = $item; $this->item = $item;
$this->blockTouched = $block ?? BlockFactory::get(0, 0, new Position(0, 0, 0, $player->level)); $this->blockTouched = $block;
$this->touchVector = $touchVector ?? new Vector3(0, 0, 0); $this->touchVector = $touchVector ?? new Vector3(0, 0, 0);
$this->blockFace = $face; $this->blockFace = $face;
$this->action = $action; $this->action = $action;