Package me.kzlyth.api.chatfreeze
package me.kzlyth.api.chatfreeze
API package for freezing and unfreezing the chat in Zenith-Mod.
This package contains the ChatFreezeAPI class, which provides
methods to freeze and unfreeze the entire server chat. When the chat is frozen, all players
(except those with the zenith.chatfreeze.bypass permission) are prevented from sending
chat messages.
Database Compatibility: All methods in this API are fully compatible with H2, SQLite, MySQL, and MariaDB databases. The API automatically adapts to the configured database type from the configuration file.
Features:
- Freeze and unfreeze the entire server chat
- Check if chat is currently frozen
- Automatic history entry creation
- Player notifications (if configured)
Important Notes:
- Freezing the chat prevents all players from sending messages (except those with bypass permission)
- All freeze/unfreeze actions are recorded in the history database (zn_history)
- Each action receives a unique case ID
- Player notifications can be sent when chat is frozen/unfrozen (configurable in chat-freeze.yml)
Example usage:
ZenithAPI api = ZenithAPI.getInstance();
if (api != null) {
ChatFreezeAPI chatFreezeAPI = api.getChatFreezeAPI();
UUID staffUuid = UUID.fromString("00000000-0000-0000-0000-000000000001");
// Freeze the chat
chatFreezeAPI.freezeChat(staffUuid, "Server announcement incoming").thenAccept(success -> {
if (success) {
getLogger().info("Chat frozen successfully");
}
});
// Check if chat is frozen
chatFreezeAPI.isChatFrozen().thenAccept(frozen -> {
if (frozen) {
getLogger().info("Chat is currently frozen");
}
});
// Unfreeze the chat
chatFreezeAPI.unfreezeChat(staffUuid, "Server announcement complete").thenAccept(success -> {
if (success) {
getLogger().info("Chat unfrozen successfully");
}
});
}
- Seit:
- 1.2.3
- Autor:
- Zenith-Studios
-
Klassen