Skip to content

Creating a menu

Daniel Saukel edited this page Apr 30, 2019 · 13 revisions

To create a menu, all you need to do is adding a new file at plugins/HolographicMenus/menus. A menu script named for example mymenu.yml can be opened in game with /m mymenu if the player has the permission holographicmenus.menu.mymenu.

# PRIVATE If just the menu opener is supposed to see it
# PUBLIC If anyone may see it
type: PRIVATE

# If the menu should follow the player when they move (true by default).
# PUBLIC menus of course don't follow players.
followingOnMove: true

# The content of this section will change depending on the opened menu page.
# Take care of the indents.
menuPages:
  1:
    buttons:
      1:
        # The text the button shows. Color codes are supported.
        label: "&5&l>> PAGE 1 <<"
        # The type of the button.
        # TITLE = A cosmetic button that players are not supposed to interact with.
        # BUTTON = A clickable button that executes a command when punched.
        # FIRST_PAGE = Switchs to the first of all menu pages.
        # LAST_PAGE = Switchs to the last of all menu pages.
        # PREVIOUS_PAGE = Switchs to the previous menu page.
        # NEXT_PAGE = Swtichs to the next menu page.
        type: TITLE
        # How far on the right the button shall appear relatively to the eye direction.
        x: 0.0
        # How high the button shall appear relatively to the eye direction.
        y: 0.4
      2:
        label: "&4[ GIVE ITEM ]"
        type: BUTTON
        # The command to execute when the button is punched.
        # %v[number]% will be replaced with input fetched from the chat afterwards.
        command: "give %v1% %v2% %v3%"
        # The messages to send to the player to ask for chat input
        variableMessages:
        # Refers to %v1%
          - "&ePlease enter the receiver of the item to give."
        # Refers to %v2%
          - "&ePlease enter the type of the item to give."
        # ...and so on
          - "&ePlease enter the amount of the item to give."
        # Shall the menu be closed when the button is touched?
        closeMenu: true
        # The permission a player needs to see the button.
        permission: menu.click
        x: 0.0
        y: 0.1
    # 3: ... third button
  2:
    buttons:
      1:
        label: "&5&l>> PAGE 2 <<"
        type: TITLE
        x: 0.0
        y: 0.4
# 3: ... third page

# The content of this section will remain the same for all pages.
staticButtons:
  1:
    # You can also use an item instead of text.
    # Note that this feature might not work depending on the hologram provider.
    # HolographicDisplays supports item lines, but alternative providers that
    # might get supported in the future are likely not to do so.
    #
    # -1.12: "INK_SACK" refers to the Bukkit Material enumeration value
    #        (https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html)
    #        and ":4" to the data value.
    # 1.13+: Bukkit Material values now equal the internal IDs of Minecraft.
    #        Thus, you can simply use "LAPIS_LAZULI" instead of "INK_SACK:4".
    item: "INK_SACK:4"
    type: TITLE
    x: 0.0
    # Item lines appear a bit lower than text lines.
    y: 1.8
  2:
    label: "&6&lHEAD LINE"
    type: TITLE
    x: 0.0
    y: 0.7
  3:
    label: "&3<<<"
    type: PREVIOUS_PAGE
    # The sound to play when the button is punched.
    sound: ui.button.click
    x: -0.5
    y: -0.5
  4:
    label: "&3>>>"
    type: NEXT_PAGE
    sound: ui.button.click
    x: 0.5
    y: -0.5
  5:
    label: "&a[CLOSE]"
    type: BUTTON
    sound: ui.button.click
    closeMenu: true
    x: 0.0
    y: -0.2

# The distance between the player's location and where the button shall appear.
distance: 1.75

# How many degrees a player may turn until the menu follows the movement.
# This is useful if you have buttons that use an X value higher or lower than 0.
# If you do not use buttons that do so, the rotation tolerance should be set to 0
# because lower values lead to noticeably smoother movement.
rotationTolerance: 25
Clone this wiki locally