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().
This commit is contained in:
Dylan K. Taylor 2018-08-19 11:44:59 +01:00
parent 9d17c9a09d
commit 0dc4bd36e1
2 changed files with 3 additions and 7 deletions

View File

@ -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);

View File

@ -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;
}