Introduce support for web chat integration.
- Replaced synchronous permission checks with asynchronous LuckPerms user loading. - Added `getOrLoadUser` utility to simplify user-related operations. - Introduced web-originated chat command processing via new `PunishmentCommandBuilder` and `PunishFromWebHandler`. - Updated `MuteServer`, `ToggleGlobalChat`, and `ToggleableForCustomChannel` to use async permission checks. - Added test suite for `PunishmentCommandBuilder`. - Expanded chat handling to process party messages from web events.
This commit is contained in:
@@ -10,6 +10,9 @@ import com.alttd.chat.objects.ChatUser;
|
||||
import com.alttd.chat.objects.chat_log.ChatLogHandler;
|
||||
import com.alttd.chat.objects.chat_log.WebHandler;
|
||||
import com.alttd.chat.util.ALogger;
|
||||
import com.alttd.chat.web.SseSubscribeClient;
|
||||
import com.alttd.velocitychat.chat_web.handlers.PunishFromWebHandler;
|
||||
import com.alttd.velocitychat.chat_web.handlers.WebPartyChatHandler;
|
||||
import com.alttd.velocitychat.commands.*;
|
||||
import com.alttd.velocitychat.handlers.ChatHandler;
|
||||
import com.alttd.velocitychat.handlers.ServerHandler;
|
||||
@@ -50,6 +53,7 @@ public class VelocityChat {
|
||||
private ServerHandler serverHandler;
|
||||
|
||||
private ChannelIdentifier channelIdentifier;
|
||||
private SseSubscribeClient sseSubscribeClient;
|
||||
|
||||
@Inject
|
||||
public VelocityChat(ProxyServer proxyServer, Logger proxyLogger, @DataDirectory Path proxydataDirectory) {
|
||||
@@ -71,7 +75,7 @@ public class VelocityChat {
|
||||
WebHandler webHandler = new WebHandler();
|
||||
|
||||
ChatLogHandler chatLogHandler = new ChatLogHandler(webHandler, true);
|
||||
chatHandler = new ChatHandler(chatLogHandler);
|
||||
chatHandler = new ChatHandler(chatLogHandler, chatAPI.getLuckPerms());
|
||||
server.getEventManager().register(this, new ChatListener());
|
||||
server.getEventManager().register(this, new ProxyPlayerListener());
|
||||
new LiteBansListener().init(); // init the litebans api listeners
|
||||
@@ -84,6 +88,18 @@ public class VelocityChat {
|
||||
ChatUser console = new ChatUser(Config.CONSOLEUUID, -1, null);
|
||||
console.setDisplayName(Config.CONSOLENAME);
|
||||
ChatUserManager.addUser(console);
|
||||
sseSubscribeClient = new SseSubscribeClient(
|
||||
Config.CHAT_WEB_REGISTER_TO_BASE_URL,
|
||||
"proxy", //TODO [Stijn] [2026-08-09]: Make configurable if needed
|
||||
Config.CHAT_WEB_TOKEN
|
||||
);
|
||||
new Thread(sseSubscribeClient).start();
|
||||
registerWebHandlers(sseSubscribeClient);
|
||||
}
|
||||
|
||||
private void registerWebHandlers(SseSubscribeClient sseSubscribeClient) {
|
||||
sseSubscribeClient.register("web_party_chat", new WebPartyChatHandler(chatHandler));
|
||||
sseSubscribeClient.register("web_punish", new PunishFromWebHandler(server));
|
||||
}
|
||||
|
||||
public void reloadConfig() {
|
||||
|
||||
Reference in New Issue
Block a user