Events Tutorial

Each of the events in the config follows a certain format. Here you can find the explanation of the options you can use. Everytime you modify something in this file you must reload the plugin using /ce reload

Type

The type of the event to detect. You can find more information about event types on the Event Types page.

type: block_interact

Conditions

The conditions of this event. If the conditions are accomplished, certain actions will be executed. You can find more information about conditions in the Conditions page.

conditions:
- '%victim% == PLAYER'
- '%item% == DIAMOND_SWORD'
- '%item_name% == Super Sword'
- '%random_1-10% >= 8'

Actions

The actions to execute when the conditions of the events are accomplished. You can find more information about actions in the Actions page.

actions:
  default:
  - "cancel_event: true"
  - "message: &cYou can't break blocks on this world."
  - "playsound: BLOCK_NOTE_BLOCK_PLING;10;0.1"

Action Groups

Actions are always defined under a group with a certain name. When conditions from an event are accomplished, the actions inside the "default" group will be executed, unless specified otherwise.

For example, if you add cooldown to the event, the default action group will be executed if the player is not on cooldown. Instead, the cooldown action group will be executed if the player has a remaining cooldown.

actions:
  default: []
  cooldown: []

The execute option also allows you to execute actions from a different group.

Ignore With Permission

You can set a permission to completely ignore this event. If the player accomplishes the conditions having this permission, actions will not be executed for him.

ignore_with_permission: conditionalevents.ignore.event4

Ignore If Cancelled

When this option is enabled, it will prevent the execution if the event was already cancelled by another plugin.

ignore_if_cancelled: true

Allow Math formulas in Conditions

If you want to compare formulas in the conditions of an event, you must enable this option.

allow_math_formulas_in_conditions: true
conditions:
- '%command% equals /test-kills'
- '%statistic_player_kills% >= %statistic_deaths%*2'

One Time

If is set to true, players will execute the actions of this event just once. You can also set an action group that will execute when a player accomplishes the conditions again, but already had executed the default actions.

The action group MUST be called "one_time".

one_time: true
actions:
  one_time:
  - "message: &cYou can claim this reward just once!"

Cooldown

Here you can define a cooldown for this event. If the player accomplishes the conditions, the player will need to wait certain time before executing the actions again. Write the cooldown in seconds. You can also set an action group that will execute when a players accomplishes the conditions again but is in cooldown.

The action group MUST be called "cooldown".

OP players will bypass the cooldown so make sure you are not OP when testing this feature.

cooldown: 3600
actions:
  cooldown:
  - "cancel_event: true"
  - "message: &cYou need to wait &e%time% &cbefore claiming your reward again."

Enabled

Set this option to false to disable the event without removing it from the config. If you want the event to be active just set it to true or remove this option.

enabled: false

Repetitive Time

If the event type is set to "repetitive" or "repetitive_server", this option defines the period of time in TICKS (20 ticks = 1 second) when checking the conditions.

type: repetitive
repetitive_time: 10

Prevent Cooldown/One Time Activation

A useful property when using the "execute" option in conditions. Here you can define a list of action groups where you don't want to activate cooldown/one time.

prevent_cooldown_activation:
- "actions2"
prevent_one_time_activation:
- "actions2"
- "actions3"

In some cases, you will have action groups used only to show some errors to the player. If you don't add this property to an event like this, it will result in users executing the action group for error messages, and activating the one time at the same time, meaning the player will not be able to use this event anymore. The real event was not really executed, so this option helps you to fix that.

Custom Event Data

ConditionalEvents allows you to check for any event you want, even from other plugins. You can find an explained example to show you how these events work in the Custom Events page.

custom_event_data:
  event: dt.ajneb97.api.TurretPlaceEvent
  player_variable: getPlayer()
  variables_to_capture:
  - '%turret_world%;getLocation().getWorld().getName()'

Last updated