Skip to content

Creating and Customizing a Menu

Creating a menu in PlayerProfile is a creative process. You can control every aspect of the display to create a unique profile for your server's players. All menu files are located in the plugins/PlayerProfile/menus/ folder.

The Basics: title-states, layout and icons

Each menu file consists of key parts: the title configuration (title and title-states), layout, and icons.

  1. title & title-states: Sets the default menu name and allows changing the title dynamically depending on conditions.
  2. layout: This is the visual representation of your menu. You "draw" the inventory using characters. Each character is a reference to an icon.
  3. icons: Here you describe what each character from the layout is: what item, what name, and what actions it performs.

Simple Example:

yaml
# menus/default.yml
title: 'Player Profile %owner%'

# Optional: Dynamic titles based on conditions
title-states:
  owner_title:
    conditions:
      - 'is_owner'
    title: '&aYour Profile'
  admin_title:
    conditions:
      - 'is_viewer'
      - 'has permission: playerprofile.admin'
    title: '&cAdmin View: %owner%'

rows: 3
layout:
  - '######### '
  - '#p#h#c#l#b'
  - '#########'

icons:
  '#': # Description for the '#' character
    material: BLACK_STAINED_GLASS_PANE
    display: ' '
  'p': # Description for the 'p' character
    type: STATUS
    # ... and so on

Icon Description (icons)

Each character in the icons section can have many parameters.

Basic Item Parameters

ParameterTypeDescription
materialstringThe material of the item from Minecraft (e.g., DIAMOND_SWORD).
item-adderstring(Integration) The ID of the item from ItemsAdder (e.g., my_items:cool_sword). Replaces material.
nexostring(Integration) The ID of the item from Nexo. Replaces material.
craft-enginestring(Integration) The ID of the item from CraftEngine (e.g., namespace:id). Replaces material.
item-modelstringSets the item component model (1.20.5+ / 1.21) via namespace key (e.g., custom:cool_sword).
displaystringThe name of the item. Supports & color codes and placeholders.
lorelist of stringsThe description of the item. Each string is a new element in the list.
custom-model-datanumberSets the CustomModelData for the item.
glowtrue/falseIf true, the item will glow (enchantment effect).
unbreakabletrue/falseIf true, the item will be unbreakable.
texturestringURL or Base64 texture for a player head. Only used if material is PLAYER_HEAD.

Custom Glyphs / Fonts

The plugin supports custom font images in titles, displays, and lore. For CraftEngine, you can use <image:namespace:id> or :namespace:id:. For Nexo/ItemsAdder, use their standard placeholder formats (like :glyph_name:).

Functional Parameters

ParameterTypeDescription
typestringKey parameter! Defines the slot type. For example, HELMET will automatically show the player's helmet, and STATUS will show their status. More on types...
actionslist of stringsA list of actions that will be executed when the item is clicked. More on actions...
permissionstringThe permission a player must have to see this item. If they don't have the permission, the slot will be empty.
action-executorstringWho can execute the action: OWNER (only the profile owner), VIEWER (only the one viewing), BOTH (both). Defaults to BOTH.

States & Conditions (states & conditions)

This is the most powerful feature of the plugin. It allows a single character (icons) to look and behave differently based on conditions.

Imagine an icon 's'. You can make it so that:

  • If the profile is being viewed by the owner, 's' will appear as "Settings".
  • If the profile is being viewed by an administrator, 's' will appear as "Admin Tools".
  • In all other cases, the 's' slot will be empty.

How it works?

Inside an icon's description, you create a states section. Within states, you list several states (state1, state2, etc.). Each state is essentially a complete item description with its own material, display, and actions.

The plugin checks the states in order (from top to bottom). The first state whose conditions are all met will be displayed.

If a state has no conditions, it will always be triggered (if reached).

List of available conditions (conditions)

ConditionDescription
is_ownertrue if the person viewing the profile is its owner.
is_viewertrue if the viewer is not the owner.
has permission: <permission>true if the viewer has the specified permission (e.g., playerprofile.admin).
lacks permission: <permission>true if the viewer does not have the specified permission.
placeholder '...' ... '...'(PAPI) Compares the value of a placeholder. Placeholders are parsed from the perspective of the profile owner.

Operators for placeholders:

  • equals or == (equal to)
  • notequals or != (not equal to)
  • contains (contains text)
  • is_greater_than or > (greater than, for numbers)
  • is_less_than or < (less than)
  • is_greater_or_equal or >= (greater than or equal to)
  • is_less_or_equal or <= (less than or equal to)

Full example of an icon with states

Let's create an s icon (settings) that will be different for the owner, an admin, and a regular player.

yaml
# ...inside icons:
's':
  type: DEFAULT # Default type
  states:
    # --- State 1: for the profile owner ---
    state1:
      conditions: # Condition:
        - 'is_owner'
      material: COMPARATOR
      display: '&a⚙ Profile Settings'
      lore:
        - '&7Click to change'
        - '&7your profile settings.'
      actions:
        - 'player: profile-settings' # Opens another menu (example)

    # --- State 2: for an admin viewing another profile ---
    state2:
      conditions: # Conditions (both must be met):
        - 'is_viewer'
        - 'has permission: playerprofile.admin'
      material: REDSTONE
      display: '&c⚙ Admin Tools'
      lore:
        - '&7Manage player %owner%''s profile.'
      actions:
        - 'player: profile-admin %owner%' # Opens the admin menu (example)

    # --- State 3: Empty slot for everyone else ---
    # This state has no conditions, so it will trigger
    # if state1 and state2 did not meet their conditions.
    state3:
      material: AIR

Important!

The order of states matters! Always place more specific conditions (e.g., for an admin) above more general ones.