# Developer API

## Getting started

{% hint style="info" %}
The current API version is: `2.0.0`
{% endhint %}

### Project Dependency

{% tabs %}
{% tab title="Maven" %}

<pre class="language-xml" data-title="pom.xml"><code class="lang-xml">&#x3C;repositories>
    &#x3C;repository>
    &#x3C;id>hypera-releases&#x3C;/id>
    &#x3C;url>https://repo.hypera.dev/releases/&#x3C;/url>
  &#x3C;/repository>
&#x3C;/repositories>

&#x3C;dependencies>
    &#x3C;dependency>
    &#x3C;groupId>dev.hypera&#x3C;/groupId>
    &#x3C;artifactId>UltraStaffChatPro-API&#x3C;/artifactId>
    &#x3C;version><a data-footnote-ref href="#user-content-fn-1">(version)</a>&#x3C;/version>
  &#x3C;/dependency>
&#x3C;/dependencies>
</code></pre>

{% endtab %}

{% tab title="Gradle (Kotlin)" %}

<pre class="language-kts" data-title="build.gradle.kts"><code class="lang-kts">repositories {
    maven("https://repo.hypera.dev/releases/")
}

dependencies {
    compileOnly("dev.hypera:UltraStaffChatPro-API:<a data-footnote-ref href="#user-content-fn-1">(version)</a>")
}
</code></pre>

{% endtab %}

{% tab title="Gradle (Groovy)" %}

<pre class="language-groovy" data-title="build.gradle"><code class="lang-groovy">repositories {
    maven {
        url 'https://repo.hypera.dev/releases/'
    }
}

dependencies {
    compileOnly 'dev.hypera:UltraStaffChatPro-API:<a data-footnote-ref href="#user-content-fn-1">(version)</a>'
}
</code></pre>

{% endtab %}
{% endtabs %}

### Plugin Dependency

In order to use UltraStaffChatPro's API, you must declare UltraStaffChatPro as a dependency of your plugin. This causes UltraStaffChatPro to be loaded before your plugin, making it possible for your plugin to use UltraStaffChatPro's API.

{% hint style="danger" %}
If you don't declare UltraStaffChatPro as a dependency of your plugin, errors are likely to occur when you attempt to use the API.
{% endhint %}

{% tabs %}
{% tab title="Paper" %}
Declare `UltraStaffChatPro` as a dependency in your `paper-plugin.yml` file.\
[PaperMC Documentation](https://docs.papermc.io/paper/dev/getting-started/paper-plugins#dependency-declaration)

{% code title="paper-plugin.yml" %}

```yaml
dependencies:
  server:
    UltraStaffChatPro:
      load: BEFORE
      required: true # Set to `false` if your plugin does not require UltraStaffChatPro.
      join-classpath: true
```

{% endcode %}
{% endtab %}

{% tab title="Bukkit" %}
Declare `UltraStaffChatPro` as a dependency in your `plugin.yml` file.

{% code title="plugin.yml" %}

```yaml
depend: ["UltraStaffChatPro"]
 
# If your plugin does not require UltraStaffChatPro,
# use 'softdepend' instead of 'depend':
softdepend: ["UltraStaffChatPro"]
```

{% endcode %}
{% endtab %}

{% tab title="Velocity" %}
Declare `ultrastaffchatpro` as a dependency in your `@Plugin` annotation.\
[Velocity documentation](https://docs.papermc.io/velocity/dev/dependency-management)

```java
@Plugin(
  id = "myplugin",
  name = "My Plugin",
  version = "0.1.0",
  dependencies = {
    // Add `optional = true` if your plugin does not require UltraStaffChatPro.
    @Dependency(id = "ultrastaffchatpro")
  }
)
```

{% endtab %}

{% tab title="BungeeCord" %}
Declare `UltraStaffChatPro` as a dependency in your `bungee.yml` (or `plugin.yml`) file.

{% code title="bungee.yml" %}

```yaml
depends: ["UltraStaffChatPro"]
 
# If your plugin does not require UltraStaffChatPro, use 'softDepends' instead of 'depends':
softDepends: ["UltraStaffChatPro"]
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Examples

{% code title="MyPlugin.java" %}

```java
public final class MyPlugin extends JavaPlugin {
 
    @Override
    public void onEnable() {
        // Register your plugin with UltraStaffChatPro's API.
        APIPlugin plugin = UltraStaffChatProAPI.getInstance()
            .registerPlugin("MyPlugin", "0.1.0-SNAPSHOT", "Me, Myself and I");
 
        // Register an event listener
        UltraStaffChatProAPI.getInstance().registerListener(plugin, new MyListener());
    }
 
}
```

{% endcode %}

{% code title="MyListener.java" %}

```java
public final class MyListener implements UltraStaffChatProListener {
 
    @USCPEventHandler
    public void onMessage(UltraStaffChatProMessageEvent event) {
        // Do something with the message...
    }
 
    @USCPEventHandler
	public void onJoinMessage(UltraStaffChatProJoinMessageEvent event) {
		if (event.getUser().getName().equalsIgnoreCase("Steve")) {
			event.setCancelled(true);
		}
	}
 
}
```

{% endcode %}

```java
// Send a message
UltraStaffChatProAPI.getInstance().getMessageManager()
    .sendMessage(MessageBuilder.create(
        UserBuilder.create("Steve", UUID.randomUUID()).build(),
        "Hi, my name is Steve."
    ).build());
 
// Toggle global mute in StaffChat
UltraStaffChatProAPI.getInstance().getStateManager().toggleGlobalMute(null);
```

[^1]: Replace with the version you wish to use.


---

# 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.hypera.dev/products/ultrastaffchatpro/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.
