Skip to content

Click Handlers

SuperRonanCraft edited this page Jul 27, 2020 · 40 revisions

The click-handler lets you add different actions to an item to execute commands/events.
Do you want to make a condition if someone clicks an item with the left button, and another condition with shift + right click, you can do it! Just add multiple conditions, every one is called, and the ones passed will execute the commands!

Example:

Items:
  <UNIQUEID>:
    Click-Handlers:
      <UNIQUEID>:
        Click-Type: 'left, right, middle'
        Shift: false
        Server: 'Lobby'
        Commands:
        - 'message: &7You clicked me!'
        Close: true
        Arguments: []

Summary


Commands

Type Supports Placeholders?
StringList Yes

List of commands that will be performed once a click-handler has passed successfully.

You can use the following formats, to perform different actions:

  • player: <command> Runs a command as a player (Default)
  • console: <command> Runs a command as a console
  • op: <command> Execute a command as an operator
  • chat: <message> Makes the player send a chat message
  • menu: <Menu without .yml> [arguments] Opens another menu without using /acm open <menu> [arguments] (Supports arguments!)
  • server: <servername> Sends a player to another server on BungeeCord
  • broadcast: <message> Send a message to all player
  • give: <item> Gives a item to the player (Format: <ItemName/Number>:[data]:[amount])
  • tellraw: <json message> Sends a json-message to the player
  • tellallraw: <json message> Sends a json-message to all players
  • banner: <banner-pattern> Give a banner with a specified Banner-Pattern
  • title: Display a title message to the player (Format: <message> {in:#,out:#,stay:#} # = ticks) use /n to create a subtitle
  • titleall: Display a title message to all online players
  • actionbar: Display an action bar message to the player (In Progress)

Special Placeholders:

  • {delay:<ticks>} Delays the command you are trying to do by the amount of ticks defined! (Used anywhere in a command)

Examples:

Commands:
- 'message: &aWarping to &6Spawn&a in 5 seconds!'
- 'player: warp spawn {delay: 100}' #Will delay the command by 100 ticks, or 5 seconds!
- 'message: &aCongratulations %player_name% you have been teleported to &6Spawn! {delay:110}'

Click-Type

Type Supports Placeholders? Default
Node No All

The way the player must click on a item to perform the action(s).

These can all be combined using commas (ex: 'left, right, middle')

Valid Nodes:

  • left: Player must left click
  • right: Player must right click
  • middle: Player must middle click

Shift

Type Supports Placeholders? Default
Boolean No None

Specifies if the click-handler needs shift to be pressed to perform the action.


Close

Type Supports Placeholders? Default
Node No False

Choose if the menu should be closed after clicking on the item.

Valid Nodes:

  • true will close the menu after the player clicks
  • false will not close the menu
  • onsuccess will close if the click-handler was successfully passed

Permission

Type Supports Placeholders?
String/StringList Yes

Set one or more permissions that the player needs to have to perform the action(s).
Use a - in front to require NOT having the permission (ex: -some.permission)

Example:

# One Permission
Permission: 'advancedcustommenu.awesome'

# Multiple
Permission:
  - 'advancedcustommenu.awesome'
  - '-advancedcustommenu.lame'

Permission-Message

Type Supports Placeholders? Needs Default
String, StringList Yes Permission Language No-Permission:

Sends a message if the player doesn't have the required permission.

Special Placeholders:

  • %permission%: Returns the permission needed

Server

Type Supports Placeholders?
String, StringList No

Set one or more permissions servers that the player needs to be on to allow this click-handler

Example:

# One Server
Server: 'Lobby'

# Multiple allowed Servers
Server:
  - 'Lobby'
  - 'Survival'

Server-Message

Type Supports Placeholders? Needs Default
String, StringList Yes Server Language Server:

Sends a message if this server is click-handler cannot perform in the server specified


Delay

Type Supports Placeholders? Default
Integer No 0

Set a delay (cooldown) to when an item is allowed to be clicked again.
Saves over restarts, reloads and join/leave events.
This section will generate a new file named "delays.yml"


Delay-Message

Type Supports Placeholders? Needs Default
StringList Yes Delay Language Delay:

Set the message when the cooldown is still active.

Special Placeholders:

  • {hoursleft}: Returns the amount of hours left
  • {minutesleft}: Returns the amount of minutes left
  • {secondsleft}: Returns the amount of seconds left

Price

Type Supports Placeholders? Required Dependencies
Integer Yes Vault + an Economy-plugin

Set the price that the player needs to pay to perform the action(s).


Price-Message

Type Supports Placeholders? Needs Default
StringList Yes Price Language Price:

Set a custom message when the player doesn't have enough currency.

Special Placeholders:

  • %price%: Returns the vault currency needed to purchase

Points

Type Supports Placeholders? Required Dependencies
Integer Yes PlayerPoints

Set the amount of points that the player needs to pay to perform the action(s).


Points-Message

Type Supports Placeholders? Needs Default
StringList Yes Points Language Points:

Set a custom message when the player doesn't have enough points.

Special Placeholders:

  • %points%: Returns the points needed to purchase

Experience

Type Supports Placeholders? Added
Integer No 3.4.0

Set a amount of experience levels that the player needs to pay to perform the action(s)!


Experience-Message

Type Supports Placeholders? Needs Default
StringList Yes Experience Language Experience:

Set a custom message if the player doesn't have enough experience levels.

Special Placeholders:

  • %experience%: Returns the amount of experience levels needed

Items

Type Supports Placeholders? Added
String/StringList No 3.4.0

Set the item(s) the player needs to have to perform the action(s)!


Items-Message

Type Supports Placeholders? Needs Default
String/StringList Yes Items Config Items:

Set a custom message if the player doesn't have an item.

Special Placeholders:

  • %item%: Returns the first item type the player doesnt have (ex: Stone)
  • %item-amount%: Returns the amount of the item (ex: 5)

Items-Take

Type Supports Placeholders? Needs Default
Boolean No Items False

Set whether or not to take the required item(s).


Give

Type Supports Placeholders? Added
String/StringList No 4.1.0

Set the item(s) to SAFELY give a player, if not enough space it will not perform the action(s)!


Give-Message

Type Supports Placeholders? Needs Default
String/StringList Yes Give Language Give:

Set a custom message if the player doesn't have enough space in their inventory.


Sound

Type Supports Placeholders?
String/Section No

Plays a sound everytime the item is clicked
Format: <sound>:[volume]:[pitch]

Sounds for 1.8 can be found on GitHub
1.9+ Sounds can be found on Spigot

This can also be a section to indicate advanced sounds

  • Basic

    Plays a sound everytime the item is clicked

  • Success

    Plays a sound if the click-handler passed

  • Failed

    Plays a sound if the click-handler failed

Example:

# Basic Sound
Sound: 'BLOCK_ANVIL_BREAK:1:1'

# Advanced Sounds
Sound:
  Basic: 'BLOCK_ANVIL_BREAK:1:1'
  Success: 'BLOCK_NOTE_BELL:0.5'
  Failed: 'BLOCK_STONE_BUTTON_CLICK_ON'

Arguments

Type Added
Key Section 4.2.0

Learn how to check for conditions being met with Arguments!

Updated to 4.2.0

Clone this wiki locally