Developer API

Getting started

The current API version is: 2.0.0

Project Dependency

pom.xml
<repositories>
    <repository>
    <id>hypera-releases</id>
    <url>https://repo.hypera.dev/releases/</url>
  </repository>
</repositories>

<dependencies>
    <dependency>
    <groupId>dev.hypera</groupId>
    <artifactId>UltraStaffChatPro-API</artifactId>
    <version></version>
  </dependency>
</dependencies>

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.

If you don't declare UltraStaffChatPro as a dependency of your plugin, errors are likely to occur when you attempt to use the API.

Declare UltraStaffChatPro as a dependency in your paper-plugin.yml file. PaperMC Documentation

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

Examples

MyPlugin.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());
    }
 
}
MyListener.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);
		}
	}
 
}
// 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);

Last updated

Was this helpful?