Action

The action system offers pre-set effects provided by the plugin. However, you can also add your own actions by using the API. This system can be applied anywhere an action can be triggered, like when you break a crop, interact a pot etc.

Action is composed of three parts

type: The action type
value: The arguments of the action
chance: Optional (0~1 Default: 1)

If the value is an integer or a double value, you can use expression for instance

exp_action:
  type: exp
  value: '{level} * 3'

Here's an example that combines the conditions and actions. In this example, if you interact the ripe crop with empty hand, it would be harvested. If you interact it with a seed, it would be replanted.

      events:
        interact:
          action_1:
            type: conditional
            value:
              conditions:
                requirement_1:
                  type: item-in-hand
                  value:
                    item: "AIR"
              actions:
                action_1:
                  type: break
                  value: true
                action_2:
                  type: swing-hand
                  value: true
          action_2:
            type: conditional
            value:
              conditions:
                requirement_1:
                  type: item-in-hand
                  value:
                    item: "customcrops:tomato_seeds"
                    amount: 1
              actions:
                action_1:
                  type: break
                  value: true
                action_2:
                  type: swing-hand
                  value: true
                action_3:
                  type: plant
                  value:
                    crop: tomato
                    point: 0
                action_4:
                  type: item-amount
                  value: -1

Action Library

message (Send a message to player)

messages_action:
  type: message
  value:
    - '<#FF4500>[1st] Congratulations! You got the first prize!'

broadcast (Send a message to online players)

broadcast_action:
  type: broadcast
  value:
    - 'Hello!'

command (Execute a console command)

command_action:
  type: command
  value:
    - 'money give {player} 200'

random-command (Execute a random console command from list)

command_action:
  type: random-command
  value:
    - 'money give {player} 200'
    - 'money give {player} 100'
    - 'money give {player} 50'

close-inv (Close the inventory player is currently opening)

close_action:
   type: close-inv

actionbar

actionbar_action:
  type: actionbar
  value: 'Hi'

random-actionbar

actionbar_action:
  type: random-actionbar
  value: 
    - 'Hi'
    - 'Hello'
    - 'Hola'

mending (Give player exp that would be applied to mending)

mending_action:
  type: mending
  value: 1

force-tick

tick_action:
  type: force-tick

swing-hand

swing_action:
  type: swing-hand
  value: true  # true = main hand | false = off hand

exp (Give player exp that would directly go into levels)

exp_action:
  type: exp
  value: 1

chain (Execute actions as a group)

chain_action:
  type: exp
  value: 
    action_1: ...
    action_2: ...
  chance: 0.5

delay (Delay x ticks)

delay_action:
  type: delay
  value: 
    delay: 20
    async: false
    actions:
      action_1: ...
      action_2: ...

timer

timer_action:
  type: timer
  value: 
    delay: 3
    async: false
    duration: 20
    period: 2
    actions:
      action_1: ...
      action_2: ...

hologram (Display a hologram for some time)

hologram_action:
  type: hologram
  value:
    duration: 20
    text: '{water_bar}'
    apply-correction: true  # apply corrections on each crop
    visible-to-all: false
    y: 2
    x: 0
    z: 0

fake-item (Display a fake item for some time)

fake_item_action:
  type: fake-item
  value:
    duration: 25     <- ticks
    position: other  <- other/player
    item: util:lava_splash_item
    y: 0             <- y offset
    x: 0             <- x offset
    z: 0             <- z offset 
    visible-to-all: true

food

https://minecraft.wiki/w/Hunger

food_action:
  type: food
  value: 2

saturation

https://minecraft.wiki/w/Hunger

saturation_action:
  type: saturation
  value: 1.5

give-item

item_action:
  type: give-item
  value:
    item: xxx
    amount: 10

item-amount

item_amount_action:
  type: item-amount
  value: -1

durability

durability_action:
  type: durability
  value: -1

variation (Crops turning into another block and stops growing)

variation_action:
  type: variation
  value:
    gigantic:
      item: gigantic_tomato
      type: CHORUS
      chance: 0.02
    xxx:
      item: xxx
      type: CHORUS
      chance: 0.07

quality-crops

crop_action:
  type: quality-crops
  value:
    to-inventory: false
    min: 1
    max: 4
    items:
      1: tomato
      2: tomato_silver_star
      3: tomato_golden_star

drop-item

drop_action:
  type: drop-item
  value:
    to-inventory: false
    ignore-fertilizer: true
    item: tomato_seeds
    min: 1
    max: 2

plant

plant_action:
  type: plant
  value:
    crop: tomato
    point: 0

break

break_action:
  type: break
  value: true # whether to trigger "break" event

particle

particle_action:
  type: particle
  value:
    particle: FLAME
    x: 0.5
    y: 0.5
    z: 0.5
    count: 10
    offset-x: 0.5
    offset-y: 0.5
    offset-z: 0.5
    extra: 0.0
    # Only works when particle is ITEM_CRACK
    itemStack: customcrops:xxx
    # Only works when particle is REDSTONE/DUST_COLOR_TRANSITION
    color: 255,0,0
    scale: 1
    # Only works when particle is DUST_COLOR_TRANSITION
    to-color: 0,0,255

give-money

money_action:
  type: give-money
  value: 100.12

take-money

money_action:
  type: take-money
  value: 50.54

title

title_action:
  type: title
  value:
    title: '<green>Hello!</green>'
    subtitle: 'This is the subtitle!'
    fade-in: 20
    stay: 30
    fade-out: 10

random-title

title_action:
  type: random-title
  value:
    titles:
      - '<green>Hello!</green>'
      - '<green>Hi!</green>'
    subtitles:
      - 'Subtitle 1'
      - 'Subtitle 2'
    fade-in: 20
    stay: 30
    fade-out: 10

sound

sound_action:
  type: sound
  value:
    key: 'minecraft:block.amethyst_block.place'
    source: 'player'
    volume: 1
    pitch: 1

potion-effect

potion_action:
  type: potion-effect
  value:
    type: 'blindness'
    duration: 20
    amplifier: 0

plugin-exp (Experience from other plugins for instance a job/skill plugin)

plugin_exp_action:
  type: plugin-exp
  value:
    plugin: AureliumSkills
    exp: 20
    target: FARMING

conditional (Actions can only be triggered when player satisfy the conditions)

conditional_action:
  type: conditional 
  value:
    conditions:
       ...
    actions:
       ...

priority (Execute the first action group that meets the conditions.)

priority_action:
  type: priority
  value:
    priority_1:
      conditions:
         ...
      actions:
         ...
    priority_2:
      conditions:
         ...
      actions:
         ...
    others:
      actions:
         ...   

level

money_action:
  type: level
  value: -10

Last updated