3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 13:30:17 +01:00

Make the logging of commands configurable

Dieser Commit ist enthalten in:
Tim 2020-07-19 21:49:12 +02:00
Ursprung a9df92d308
Commit da92d83b14
3 geänderte Dateien mit 17 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -342,6 +342,10 @@ public class VelocityConfiguration implements ProxyConfig {
return advanced.isShowPingRequests(); return advanced.isShowPingRequests();
} }
public boolean isLogCommandExecutions() {
return advanced.isLogCommandExecutions();
}
@Override @Override
public String toString() { public String toString() {
return MoreObjects.toStringHelper(this) return MoreObjects.toStringHelper(this)
@ -577,6 +581,7 @@ public class VelocityConfiguration implements ProxyConfig {
private boolean tcpFastOpen = false; private boolean tcpFastOpen = false;
private boolean bungeePluginMessageChannel = true; private boolean bungeePluginMessageChannel = true;
private boolean showPingRequests = false; private boolean showPingRequests = false;
private boolean logCommandExecutions = false;
private Advanced() { private Advanced() {
} }
@ -592,6 +597,7 @@ public class VelocityConfiguration implements ProxyConfig {
this.tcpFastOpen = config.getOrElse("tcp-fast-open", false); this.tcpFastOpen = config.getOrElse("tcp-fast-open", false);
this.bungeePluginMessageChannel = config.getOrElse("bungee-plugin-message-channel", true); this.bungeePluginMessageChannel = config.getOrElse("bungee-plugin-message-channel", true);
this.showPingRequests = config.getOrElse("show-ping-requests", false); 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; return showPingRequests;
} }
public boolean isLogCommandExecutions() {
return logCommandExecutions;
}
@Override @Override
public String toString() { public String toString() {
return "Advanced{" return "Advanced{"
@ -643,6 +653,7 @@ public class VelocityConfiguration implements ProxyConfig {
+ ", tcpFastOpen=" + tcpFastOpen + ", tcpFastOpen=" + tcpFastOpen
+ ", bungeePluginMessageChannel=" + bungeePluginMessageChannel + ", bungeePluginMessageChannel=" + bungeePluginMessageChannel
+ ", showPingRequests=" + showPingRequests + ", showPingRequests=" + showPingRequests
+ ", logCommandExecutions=" + logCommandExecutions
+ '}'; + '}';
} }
} }

Datei anzeigen

@ -130,7 +130,9 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
.thenComposeAsync(event -> processCommandExecuteResult(originalCommand, .thenComposeAsync(event -> processCommandExecuteResult(originalCommand,
event.getResult())) event.getResult()))
.whenCompleteAsync((ignored, throwable) -> { .whenCompleteAsync((ignored, throwable) -> {
logger.info("{} -> executed command /{}", player.getUsername(), originalCommand); if (server.getConfiguration().isLogCommandExecutions()) {
logger.info("{} -> executed command /{}", player.getUsername(), originalCommand);
}
}) })
.exceptionally(e -> { .exceptionally(e -> {
logger.info("Exception occurred while running command for {}", logger.info("Exception occurred while running command for {}",

Datei anzeigen

@ -117,6 +117,9 @@ bungee-plugin-message-channel = true
# Shows ping requests to the proxy from clients. # Shows ping requests to the proxy from clients.
show-ping-requests = false show-ping-requests = false
# Enables the logging of commands
log-command-executions = false
[query] [query]
# Whether to enable responding to GameSpy 4 query responses or not. # Whether to enable responding to GameSpy 4 query responses or not.
enabled = false enabled = false