> For the complete documentation index, see [llms.txt](https://docs.eliteminecraftplugins.com/eliteenchantments/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eliteminecraftplugins.com/eliteenchantments/general-information/developer-api/creating-conditions.md).

# Creating Conditions

You are able to create your own conditions by creating the following:

The following condition will check if the player is gliding

```java
public class ConditionExample extends Condition {
    public ConditionExample(String identifier) {
        super(identifier, "isExample", 1, false);
    }

    @Override
    public boolean parseCondition(String[] args, LivingEntity player, @Nullable LivingEntity target) {
        return player.isGliding();
    }
}
```

Here is an example of using an event within your condition

```java
public class ConditionBlock extends Condition {
    public ConditionBlock() {
        super("isBlock", "isBlock [BLOCK-TYPE]", 2, true);
    }

    @Override
    public boolean parseCondition(String[] args, LivingEntity player, @Nullable LivingEntity target, Event event) {
        if (!(event instanceof BlockBreakEvent)) return false;

        BlockBreakEvent blockBreakEvent = (BlockBreakEvent) event;
        String block = args[1].trim();

        return blockBreakEvent.getBlock().getType().toString().equalsIgnoreCase(block);
    }
}
```

#### Registering the condition

You will then need to add the following to your onEnable (Preferably with a delay)\
You can register multiple conditions by separating them with a comma as shown below

```java
    @Override
    public void onEnable() {
        if (getServer().getPluginManager().isPluginEnabled("EliteEnchantments")) {
            EliteEnchantmentsAPI.getAPI().registerConditions(
                new ConditionExample(), 
                new ConditionBlock()
            );
        }
    }
```
