Skip to content

About

Addon for zMenu ( requirements added in pagination)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

zMenusAddon

PlanetRealms zMenu addon. It adds the PR_LIST button type: a list of entries where each player only sees the entries they pass, packed into the slots in order with no gaps, paged with zMenu's normal NEXT / PREVIOUS buttons.

It's a separate plugin, so zMenu is not forked and updates normally.

Config

tags:
  type: PR_LIST
  slots: [19-25, 28-34]
  item:        # default item for every element
  actions:     # default click actions for every element
  else:        # optional: item for leftover list slots (blocks clicks, shows a tooltip)
  elements:
    - id: santa                 # any plain key becomes a %key% placeholder
      name: '<red>Santa'
      view-requirement:         # optional, same format as zMenu's view-requirement; all must pass
        requirements:
          - type: permission
            permission: eternaltags.tag.santa
      item:                     # optional override, merged over the default item
        material: RED_WOOL
      actions:                  # optional override, replaces the default actions
        - type: close
  • view-requirement (also accepts view_requirement / view-requirements): a player only sees the element if all its requirements pass. Deny/success actions are not run, it's only a filter.
  • Every type: permission node used in element requirements is registered with the server (default: OP), so LuckPerms tab-completes it and its web editor lists it.
  • Element item: fields you leave out fall back to the default item, and nested sections merge.
  • Element actions: replaces the default actions for that element only.
  • Placeholders: every plain key on an element (id, name, description, ...) works as %key% in its item and actions. PlaceholderAPI placeholders work as normal.
  • else: clicking it does nothing. Without else, leftover slots stay empty.
  • Paging: the page size is the number of slots. zMenu's NEXT / PREVIOUS and its has_next_page / has_previous_page checks use this button's per-player size.

A full example is in examples/pr_list_example.yml.

Build

gradle build          # -> build/libs/zMenusAddon-1.0.0.jar
  • Java 21, Paper 1.21.11.
  • zMenu isn't on a public Maven repo, so it compiles against libs/zMenu-1.1.1.9.jar (the same jar the server runs). When the server updates zMenu, replace that jar and update build.gradle.kts.

Install

  1. Put zMenusAddon-1.0.0.jar in plugins/ next to zMenu and restart (not /reload).
  2. Use type: PR_LIST in any zMenu inventory. /zm reload reloads menus as normal.

How it works

  • ZMenusAddonPlugin registers ListButtonLoader with zMenu's ButtonManager service. zMenu then loads any menu that was waiting for PR_LIST.
  • ListButtonLoader reads elements and else. zMenu itself loads slots, item and actions onto the button afterwards.
  • ListButton extends PaginateButton: getPaginationSize returns how many elements the player passes, and onRender places the current page's slice into the slots and wires each slot's click to that element's actions.

About

Addon for zMenu ( requirements added in pagination)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages