GeyserMC / Cumulus

Bedrock Forms API and implementation
https://geysermc.org
MIT License
33 stars 8 forks source link

Suggestion: Allow the ability to send Additional Forms on Response #3

Closed RocketManKian closed 1 year ago

RocketManKian commented 2 years ago

Hey there!

So whilst messing with the Floodgate API and Cumulus Features I have discovered that it is rather difficult to add multiple Forms on response of the Player, without making the code look extremely messy.

For example... A player opens the Form and click Button 1 (Id=0), it should be possible to use 'if (response.getClickedButtonId() == 0) {' and then send a new Form with the ability to add contents and everything else that the initial form allows.

This could be useful for those (like myself) creating Rules GUI's and having the player click 'Next' to then open a new form with additional lines of rules or information.

I apologise for my lack of understanding and rough explanation when it comes to this.

Thanks!

Konicai commented 2 years ago

You can though? The response handler is a consumer, so you can access (effectively) final variables outside of it, such as the FormPlayer object that you used to send the form. Really you can run whatever you want within the handler. If its getting messy then just delegate handling to other methods.

If you have any questions feel free to join the development channel on our Discord

e.g.

Executing abstract actions within a response handler: https://github.com/ProjectG-Plugins/CrossplatForms/blob/main/core/src/main/java/dev/projectg/crossplatforms/interfacing/bedrock/simple/SimpleForm.java#L74 An action could be opening another form: https://github.com/ProjectG-Plugins/CrossplatForms/blob/main/core/src/main/java/dev/projectg/crossplatforms/action/InterfaceAction.java#L34 Which then opens a whole new form (or the same one, again).