Developer API
Getting started
Project Dependency
<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
dependencies:
server:
UltraStaffChatPro:
load: BEFORE
required: true # Set to `false` if your plugin does not require UltraStaffChatPro.
join-classpath: true
Examples
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());
}
}
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?