Updated Source Files for Version 0.3-Pre
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user