Heads up!
Added in Fzzy Config 0.5.0
Define on-click action buttons in configs. These actions don't maintain or store any config state directly, but can be used for a variety of secondary functions:
- Open a documentation link
- Give the player something, like the guide book if they lost theirs
- Or, open the guide screen directly!
- Perform an action on the config that's outside the normal scope of what Fzzy Config settings can do
- Clear some player data
- Basically anything!
Creation
To define an action button, add a ConfigAction
as a property/field in the config class. The config GUI will gain an action button in the order that you place it in the class fields, like any other setting. It may be helpful for users to place your special buttons together, at the top or bottom. Or maybe, place them in an object and have all your actions in one convenient popup!
Heads up!
@IgnoreVisibility
can be used with actions just like any other config field. Also like any other config field, it can't be final.
Actions
Actions can take two forms:
Runnable
- A generic Runnable lambda or instance. Does whatever you want it to.ClickEvent
- Pass aClickEvent
for pre-defined vanilla functionality like opening URL links, running commands, and so on.
Decorations
Decorations are the white wireframe icons that appear to the left of certain setting buttons to signify to the user that they perform a certain special functionality. ConfigAction
is no different.
- It has a default "mouse pointer clicking a button decoration"
- For
ClickEvent
actions, there is a decoration defined for each event type. - You can define a custom decoration by passing a sprite identifier into the builder or constructor. Fzzy Config provides a list of pre-defined decorations in the
TextureDeco
🗗 andTextureIds
🗗 classes that can be used; or define one of your own! Decorations are typically a 20 x 20 pixel texture.