# Plugin API

## Java Docs

Here you can view the Java Docs [here](https://javadocs.olziedev.com/playereconomy) for Player Economy which provides you all the usages and descriptions of the API.

## Maven Repository

Do you want to integrate with Player Economy in your plugin? You can use the OlzieDev repo to build against the Player Economy API.

Under `repositories` in your `pom.xml`, you need to add a new `repository` for the repo.

```java
<repositories>
    ...
    <repository>
        <id>olzie-repo</id>
        <url>https://repo.olziedev.com/</url>
    </repository>
</repositories>
```

Next, add Player Economy as a `dependency` under `dependencies`:

`VERSION_HERE` would be your exact plugin version, you will not need to update the API version every time a plugin update is out, only when an api update happens.

```java
<dependencies>
    ...
    <dependency>
        <groupId>com.olziedev</groupId>
        <artifactId>playereconomy-api</artifactId>
        <version>VERSION_HERE</version>
        <scope>provided</scope>
    </dependency>
</dependencies>
```

## How to access the API

You can access the Player Economy API by getting the instance. If the plugin hasn't fully loaded the instance will return null, you can use a callback to access the API when its ready.

```java
/* 
Accessing the instance, can return null if not loaded.

This instance can also change when a plugin reload has 
happened, so its not advisted to use this
*/ 
PlayerEconomy api = PlayerEconomy.getInstance();

PlayerEconomy.getInstance(api -> { // accessing the instance when its ready.

});
```

## Some examples

Here is an example on how to access a economy player by their UUID.

```java
PlayerEconomy.getInstance(api -> {
    EPlayer player = api.getEcoPlayer(UUID.randomUUID());
    // get their balance
    player.getBalance();    
});
```


---

# 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/playereconomy/api.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.
