# Examples

## ConditionalEvents example

You can detect changes in variables using my plugin [ConditionalEvents](https://www.spigotmc.org/resources/conditionalevents-custom-actions-for-certain-events-1-8-1-19.82271/), check for conditions and execute whatever action you want. Just create an event like this:

```yaml
Events:
  event:
    type: custom
    custom_event_data:
      event: svar.ajneb97.api.StringVariableChangeEvent
      player_variable: getPlayer()
      variables_to_capture:
      - '%variable_type%;getVariable().getVariableType()'
      - '%variable_name%;getVariable().getName()'
      - '%new_value%;getNewValue()'
    conditions:
    - "%variable_name% == player_gems"
    - "%new_value% <= 0"
    actions:
      default: []
```
