Skip to content

Build a duel GUI with ZMenu

Solar does not include built-in menus. It focuses on match handling and keeps the interface configurable through other plugins. A dedicated menu plugin can provide more control over layout and interactions without adding another GUI system to Solar.

This guide wires ZMenu to Solar’s duel command. The examples use ZMenu’s command and inventory configuration. ZMenu’s configuration format can change between releases, so check the documentation for the version installed on your server if a key or action differs.

Solar registers /duel <player> <kit> with optional --rounds and --map flags. Paper may expose this command under its plugin namespace, such as /solar:duel. If another plugin already owns the unnamespaced /duel label, use a Paper alias to send /duel requests to ZMenu while the menu calls Solar’s namespaced command.

The steps below use /d as the ZMenu command that opens the menu. If that label is already taken on your server, choose another unused label and update both files.

Open the server’s commands.yml and add this entry under aliases:

aliases:
duel:
- d $1-

$1- forwards everything after /duel to /d. For example, /duel Steve becomes /d Steve. If commands.yml already has an aliases section, add the duel entry there rather than creating a second section.

Create plugins/ZMenu/commands/duel/duel.yml:

commands:
duel_command:
command: d
inventory: duel
arguments:
- name: "target"
type: ONLINE_PLAYER
required: true

This registers /d <target> and opens the duel inventory. The inventory name must match the next file.

Create plugins/ZMenu/inventories/duel.yml:

name: 'Duel request for <color:#FCD05C>%zmenu_argument_target%</color>!'
size: 27
items:
btn-11:
slot: 11
item:
material: CLOCK
name: '<color:#FCD05C>Rounds</color> <white><italic>(Current: %zmenu_player_value_rounds%)</italic></white>'
actions:
- type: inventory
inventory: duel
page: 2
btn-13:
slot: 13
item:
material: DIAMOND_SWORD
name: '<color:#FCD05C>Send request!</color>'
close-inventory: true
playerCommands:
- 'solar:duel %zmenu_argument_target% %zmenu_player_value_kit% --rounds %zmenu_player_value_rounds%'
btn-15:
slot: 15
item:
material: CHEST_MINECART
name: '<color:#FCD05C>Choose the kit!</color> <white><italic>(Current: %zmenu_player_value_kit%)</italic></white>'
actions:
- type: inventory
inventory: duel
page: 3
btn-64:
slot: 10
page: 2
item:
material: CLOCK
name: '<color:#FCD05C>FT1</color> <italic>(First to 1)</italic>'
actions:
- type: data
action: SET
key: rounds
value: '1'
- type: back
btn-66:
slot: 12
page: 2
item:
material: CLOCK
amount: 2
name: '<color:#FCD05C>FT2</color> <italic>(First to 2)</italic>'
actions:
- type: data
action: SET
key: rounds
value: '2'
- type: back
btn-68:
slot: 14
page: 2
item:
material: CLOCK
amount: 3
name: '<color:#FCD05C>FT3</color> <italic>(First to 3)</italic>'
actions:
- type: data
action: SET
key: rounds
value: '3'
- type: back
btn-70:
slot: 16
page: 2
item:
material: CLOCK
amount: 4
name: '<color:#FCD05C>FT4</color> <italic>(First to 4)</italic>'
actions:
- type: data
action: SET
key: rounds
value: '4'
- type: back
btn-118:
slot: 10
page: 3
item:
material: DIAMOND_SWORD
name: '<aqua>Sword</aqua>'
actions:
- type: data
action: SET
key: kit
value: Sword
- type: back
btn-124:
slot: 16
page: 3
item:
material: CREEPER_HEAD
name: '<dark_green>CreeperSMP</dark_green>'
actions:
- type: data
action: SET
key: kit
value: CreeperSMP
- type: back

The menu stores the selected rounds and kit as player data. The Send request button runs Solar’s namespaced command with those selected values. Change the kit values to IDs that exist on your server. To select a specific arena as well, add --map <arena> to the command; if omitted, Solar selects a random arena allowed by that kit.

The --rounds flag defaults to 1 when used without a value. The example supplies the selected value explicitly.

  1. Make sure both example kit IDs exist in Solar, or change them to your own.
  2. Restart or reload Paper after changing commands.yml as required by your server.
  3. Run /zmenu reload.
  4. Test with /duel <online-player>, choose a rounds option and a kit, then send the request.

If Paper reports an unknown command, test /solar:duel <player> <kit> directly first. If it works, check the namespace and playerCommands syntax against your installed ZMenu and Paper versions.