From 0dc4bd36e1f6f9cc157b440b7a0f9a64dad9fc3c Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 19 Aug 2018 11:44:59 +0100 Subject: [PATCH] Form: change handleResponse() return type to void this returning is counter intuitive and doesn't make any sense without the queuing mechanism. Instead it's simpler to just use Player->sendForm(). --- src/pocketmine/Player.php | 5 +---- src/pocketmine/form/Form.php | 5 ++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index be4542a9d..b7178fa10 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -3389,10 +3389,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{ } try{ - $next = $this->forms[$formId]->handleResponse($this, $responseData); - if($next !== null){ - $this->sendForm($next); - } + $this->forms[$formId]->handleResponse($this, $responseData); }catch(FormValidationException $e){ $this->server->getLogger()->critical("Failed to validate form " . get_class($this->forms[$formId]) . ": " . $e->getMessage()); $this->server->getLogger()->logException($e); diff --git a/src/pocketmine/form/Form.php b/src/pocketmine/form/Form.php index f822b1ceb..e4a2fcc5a 100644 --- a/src/pocketmine/form/Form.php +++ b/src/pocketmine/form/Form.php @@ -37,8 +37,7 @@ interface Form extends \JsonSerializable{ * @param Player $player * @param mixed $data * - * @return Form|null a form which will be opened immediately (before queued forms) as a response to this form, or null if not applicable. - * @throws FormValidationException + * @throws FormValidationException if the data could not be processed */ - public function handleResponse(Player $player, $data) : ?Form; + public function handleResponse(Player $player, $data) : void; }