# 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()
            );
        }
    }
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.eliteminecraftplugins.com/eliteenchantments/general-information/developer-api/creating-conditions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
