Conditions

Conditions can be used to only have a function execute if conditions are met.

Information on various types of conditions can be found here: Conditions

## Players with 'example.diamond' permission
## can get a diamond by clicking the button

diamond_button:
  type: button
  size: 256 128
  color: green
   
  on-click:
    give_function:
      type: command
      execute-from-console: true
      command: 'minecraft:give %player_name% diamond 1'
      conditions:
        perm1:
          type: permission
          permission: example.diamond
    no_perm:
      type: send_message
      message: 'You do not have the permission to get a diamond'
      conditions:
        noperm1:
          ## Negated check, it is met when player doesn't have the permission
          type: '!permission'
          permission: example.diamond      
          

Last updated