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();
|
return advanced.isFailoverOnUnexpectedServerDisconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isLogCommandExecutions() {
|
||||||
|
return advanced.isLogCommandExecutions();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return MoreObjects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
@ -582,6 +586,7 @@ public class VelocityConfiguration implements ProxyConfig {
|
|||||||
private boolean bungeePluginMessageChannel = true;
|
private boolean bungeePluginMessageChannel = true;
|
||||||
private boolean showPingRequests = false;
|
private boolean showPingRequests = false;
|
||||||
private boolean failoverOnUnexpectedServerDisconnect = false;
|
private boolean failoverOnUnexpectedServerDisconnect = false;
|
||||||
|
private boolean logCommandExecutions = false;
|
||||||
|
|
||||||
private Advanced() {
|
private Advanced() {
|
||||||
}
|
}
|
||||||
@ -599,6 +604,7 @@ public class VelocityConfiguration implements ProxyConfig {
|
|||||||
this.showPingRequests = config.getOrElse("show-ping-requests", false);
|
this.showPingRequests = config.getOrElse("show-ping-requests", false);
|
||||||
this.failoverOnUnexpectedServerDisconnect = config
|
this.failoverOnUnexpectedServerDisconnect = config
|
||||||
.getOrElse("failover-on-unexpected-server-disconnect", true);
|
.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;
|
return failoverOnUnexpectedServerDisconnect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isLogCommandExecutions() {
|
||||||
|
return logCommandExecutions;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Advanced{"
|
return "Advanced{"
|
||||||
@ -655,6 +665,7 @@ public class VelocityConfiguration implements ProxyConfig {
|
|||||||
+ ", bungeePluginMessageChannel=" + bungeePluginMessageChannel
|
+ ", bungeePluginMessageChannel=" + bungeePluginMessageChannel
|
||||||
+ ", showPingRequests=" + showPingRequests
|
+ ", showPingRequests=" + showPingRequests
|
||||||
+ ", failoverOnUnexpectedServerDisconnect=" + failoverOnUnexpectedServerDisconnect
|
+ ", failoverOnUnexpectedServerDisconnect=" + failoverOnUnexpectedServerDisconnect
|
||||||
|
+ ", logCommandExecutions=" + logCommandExecutions
|
||||||
+ '}';
|
+ '}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,6 +130,11 @@ public class ClientPlaySessionHandler implements MinecraftSessionHandler {
|
|||||||
server.getCommandManager().callCommandEvent(player, msg.substring(1))
|
server.getCommandManager().callCommandEvent(player, msg.substring(1))
|
||||||
.thenComposeAsync(event -> processCommandExecuteResult(originalCommand,
|
.thenComposeAsync(event -> processCommandExecuteResult(originalCommand,
|
||||||
event.getResult()))
|
event.getResult()))
|
||||||
|
.whenCompleteAsync((ignored, throwable) -> {
|
||||||
|
if (server.getConfiguration().isLogCommandExecutions()) {
|
||||||
|
logger.info("{} -> executed command /{}", player, originalCommand);
|
||||||
|
}
|
||||||
|
})
|
||||||
.exceptionally(e -> {
|
.exceptionally(e -> {
|
||||||
logger.info("Exception occurred while running command for {}",
|
logger.info("Exception occurred while running command for {}",
|
||||||
player.getUsername(), e);
|
player.getUsername(), e);
|
||||||
|
@ -123,6 +123,9 @@ show-ping-requests = false
|
|||||||
# can disable this setting to use the BungeeCord behavior.
|
# can disable this setting to use the BungeeCord behavior.
|
||||||
failover-on-unexpected-server-disconnect = true
|
failover-on-unexpected-server-disconnect = true
|
||||||
|
|
||||||
|
# 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
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren