# Developer API

Creating a custom economy provider is a fairly straight forward process. First of all, ensure you have the API dependency loaded into your project and set it as a depend in your plugin.yml file.

***

To being with we need to create a class and have it extend `EconomyProvider` some IDEs will then prompt you to add the missing values. In this example we will call our class `CustomEconomy`

```java
public class CustomEconomy extends EconomyProvider {
}

```

***

After that is finished if your IDE does not prompt you to add in the missing values you must do so manually here you can find how they should look.

```java
public class CustomEconomy extends EconomyProvider {

    public CustomEconomy(String identifier) {
        super("CUSTOM_ECONOMY");
    }

    @Override
    public void onEnable() {

    }

    @Override
    public double getBalance(OfflinePlayer player) {
        return 0;
    }

    @Override
    public void withdraw(OfflinePlayer player, double amount) {

    }

    @Override
    public void deposit(OfflinePlayer player, double amount) {

    }
}
```

Now all you must do is update each method with the relevant code to work with your plugin. It is recommended to define the API in the `onEnable` method. Below we will provide an example using the TokenManager plugin

```java
    @Override
    public void onEnable() {
        tokenManager = (TokenManager) Bukkit.getServer().getPluginManager().getPlugin("TokenManager");
    }

```

***

Now all we must do is register the objective an example of this can be seen below.

```java
// Accessing the API
DeluxeCoinflipAPI api = (DeluxeCoinflipAPI) Bukkit.getPluginManager().getPlugin("DeluxeCoinflip");

// Register the custom economy. 
// Be sure to replace YOUR_PLUGIN with the name of your plugin for it to be registered correctly.
api.registerEconomyProvider(new CustomProvider, "YOUR_PLUGIN");
```

{% hint style="danger" %}
Make sure DeluxeCoinflip has been added as a depend in your `plugin.yml` to ensure it loads correctly.
{% endhint %}


---

# 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.zithium.net/other-plugins/deluxecoinflip/developer-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.
