# Warp Addon

In Player Warps you can create a warp addon that will essentially decide if a player can set a warp in a specific location or create a warp on a certain event.

## Registering

You can go [here](/projects/playerwarps/api/expansions.md#registering-expansions) to learn on how to register an expansion.

## Examples

Here is an example of a warp addon class, this will let you be able to decide if a player can set a warp at that specific location or not. You may also add events and what no as well in this as well.

```java
import com.olziedev.playerwarps.api.expansion.WAddon;
import org.bukkit.entity.Player;

public class ExampleWarpExpansion extends WAddon {

    @Override
    public boolean isEnabled() {
        return true;
    }

    @Override
    public String getName() {
        return "Example Expansion";
    }

    @Override
    public void onLoad() {

    }

    @Override
    public Runnable isAuthorized(Player player) {
        if (player.getLocation().getY() < 5) {
            return () -> player.sendMessage("You are not authorized to use this command!");
        }
        return null;
    }
}
```

When using the isAuthorized method, you can return null if you want them to be able to set a warp at that location.

If you do not want them to set a warp, you can return a runnable interface and whatever is in that code will be executed. If you're wondering why its a runnable, its so then the plugin will not execute every single addons' runnable at once when setting a warp.


---

# 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.olziedev.com/projects/playerwarps/api/expansions/warp.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.
