From c6981f7838c6151d27eb6ff53bd7362e3a634c72 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Thu, 27 Sep 2018 14:50:08 -0500 Subject: [PATCH] Added console auditing --- src/main/java/xyz/etztech/qol/QoL.java | 1 + .../qol/listeners/CommandPreprocessListener.java | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/main/java/xyz/etztech/qol/QoL.java b/src/main/java/xyz/etztech/qol/QoL.java index 3b4cd21..ee59d38 100644 --- a/src/main/java/xyz/etztech/qol/QoL.java +++ b/src/main/java/xyz/etztech/qol/QoL.java @@ -19,6 +19,7 @@ import java.util.logging.Logger; @MavenLibrary(group = "net.ess3", artifact = "Essentials", version = "2.13.1", repository = "http://repo.ess3.net/content/groups/essentials") @MavenLibrary(group = "us.dynmap", artifact = "dynmap-api", version = "1.9.4", repository = "http://repo.mikeprimm.com/") @MavenLibrary(group = "commons-lang", artifact = "commons-lang", version = "2.6") + public class QoL extends MavenPlugin { private static QoL instance; diff --git a/src/main/java/xyz/etztech/qol/listeners/CommandPreprocessListener.java b/src/main/java/xyz/etztech/qol/listeners/CommandPreprocessListener.java index 61345f5..58bb7ab 100644 --- a/src/main/java/xyz/etztech/qol/listeners/CommandPreprocessListener.java +++ b/src/main/java/xyz/etztech/qol/listeners/CommandPreprocessListener.java @@ -9,6 +9,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.server.ServerCommandEvent; import xyz.etztech.core.CoreUtils; import xyz.etztech.core.web.CoreWeb; import xyz.etztech.qol.QoL; @@ -30,6 +31,18 @@ public class CommandPreprocessListener implements Listener { this.plugin = plugin; } + @EventHandler + public void onServerCommandEvent(ServerCommandEvent event) { + if (plugin.getConfig().getBoolean("audit.enabled")) { + String command = event.getCommand(); + + if (commandIsAuditable(command)) { + sendAuditWebhook("Console", null, command); + return; + } + } + } + @EventHandler public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {