🎹Main Menu Configuration

The Main Menu is the first menu that pops up when a player types the /settings command. It acts as a central hub for navigating to other pages in your settings system. You can configure this menu to display items that serve as shortcuts to specific pages, allowing for a smooth user experience.

Structure of the Main Menu

Below is the structure required for the main menu:

Structure of the Main Menu

Below is the structure required for the main menu:

Inventory:
  size: 54
  name: "Settings - Page %page%"
  Page-Count: 1
  filler:
    material: BLACK_STAINED_GLASS_PANE
    displayName: " "
    amount: 1
    lore:
      - ""
  Next-Page:
    material: ARROW
    displayName: "&eNext Page"
    amount: 1
    lore:
      - "&7Left Click to go to next page"
  Previous-Page:
    material: ARROW
    displayName: "&ePrevious Page"
    amount: 1
    lore:
      - "&7Left Click to go to previous page"
  close:
    material: MAGMA_CREAM
    displayName: "&cClose"
    amount: 1
    lore:
      - "&7Left Click to close this page"
  items:
    1:
      page: 1
      slot: 10
      material: REDSTONE
      displayName: "&eGeneral Settings"
      SettingPageName: "Settings.yml"
      permission: "menu.settings"
      amount: 1
      lore:
        - "&7Click to edit"

Key Fields in the Main Menu Configuration

1. Inventory

The top-level configuration for the main menu:

  • size: The total size of the inventory (must be a multiple of 9). Example: 54

  • name: The title of the menu displayed at the top. Example: "Settings - Page %page%"

  • Page-Count: The total number of pages for this menu. Example: 1


2. Filler Slots

  • filler: Used to fill empty slots in the inventory with a specific item.

    • Example:

      filler:
        material: BLACK_STAINED_GLASS_PANE
        displayName: " "
        amount: 1
        lore:
          - ""

3. Navigation Buttons

  • Next-Page and Previous-Page: Items used to navigate between pages of the main menu.

    • Example:

      Next-Page:
        material: ARROW
        displayName: "&eNext Page"
        amount: 1
        lore:
          - "&7Left Click to go to next page"

4. Items

The items section defines individual interactive elements within the main menu. Each item represents a shortcut to another settings page.

Item Fields

  • page: The page number this item is associated with in the settings system.

  • slot: The slot number (0-based index) where this item will appear in the inventory.

  • material: The material type for the item. Example: REDSTONE

  • displayName: The name displayed for the item. Example: "&eGeneral Settings"

  • SettingPageName: The name of the settings page this item links to. It should correspond to the YAML file inside the Pages folder. Example: "Settings.yml"

  • permission (optional): The permission required to view and interact with this item. Example: "menu.settings"

  • amount: The number of items in the stack. Example: 1

  • lore: A list of strings for the item's description. Example:

    lore:
      - "&7Click to edit"

Example Main Menu Configuration

Here’s a complete example of a main menu with two interactive items:

Inventory:
  size: 54
  name: "Settings - Page %page%"
  Page-Count: 1
  filler:
    material: BLACK_STAINED_GLASS_PANE
    displayName: " "
    amount: 1
    lore:
      - ""
  Next-Page:
    material: ARROW
    displayName: "&eNext Page"
    amount: 1
    lore:
      - "&7Left Click to go to next page"
  Previous-Page:
    material: ARROW
    displayName: "&ePrevious Page"
    amount: 1
    lore:
      - "&7Left Click to go to previous page"
  close:
    material: MAGMA_CREAM
    displayName: "&cClose"
    amount: 1
    lore:
      - "&7Left Click to close this page"
  items:
    1:
      page: 1
      slot: 10
      material: REDSTONE
      displayName: "&eGeneral Settings"
      SettingPageName: "Settings.yml"
      permission: "menu.settings"
      amount: 1
      lore:
        - "&7Click to edit"
    2:
      page: 2
      slot: 12
      material: DIAMOND
      displayName: "&eAdvanced Settings"
      SettingPageName: "AdvancedSettings.yml"
      permission: "menu.advanced"
      amount: 1
      lore:
        - "&7Click to edit advanced settings"

Connecting the Main Menu to Pages

When a player clicks an item in the main menu:

  1. The plugin will open the settings page defined by the SettingPageName field. Example: Clicking the "General Settings" item will open the page configured in Settings.yml.

  2. You can add as many items as necessary to connect to all your pages.

  3. Permissions (e.g., "menu.settings") can restrict access to specific items, making it useful for role-based access.

Last updated