3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-12-24 15:20:35 +01:00

Add logging to command executions by players (#332)

Dieser Commit ist enthalten in:
Andrew Steinborn 2020-07-20 22:03:07 -04:00
Commit ecec5e487a
3 geänderte Dateien mit 19 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -346,6 +346,10 @@ public class VelocityConfiguration implements ProxyConfig {
return advanced.isFailoverOnUnexpectedServerDisconnect();
}
public boolean isLogCommandExecutions() {
return advanced.isLogCommandExecutions();
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
@ -582,6 +586,7 @@ public class VelocityConfiguration implements ProxyConfig {
private boolean bungeePluginMessageChannel = true;
private boolean showPingRequests = false;
private boolean failoverOnUnexpectedServerDisconnect = false;
private boolean logCommandExecutions = false;
private Advanced() {
}
@ -599,6 +604,7 @@ public class VelocityConfiguration implements ProxyConfig {
this.showPingRequests = config.getOrElse("show-ping-requests", false);
this.failoverOnUnexpectedServerDisconnect = config
.getOrElse("failover-on-unexpected-server-disconnect", true);
this.logCommandExecutions = config.getOrElse("log-command-executions", false);
}
}
@ -642,6 +648,10 @@ public class VelocityConfiguration implements ProxyConfig {
return failoverOnUnexpectedServerDisconnect;
}
public boolean isLogCommandExecutions() {
return logCommandExecutions;
}
@Override
public String toString() {
return "Advanced{"
@ -655,6 +665,7 @@ public class VelocityConfiguration implements ProxyConfig {
+ ", bungeePluginMessageChannel=" + bungeePluginMessageChannel
+ ", showPingRequests=" + showPingRequests
+ ", failoverOnUnexpectedServerDisconnect=" + failoverOnUnexpectedServerDisconnect
+ ", logCommandExecutions=" + logCommandExecutions
+ '}';
}
}

Datei anzeigen

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

Datei anzeigen

@ -123,6 +123,9 @@ show-ping-requests = false
# can disable this setting to use the BungeeCord behavior.
failover-on-unexpected-server-disconnect = true
# Enables the logging of commands
log-command-executions = false
[query]
# Whether to enable responding to GameSpy 4 query responses or not.
enabled = false