geforkt von Mirrors/Velocity
Add logging to command executions by players (#332)
Dieser Commit ist enthalten in:
Commit
ecec5e487a
@ -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
|
||||
+ '}';
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren