Custom Bedrock GUI - No-Not-Jaden/NotBounties GitHub Wiki
NotBounties provides the feature to use bedrock forms instead of the java chest interface. To use this feature, you must have GeyserMC or Floodgate installed on your server. You can download them here. The settings for this GUI can be found in the bedrock-gui.yml file.
Form Types
There are 3 different form types that can be displayed to a Bedrock player. The form that is used for each GUI is automatically selected depending on how many buttons there are.
Simple Form (>2 Buttons)
The simple form has some text content at the top of the form and a list of buttons past that. If players are displayed, each player will have their own button with an image of their face on it.
Modal Form (1-2 Buttons)
The modal form has a big box for text content and 2 buttons at the bottom. If players are displayed, they will be listed in the text content.
Custom Form (0 Buttons)
The custom form has a lot of different components that can be used, but not buttons. The form is submitted through a button at the bottom. If players are displayed, they will be displayed as text labels.
GUI Settings
Similarly to the Java GUI configuration, all of the GUI settings are past the custom-components
section. The first GUI configuration listed is the selection-gui
.
Disabling
If you want your Bedrock users to always use the Java GUI, set the enabled
option to false at the very top of the configuration. There is also the option to only disable specific Bedrock GUIs. This can be changed by setting the enabled
option under a specific GUI configuration.
# GUI to select different options
selection-gui:
enabled: true
# other GUI options...
GUI Name & Add Page
The gui-name
option refers to the title of the GUI. The add-page
option controls if the page number is added to the end of the name. The add-page
option is not required. Alternatively, {page}
and {page_max}
can be used in the name to display the current page and maximum page.
# name of the gui
gui-name: '&d&lBounties &9&lPage'
# this will add the page number at the end of the gui name
add-page: true
Remove Page Items
The remove-page-items
option controls if components with the [next]
or [back]
commands will be removed from the GUI if there is no next or previous page. This option is not required.
# this will remove items with actions of [next] or [back] if there is no next page or previous page
remove-page-items: true
Player Text
The player-text
option controls the text next to the player in GUIs that display players. The set-whitelist
GUI will apply a ChatColor to the text depending if the player is whitelisted. This option is not required.
# text next to the player
player-text: '&c&l{player}&8: &4{amount}'
Player Button Commands & Max Players
The player-button-commands
option allow you to run commands when a player button is clicked. This will only do anything in a simple form. This option is not required either way.
# these commands are activated when a player button is clicked
player-button-commands:
- '[p] bounty check {player}'
The max-players
option controls the maximum number of players per page that will be displayed. Unlike the Java GUI, there aren't any slots to choose where the players are listed, so they are all listed together. This option is not required.
# max amount of players shown in one page
max-players: 10
Completion Commands
The completion-commands
option will run a set of commands after the GUI is completed. If the form type is simple or modal, these commands are run when any button is clicked. If the form type is custom, these commands are run when the submit button is clicked. This is also where you handle the result of the custom form. To do that, there are a few placeholders that can be used.
completion-commands:
- '[p] bounty {player1} {quantity}'
Custom Form Placeholders
{value}
looks for components in this order
- non-numerical input components with no commands
- step-slider components with no commands
- dropdown components with no commands
- non-numerical input components
- step-slider components
- dropdown components
{quantity}
looks for components in this order - numerical input components with no commands
- slider components with no commands
- numerical dropdown components with no commands
- numerical input components
- slider components
- numerical dropdown components
For more specific value gathering,
{value<x>}
can be used to get values from specific components. The<x>
corresponds to the component order in thecomponents
list. Ex: consider the following configuration
gui-type:
# other GUI settings...
# completion commands list
completion-commands:
- 'say {value1} loves {value2}`
# components list
components:
1: person-input
3: object-selector
The person-input
and object-selector
texts are references to custom components in the custom-components
section. These could be any component except a button. {value1}
corresponds to the person-input
component and {value2}
corresponds to the object-selector
component. Note that the name of the options don't have to match the value number. The name of the options are for the order of their display; skipping numbers won't change their order. If the GUI user inputs "Lisa" for the first input, and selects "Cats" for the second input, the completion command will run say Lisa loved Cats
.
All Form Placeholders
{player<x>}
will be replaced with the name of the<x>
player displayed in the GUI.- Action Command Placeholders
Components
This is the most important setting in the GUI. It controls where the custom components are in the GUI and which form type will be used. If you want to learn about how to create your own custom component, scroll down a little bit to the custom components section.
Components will be positioned in numerical order - lower numbers will be at the top of the form, and higher numbers will be at the bottom of the form. It is good practice to keep your options in numerical order in the configuration when editing. If players will be displayed in a simple form, like with the set-whitelist GUI, the player buttons will be displayed at the 0 position, so in the set-whitelist example below, it will be between the back and next components.
# set-whitelist components
components:
-3: return-selection
-2: add-offline
-1: back
1: next
Custom Components
In the custom-components
configuration section, you can create your own components to be displayed in the form. The format for custom components is
custom-components:
component-key: # This is the key used in the components section in the GUI settings
text: 'Text of component' # This is the text displayed on the component
type: BUTTON # This is the type of component. The additional options that can be used depend on the type
# This is a list of action commands that will be run
# If the type isn't a button, the commands will be run when the form is completed
# If you can select or input a value, {value} will be replaced with it
commands:
- 'say Action commands can be run here!'
# additional component specific settings...
Component Types
There are 7 different component types that you can use in your forms.
Label
The label component is the most simple component. It just displays text. You can use commands, but I would recommend putting them in the completion-commands
list instead.
label-component:
text: 'Label here!'
type: LABEL
Button
The button component can be clicked and display an image next to the text. The commands will only be run if this button is clicked. The image option is not required for the button to work. The button component cannot be used in a custom form.
button-component:
text: 'Click me for cookies!'
type: BUTTON
image: 'https://static.wikia.nocookie.net/minecraft_gamepedia/images/b/b3/Cookie_JE2_BE2.png'
commands:
- 'minecraft:give {player} cookie 1'
Toggle
The toggle component is a custom form component similar to a button, but the state is saved. The default
option controls the state of the button when the form is opened. You can control which commands are run when the button is on or off by adding [ON]
or [OFF]
to the beginning of the line.
toggle-component:
text: '&aDonate 1 dollar to children in need?'
type: TOGGLE
# default value true/false or on/off
default: false
# add [ON] or [OFF] at the beginning to change when the command is executed
commands:
- '[OFF] tell {player} You should have donated to the children in need.'
- '[OFF] kill {player}'
- '[ON] tell {player} Thank you for supporting the children!'
- '[ON] clear {player} diamond 1'
INPUT
The input component is a custom form component that allows the user to input text. The placeholder
option controls the text in the component when the form is opened.
input-component:
text: '&aCats to fall out of the sky:'
type: INPUT
# text that goes in the input before any value
placeholder: '0'
commands:
- 'minecraft:summon minecraft:cat ~ ~10 ~'
Dropdown
The dropdown component is a custom form component that allows the user to select from different options from a dropdown box. The options
option is the list of items in the dropdown box. The first item in the list is the one selected when the GUI is opened. If the commands list is the same size as the options list, the command in the same position as the selected item will be the only command run. If the lists are different sizes, all of the commands are run and {dropdown}
is replaced with the text selected
dropdown-component:
text: '&8Remove Specific Player:'
type: DROPDOWN
# text that appears in the dropdown
# the first line is the default
options:
- 'Choose a player'
- 'Karen_23'
- 'jj_the_jetplane_'
- 'Notch'
- 'MsGracodile'
- 'Berry_Allan490'
- '_xXPRISOMXx_'
- '@p'
- 'Were33445'
# the command that occurs after a selection
# if the dropdown list is the same size as the command list,
# the only command that will execute is the one with the same index of the clicked box
# otherwise, all commands are run and {dropdown} is replaced with the text clicked
commands:
- 'ban {dropdown}'
Slider
The slider options is a bar representing numerical values where the user can slide a selector across the bar to select a specific value. The min
and max
options are the minimum and maximum values that can be selected on the slider. The step
option is the minimum change that the user can do with the slider. The default
option is the value the slider is on when the form is opened.
slider-component:
text: '&3Minecraft Servers You Play on' #': (amount)' is followed after this
type: SLIDER
# a number or placeholder
# {balance} for the user's balance
# {min_bounty} for the minimum bounty amount
min: '1'
max: '20'
# step size for the slider
step: 1
# value to start on
default: 1
commands:
- 'tell admin {player} plays on {value} Minecraft servers!'
Step Slider
The step slider is similar to the slider, but uses text instead of numerical values. The options
list controls what items are on the slider. The default-step
option controls how far the slider is slid to the right when the form is opened.
step-slider-component:
text: '&6Rate Your Experience Today:'
type: STEP_SLIDER
# what the slider starts on - 5 stars will be the default in this example
default-step: 5
# slider options
options:
- '★'
- '★★'
- '★★★'
- '★★★★'
- '★★★★★'