Oraxen
Search…
clickAction Mechanic
Run commands, play sounds, or send messages when a player clicks a block or furniture.

Information

The clickAction mechanic allows you to run commands, play sounds, or send messages when a player clicks on a furniture or a block.

Configuration

To get started, create a basic Block or Furniture.
Next, under the mechanics section, you can add the default clickAction mechanic.
1
Mechanics:
2
clickActions:
3
- conditions:
4
- '#player.hasPermission("test.permission")'
5
actions:
6
- '[console] say hello <player>!'
Copied!
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:
1
Mechanics:
2
clickActions:
3
- conditions: []
4
actions:
5
- '[console] say hello <player>!'
Copied!
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.
Player (Spigot-API 1.18.1-R0.1-SNAPSHOT API)
Server (Spigot-API 1.18.2-R0.1-SNAPSHOT API)
TIP! Click "CTRL + F" and search "get" to find valid methods.
Additionally, the Spring Documentation is a good resource for understanding how to use condition expressions.
6. Spring Expression Language (SpEL)

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