# 🛠️ Developer API

Welcome to the **VortexGens API**. This API allows developers to hook into the generator system, listen for production events, and programmatically manage generator levels, owners, and custom economy providers.&#x20;

{% hint style="info" %}
You can browse our available API versions and artifacts directly in your browser at our [repositiory](https://repo.vortexdevelopment.net/#browser).
{% endhint %}

***

#### 📦 Dependency Management

To use the API, you need to add our Maven repository and the API dependency to your project.

**Maven**

Add the following to your `pom.xml`:

```xml
<repositories>
    <repository>
        <id>vortex-repo</id>
        <url>https://repo.vortexdevelopment.net/repository</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>net.vortexdevelopment</groupId>
        <artifactId>VortexGens-API</artifactId>
        <version>1.0.1</version> <!-- Or use 'latest' -->
        <scope>provided</scope>
    </dependency>
</dependencies>
```

**Gradle (Groovy)**

Add the following to your `build.gradle`:

```groovy
repositories {
    maven {
        url = uri("https://repo.vortexdevelopment.net/repository")
    }
}
dependencies {
    compileOnly 'net.vortexdevelopment:VortexGens-API:1.0.1'
}
```

***

#### 🚀 Getting Started

**Accessing the API**

The main entry point for the API is the `VortexGensAPI` class. Note that you should always check if the plugin is enabled before accessing managers, as they are initialized during the plugin load phase. All managers are statically accessible:

```java
// Accessing the Generator Manager
@NotNull GeneratorManager manager = VortexGensAPI.getGeneratorManager();
// Accessing the Economy Manager
@NotNull EconomyManager economy = VortexGensAPI.getEconomyManager();
```

***

#### 💠 API Modules

The API is split into several modules to keep things organized:

* **GeneratorManager**: Programmatically manage placed generators, retrieve generator properties (level, stack size), and track ownership data.
* **EconomyManager**: Register or retrieve economy providers used for generator upgrades.

***

#### 🔔 Events

VortexGens fires custom events that you can listen to in your own plugins:

* **GeneratorGenerateEvent**: Fired whenever a generator successfully produces an item or reward. Useful for modifying loot on the fly or tracking production stats.
* **GeneratorAccessEvent**: Fired when a player tries to interact with or open the GUI of a generator.
* **GeneratorEvent**: The base event for all generator-related actions.

```java
@EventHandler
public void onGenerate(GeneratorGenerateEvent event) {
    Generator generator = event.getGenerator();
    // Your custom logic here
}
```

***

#### 📄 Plugin.yml

If you are depending on VortexGens, don't forget to add it to your `plugin.yml` to ensure proper load order:

```yaml
depend: [VortexGens]
# OR
softdepend: [VortexGens]
```


---

# 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://wiki.vortexdevelopment.net/projects/vortexgens/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.
