Integrate ChatLogHandler across chat modules and add centralized message logging with validation through ChatLogMapper.

This commit is contained in:
2026-07-19 23:00:40 +02:00
parent 92979e9789
commit 7492dfa418
17 changed files with 418 additions and 115 deletions
@@ -2,20 +2,20 @@ package com.alttd.velocitychat;
import com.alttd.chat.ChatAPI;
import com.alttd.chat.ChatImplementation;
import com.alttd.chat.config.Config;
import com.alttd.chat.database.DatabaseConnection;
import com.alttd.chat.managers.ChatUserManager;
import com.alttd.chat.managers.PartyManager;
import com.alttd.chat.objects.ChatUser;
import com.alttd.chat.objects.chat_log.ChatLogHandler;
import com.alttd.chat.util.ALogger;
import com.alttd.velocitychat.commands.*;
import com.alttd.chat.config.Config;
import com.alttd.chat.database.DatabaseConnection;
import com.alttd.velocitychat.handlers.ChatHandler;
import com.alttd.velocitychat.handlers.ServerHandler;
import com.alttd.velocitychat.listeners.ChatListener;
import com.alttd.velocitychat.listeners.LiteBansListener;
import com.alttd.velocitychat.listeners.ProxyPlayerListener;
import com.alttd.velocitychat.listeners.PluginMessageListener;
import com.alttd.chat.util.ALogger;
import com.alttd.velocitychat.listeners.ProxyPlayerListener;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import com.google.inject.Inject;
@@ -36,7 +36,7 @@ import java.nio.file.Path;
description = "A chat plugin for Altitude Minecraft Server",
authors = {"destro174", "teri"},
dependencies = {@Dependency(id = "luckperms"), @Dependency(id = "litebans"), @Dependency(id = "proxydiscordlink")}
)
)
public class VelocityChat {
private static VelocityChat plugin;
@@ -67,7 +67,8 @@ public class VelocityChat {
PartyManager.initialize(); // load the parties from the db and add the previously loaded users to them
serverHandler = new ServerHandler();
chatHandler = new ChatHandler();
ChatLogHandler chatLogHandler = new ChatLogHandler(true);
chatHandler = new ChatHandler(chatLogHandler);
server.getEventManager().register(this, new ChatListener());
server.getEventManager().register(this, new ProxyPlayerListener());
new LiteBansListener().init(); // init the litebans api listeners
@@ -89,7 +90,11 @@ public class VelocityChat {
ByteArrayDataOutput buf = ByteStreams.newDataOutput();
buf.writeUTF("reloadconfig");
ALogger.info("Reloaded ChatPlugin proxy config.");
getProxy().getAllServers().stream().forEach(registeredServer -> registeredServer.sendPluginMessage(getChannelIdentifier(), buf.toByteArray()));
getProxy().getAllServers()
.stream()
.forEach(registeredServer -> registeredServer.sendPluginMessage(getChannelIdentifier(),
buf.toByteArray()
));
}
public File getDataDirectory() {