Updated Source Files for Version 0.3-Pre

This commit is contained in:
2025-06-07 11:22:22 -07:00
parent 5e5ac05b72
commit 6510c4bf8c
15 changed files with 495 additions and 105 deletions

View File

@@ -2,8 +2,10 @@ package com.adzel.velocitybroadcast;
import java.util.List;
import com.adzel.velocitybroadcast.util.DatabaseManager;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.command.SimpleCommand;
import com.velocitypowered.api.proxy.Player;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
@@ -11,9 +13,11 @@ import net.kyori.adventure.text.minimessage.MiniMessage;
public class BroadcastCommand implements SimpleCommand {
private final VelocityBroadcast plugin;
private final DatabaseManager databaseManager;
public BroadcastCommand(VelocityBroadcast plugin) {
this.plugin = plugin;
this.databaseManager = plugin.getDatabaseManager();
}
@Override
@@ -42,5 +46,13 @@ public class BroadcastCommand implements SimpleCommand {
if (plugin.getConfigHandler().isDebugEnabled()) {
plugin.getLogger().info("[Broadcast] Sent: " + fullMessage);
}
// ✅ Log to the database
String sender = (source instanceof Player)
? ((Player) source).getUsername()
: "Console";
String sourceServer = plugin.getServer().getBoundAddress().toString(); // optional
databaseManager.logBroadcast(sender, messageRaw, sourceServer);
}
}