Developer API

Add the API to your project

The current API version is: 2.0.0
Maven
Gradle (Groovy)
Gradle (Kotlin)
pom.xml
1
<repositories>
2
<repository>
3
<id>hypera-releases</id>
4
<url>https://repo.hypera.dev/releases/</url>
5
</repository>
6
</repositories>
7
8
<dependencies>
9
<dependency>
10
<groupId>dev.hypera</groupId>
11
<artifactId>UltraStaffChatPro-API</artifactId>
12
<version>[VERSION]</version>
13
</dependency>
14
</dependencies>
Copied!
build.gradle
1
repositories {
2
maven {
3
url 'https://repo.hypera.dev/releases/'
4
}
5
}
6
7
dependencies {
8
compileOnly 'dev.hypera:UltraStaffChatPro-API:[VERSION]'
9
}
Copied!
build.gradle.kts
1
repositories {
2
maven("https://repo.hypera.dev/releases/")
3
}
4
5
dependencies {
6
compileOnly("dev.hypera:UltraStaffChatPro-API:[VERSION]")
7
}
Copied!

Using the API

Make sure to add UltraStaffChatPro as a dependency in your plugin.yml file.
Note: The velocity plugin id is ultrastaffchatpro.
1
public class MyPlugin extends JavaPlugin {
2
3
@Override
4
public void onEnable() {
5
// Register the plugin
6
APIPlugin plugin = UltraStaffChatProAPI.getInstance()
7
.registerPlugin("MyPlugin", "0.1.0-SNAPSHOT", "Me, Myself and I");
8
9
// Register a listener
10
UltraStaffChatProAPI.getInstance().registerListener(plugin, new MyListener());
11
}
12
13
}
Copied!
1
public class MyListener implements UltraStaffChatProListener {
2
3
@USCPEventHandler
4
public void onMessage(UltraStaffChatProMessageEvent event) {
5
// Do something with the message
6
}
7
8
@USCPEventHandler
9
public void onJoinMessage(UltraStaffChatProJoinMessageEvent event) {
10
if (event.getUser().getName().equalsIgnoreCase("Steve")) {
11
event.setCancelled(true);
12
}
13
}
14
Copied!
1
// Send a message
2
UltraStaffChatProAPI.getInstance().getMessageManager().sendMessage(MessageBuilder.create(UserBuilder.create("Steve", UUID.randomUUID()).build(), "Hi, my name is Steve.").build());
3
4
// Toggle global mute in StaffChat
5
UltraStaffChatProAPI.getInstance().getStateManager().toggleGlobalMute(null);
Copied!