3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +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();
}
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
+ '}';
}
}

Datei anzeigen

@ -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 {}",

Datei anzeigen

@ -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