diff --git a/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java b/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java index 32f5ca918..3df14c674 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java @@ -342,6 +342,10 @@ public class VelocityConfiguration implements ProxyConfig { return advanced.isShowPingRequests(); } + public boolean isLogCommandExecutions() { + return advanced.isLogCommandExecutions(); + } + @Override public String toString() { return MoreObjects.toStringHelper(this) @@ -577,6 +581,7 @@ public class VelocityConfiguration implements ProxyConfig { private boolean tcpFastOpen = false; private boolean bungeePluginMessageChannel = true; private boolean showPingRequests = false; + private boolean logCommandExecutions = false; private Advanced() { } @@ -592,6 +597,7 @@ public class VelocityConfiguration implements ProxyConfig { this.tcpFastOpen = config.getOrElse("tcp-fast-open", false); this.bungeePluginMessageChannel = config.getOrElse("bungee-plugin-message-channel", true); this.showPingRequests = config.getOrElse("show-ping-requests", false); + this.logCommandExecutions = config.getOrElse("log-command-executions", false); } } @@ -631,6 +637,10 @@ public class VelocityConfiguration implements ProxyConfig { return showPingRequests; } + public boolean isLogCommandExecutions() { + return logCommandExecutions; + } + @Override public String toString() { return "Advanced{" @@ -643,6 +653,7 @@ public class VelocityConfiguration implements ProxyConfig { + ", tcpFastOpen=" + tcpFastOpen + ", bungeePluginMessageChannel=" + bungeePluginMessageChannel + ", showPingRequests=" + showPingRequests + + ", logCommandExecutions=" + logCommandExecutions + '}'; } } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java index 87b0e849b..b58ebf1be 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java @@ -130,7 +130,9 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler { .thenComposeAsync(event -> processCommandExecuteResult(originalCommand, event.getResult())) .whenCompleteAsync((ignored, throwable) -> { - logger.info("{} -> executed command /{}", player.getUsername(), originalCommand); + if (server.getConfiguration().isLogCommandExecutions()) { + logger.info("{} -> executed command /{}", player.getUsername(), originalCommand); + } }) .exceptionally(e -> { logger.info("Exception occurred while running command for {}", diff --git a/proxy/src/main/resources/default-velocity.toml b/proxy/src/main/resources/default-velocity.toml index a83ddba94..139adec76 100644 --- a/proxy/src/main/resources/default-velocity.toml +++ b/proxy/src/main/resources/default-velocity.toml @@ -117,6 +117,9 @@ bungee-plugin-message-channel = true # Shows ping requests to the proxy from clients. show-ping-requests = false +# Enables the logging of commands +log-command-executions = false + [query] # Whether to enable responding to GameSpy 4 query responses or not. enabled = false