How do I get what the button name was clicked using FormAPI? i create buttons with PHP: $form = $this->getFormAPI()->createSimpleForm( function ( Player $player, ?int $result = null ) { if ( $result === null ) { return; } switch ($result) { case 0: $player->sendMessage("hi"); break; } return; } ); $form->setTitle( $title ); $form->setContent( $content ); $form->addButton( "hello"); $form->addButton( "hey"); $form->sendToPlayer( $player ); how do i get what button the player clicked like if(buttonclicked == "hello"){}
1. button that you'll add gets index 0 2. button that you'll add gets index 1 3 ... 2 ... in function that you will add to the form you use $result instead of index so hello button has index 0 PHP: if($result === 0) {}