Custom Moderation Enforcement¶
Verité normally enforces mutes, slowmode, and chat freezes automatically. However, some chat plugins intercept Minecraft's normal chat event and handle message delivery themselves.
If your plugin does this, Verité may never see the message, so its own mute and slowmode checks never run. In that case, you should ask Verité about the sender before your plugin sends the message, and stop the message yourself when Verité says to.
You only need this guide if your plugin handles or replaces normal Minecraft chat. Servers using standard chat do not need any additional setup.
This is the moderation counterpart to the Custom Chat Integration guide. The filter guide screens message content; this guide enforces mutes, slowmode, and chat freezes.
Java Integration¶
The moderation surface lives in teacommontea.api.VeriteModeration. Every method returns a safe value when the moderation module is disabled, so a caller never has to special-case that.
1. Add Verité as a soft dependency¶
Add Verité to your plugin.yml:
Using a soft dependency ensures Verité loads before your integration when installed, without making it mandatory for your plugin to start.
2. Check whether the API is available¶
If Verité is optional, check for the API before using it:
private static final boolean VERITE_AVAILABLE;
static {
boolean available;
try {
Class.forName("teacommontea.api.VeriteModeration");
available = true;
} catch (ClassNotFoundException ignored) {
available = false;
}
VERITE_AVAILABLE = available;
}
Your integration can then simply do nothing when Verité isn't installed.
3. Enforce mutes¶
Before your custom chat system sends a message, ask Verité whether the sender is muted:
muteGate returns true when the player is muted, and as it does so it sends them the mute notice for you. When it returns true, stop the message.
If you would rather build the notice yourself, read the active mute instead:
if (VeriteModeration.isMuted(player.getUniqueId())) {
Punishment mute = VeriteModeration.activeMute(player.getUniqueId());
String line = mute.permanent()
? "You are muted."
: "You are muted for " + mute.remaining(System.currentTimeMillis()) + " more milliseconds.";
player.sendMessage(line);
return;
}
isMuted is a pure check and sends nothing. activeMute returns the mute as a Punishment, from which you can read reason(), permanent(), and remaining(now).
4. Enforce slowmode and chat freeze¶
Verité has two server-wide chat brakes: a global chat freeze set by staff, and per-player slowmode. Gate both the same way you gate mutes:
if (VeriteModeration.chatMuteGate(player)) {
return;
}
if (VeriteModeration.slowmodeGate(player)) {
return;
}
Each returns true when the player should be stopped, and sends them the reason (the chat-frozen notice or the remaining slowmode wait) as it does so. Check both before sending.
Putting it together¶
A complete chat handler that reproduces Verité's enforcement looks like this:
if (VERITE_AVAILABLE) {
if (VeriteModeration.muteGate(player)) {
return;
}
if (VeriteModeration.chatMuteGate(player)) {
return;
}
if (VeriteModeration.slowmodeGate(player)) {
return;
}
}
sendMessage(player, message);
Reacting to Punishments¶
If your plugin needs to know when a punishment is issued or lifted (for logging, notifications, or syncing another system), register a listener:
VeriteModeration.registerListener(new ModerationListener() {
@Override
public void entryAdded(Punishment punishment) {
}
@Override
public void entryRemoved(Punishment punishment) {
}
});
entryAdded fires when a punishment is issued, entryRemoved when one is lifted. Each Punishment carries the target, type, reason, duration, executor, and whether it was silent. Call unregisterListener with the same listener to stop receiving events.
Server Lockdown¶
Verité can seal the server behind a lockdown. Your plugin can read the lockdown state or drive it through teacommontea.api.VeriteLockdown:
if (VeriteLockdown.active()) {
String reason = VeriteLockdown.reason();
}
VeriteLockdown.begin("Maintenance");
VeriteLockdown.end();
active() reports whether a lockdown is in effect, reason() returns the current reason, begin(reason) starts one, and end() clears it. Use active() to gate your own behaviour during a lockdown, or begin and end to drive lockdown from your own commands.
Using Verité with Skript¶
If your custom chat system is written in Skript, you don't need to interact with the Java API.
With Verité and Skript installed, Verité's moderation syntax is available automatically.
Enforcing Mutes, Slowmode, and Freeze¶
If your script already handles sending chat messages itself, check the sender before sending. Use these inside your chat event:
chat is frozen reports the global chat freeze, and player is on slowmode reports the per-player slowmode cooldown. Both send the player the reason as a side effect, so use them where you intend to enforce, not merely to read state.
To check a player's personal mute:
player is muted reads the active-mute state without sending anything, so pair it with your own notice.
Controlling Lockdown¶
You can start or lift a server lockdown from a script:
The reason is optional; omitting it uses a generic label.
Skript Syntax Reference¶
player is muted
player is not muted
chat is frozen [for %-player%]
player is rate limited
player is on slowmode
begin message lockdown [(with reason|for) %-string%]
end message lockdown
chat is frozen, is rate limited, and is on slowmode send the player a notice when they match, so use them in a chat handler where you intend to stop the message.
API Reference¶
The public API is located under:
The primary classes for moderation enforcement are:
Useful methods include:
VeriteModeration.muteGate(Player player)
VeriteModeration.chatMuteGate(Player player)
VeriteModeration.slowmodeGate(Player player)
VeriteModeration.isMuted(UUID player)
VeriteModeration.activeMute(UUID player)
VeriteModeration.registerListener(ModerationListener listener)
VeriteModeration.unregisterListener(ModerationListener listener)
VeriteLockdown.active()
VeriteLockdown.reason()
VeriteLockdown.begin(String reason)
VeriteLockdown.end()
The gate methods (muteGate, chatMuteGate, slowmodeGate) both decide whether to stop the player and send them the reason. The query methods (isMuted, activeMute) only read state and send nothing.
For most custom chat integrations, enforcing the three gates in order is all you need:
if (VeriteModeration.muteGate(player)
|| VeriteModeration.chatMuteGate(player)
|| VeriteModeration.slowmodeGate(player)) {
return;
}
Verité handles the rest.