TrMenu
PurchaseGithubLicense
English
English
  • Home
  • Start
    • Install
    • Setup
  • Migrate
  • MENU
    • Structure
      • Title
      • Layout
      • Options
      • Bindings
      • Events
      • Buttons
      • Built-in Scripts
      • Tasks
    • Icons
      • Update
      • Refresh
      • Display
        • Material
        • Name
        • Lore
        • Amount
        • Glow
        • Flags
        • NBT
      • Actions
      • Priority
      • Condition
      • Inherit
  • ACTIONS
    • Types
      • Command (as Player)
      • Command (as OP)
      • Command (as CONSOLE)
      • Player's chat
      • Message
      • Tellraw
      • ActionBar
      • Title/SubTitle
      • Sound
      • Bungee Server
      • JavaScript
      • Input Catcher
        • Re-Enter
      • Useful
        • Delay
        • Break
      • Items
        • Take-Items
        • Give-Item
        • Enchant-Item
        • Repair-Item
      • Economy
        • Give-Money
        • Take-Money
        • Set-Money
        • Give-Points
        • Take-Points
        • Set-Points
      • Menu
        • Close
        • Close (Silent)
        • Open
        • Page
        • Set-Args
        • Set-Title
        • Refresh
      • Datas
        • Set-Meta
        • Rem-Meta
        • Set-Data
        • Rem-Data
    • Options
      • Delay
      • Condition
      • Chance
      • All Players
    • Action
  • SCRIPT
    • Expressions
      • stringEquals
      • stringEqualsIgnoreCase
      • isNumber
      • isOperator
      • isPlayerOperator
      • hasPermission
      • hasLevel
      • hasMoney
      • hasPoints
      • hasItem
    • Scripts
  • FUNCTIONS
    • Arguments
    • Item Identifiers
    • Script Placeholder
    • Register Commands
    • Shortcuts
    • Commands
  • HOOK
    • PlaceholderAPI
    • Cronus
    • Vault
    • PlayerPoints
    • HeadDatabase
    • Oraxen
    • SkinsRestorer
  • API
    • TrMenuAPI
    • Events
      • MenuOpenEvent
      • MenuCloseEvent
      • MenuClickEvent
    • MenuFactory
Powered by GitBook
On this page
  • Example
  • Click types
  • Tips
  • Note

Was this helpful?

  1. MENU
  2. Icons

Actions

Actions executed once you click the button

Example

'Close':
  update: [-1, 5, -1, -1]
  display:
    material: Red Stained Glass Pane
    name: ['&cC&7lose', '&cCl&7ose', '&cClo&7se', '&cClos&7e', '&cClose']
  # actions section
  actions:
    # Click type (all of the supported ones)
    all: close
  '*':
    update: [-1, 5, 20, -1]
    display: # ...
    # Actions section
    actions:
      # Click type (left click)
      left:
        - 'set-meta: icon_server_hide true'
        - 'sound: BLOCK_NOTE_BLOCK_BIT-1-0'
        - 'refresh'

Click types

package me.arasple.mc.trmenu.api.inventory

/**
 * @author Arasple
 * @date 2020/3/22 10:23
 */
enum class InvClickType {

    /**
     * Left CLick
     */
    LEFT,

    /**
     * Shift + Left Click
     */
    SHIFT_LEFT,

    /**
     * Right CLick
     */
    RIGHT,

    /**
     * Shift + Right Click
     */
    SHIFT_RIGHT,

    /**
     * Middle Click (mouse wheel)
     */
    MIDDLE,

    /**
     * Shift + Middle Click
     */
    DOUBLE_CLICK,

    /**
     * Drop key (Q by default)
     */
    DROP,

    /**
     * Switch Item in Offhand (F by default) (1.16+)
     */
    OFFHAND,

    /**
     * Ctrl + Drop key
     */
    CONTROL_DROP,

    /**
     * Creative mode + Middle Click
     */
    CREATIVE,

    /**
     * Number Keys from 1 to 9
     */
    NUMBER_KEY,

    /**
     * Number Key 1
     */
    NUMBER_KEY_1,

    /**
     * NumberKey 2
     */
    NUMBER_KEY_2,

    /**
     * Number Key 3
     */
    NUMBER_KEY_3,

    /**
     * Number Key 4
     */
    NUMBER_KEY_4,

    /**
     * Number Key 5
     */
    NUMBER_KEY_5,

    /**
     * Number Key 6
     */
    NUMBER_KEY_6,

    /**
     * Number Key 7
     */
    NUMBER_KEY_7,

    /**
     * Number Key 8
     */
    NUMBER_KEY_8,

    /**
     * Number Key 9
     */
    NUMBER_KEY_9,

    /**
     * Left Border of the Inventory
     */
    WINDOW_BORDER_LEFT,

    /**
     * Right Border of the Inventory
     */
    WINDOW_BORDER_RIGHT,

    /**
     * All above supported types
     */
    ALL;

}

Tips

  • You can easily combine multiple click types to execute the same actions

actions:
  # The action will be executed if you left clicked the button,
  # middle clicked it, or pressed the 8 key button.
  left,middle,number_key_8:
    - 'tell: Hello'

Note

  • Actions support multiple action types, the same as those in the Periodic Tasks and in the Menu Events. They will be listed and detailed later.

  • The actions section must be at the same level as the displaysection

  • Both default button icons and conditionnal icons can have seperated actions.

PreviousNBTNextPriority

Last updated 4 years ago

Was this helpful?