Nexo
  • 🏠Home
  • πŸ“œMain Changelog
  • ❓FAQ
  • General Usage
    • ⌨️Commands
    • πŸ§‘β€πŸ³Recipes
  • Migrate
    • β˜„οΈOraxen β†’ Nexo
    • πŸ“¦ItemsAdder β†’ Nexo
  • Configuration
    • βš™οΈPlugin settings
    • ResourcePack
    • βš’οΈItems
      • Special Item Appearance
    • ⛑️Custom Armors
      • πŸͺ½Custom Elytras (1.21.2+)
      • Component Based (1.21.2+)
      • Trims Based (1.20-1.21.1)
    • πŸŒ€Glyphs
    • 🎡Sounds
  • Mechanics
    • πŸͺ‘Furniture Mechanic
      • 🎯Hitbox
      • πŸ–‡οΈConnectable Furniture
      • πŸͺ‘Seat Mechanic
      • πŸ›οΈBed Mechanic
      • πŸ’‘Light Mechanic
      • πŸ§‘β€πŸŒΎFarming Mechanic
    • πŸ“¦Custom Block Mechanics
      • ChorusBlock Mechanic
      • 🎢NoteBlock Mechanic
        • Stripped Log Mechanic
        • Directional Mechanic
      • 🧡StringBlock Mechanic
    • πŸ”±Custom Trident
    • Other Mechanics
    • clickAction Mechanic
    • Custom Mechanic
  • βž•Addons
    • πŸšͺCarpentry
    • 🧩Core Shaders
      • Text Effects by Akis
  • Compatibility
    • ModelEngine - custom mobs
    • MythicMobs - custom mobs
    • MythicCrucible
    • MMoItems
    • EcoItems
  • Community Guides
    • Vendors
    • API
Powered by GitBook
On this page
  • Configuration
  • Conditions
  • Actions
  1. Mechanics

clickAction Mechanic

Run commands, play sounds, or send messages when a player clicks a block or furniture.

PreviousOther MechanicsNextCustom Mechanic

Last updated 4 months ago

Configuration

To get started, create a basic or .

Next, under the mechanics section, you can add the default clickAction mechanic under any noteblock-mechanic, furniture-mechanic or stringblock-mechanic item.

myitem:
  Mechanics:      
    furniture/custom_block:
      clickActions:
        - conditions:
            - '#player.hasPermission("test.permission")'
          actions:
            - '[console] say <player> hello <player>!'

With this setup, players will only trigger the console command say hello <player> action if they have the permission test.permission.

If you are not using conditions, you need to place brackets where they would be:

myitem:
  Mechanics:
    furniture/custom_block:
      clickActions:
        - conditions: []
          actions:
            - '[console] say <player> hello <player>!'

This mechanic does not support furniture with no hitbox.

Conditions

Conditions are VERY configurable. You can use any of the "get" methods for Player or Server. See the Spigot Javadocs for all methods.

Additionally, the Spring Documentation is a good resource for understanding how to use condition expressions.

Condition Examples

#server.getOnlinePlayers().size() > 10

#server.getAllowEnd()

#server.getDefaultGameMode()

#player.world.name == 'world'

#player.hasPermission("test.permission")

#player.gamemode.name() == 'ADVENTURE'

Actions

[console] <command>

[player] <command>

[message] <message>

[actionbar] <message>

{source=SOURCE volume=VOLUME pitch=PITCH} [sound] <sound name>

Action Examples

[console] say hello

[player] say hello

[message] <blue>Hello!

[actionbar] <gray>Hello from the actionbar!

{source=AMBIENT volume=0.1 pitch=1} [sound] minecraft:block.shulker_box.close

Block
Furniture
Page cover image
Player (Spigot-API 1.18.1-R0.1-SNAPSHOT API)
TIP! Click "CTRL + F" and search "get" to find valid methods.
Logo
Server (Spigot-API 1.18.2-R0.1-SNAPSHOT API)
Logo
6.Β Spring Expression Language (SpEL)
Logo