Class: ActionFormResponse
Returns data about the player results from a modal action form.
Example
import { Player } from '@minecraft/server';
import { ActionFormData, ActionFormResponse } from '@minecraft/server-ui';
function askFavoriteMonth(player: Player) {
const form = new ActionFormData()
.title('Months')
.body('Choose your favorite month!')
.button('January')
.button('February')
.button('March')
.button('April')
.button('May');
form.show(player).then((response: ActionFormResponse) => {
if (response.selection === 3) {
player.sendMessage('I like April too!');
} else {
player.sendMessage('Nah, April is the best.');
}
});
}
Extends
Constructors
new ActionFormResponse()
private
new ActionFormResponse():ActionFormResponse
Returns
Overrides
Properties
cancelationReason?
optional
readonly
cancelationReason:FormCancelationReason
Remarks
Contains additional details as to why a form was canceled.
Inherited from
FormResponse
. cancelationReason
canceled
readonly
canceled:boolean
Remarks
If true, the form was canceled by the player (e.g., they selected the pop-up X close button).
Inherited from
selection?
optional
readonly
selection:number
Remarks
Returns the index of the button that was pushed.