geforkt von Mirrors/Velocity
Allow showing ping requests in the console.
The default is false, but this can be enabled in the configuration if desired.
Dieser Commit ist enthalten in:
Ursprung
1fe01596d2
Commit
24cd1f4da0
@ -423,6 +423,10 @@ public class VelocityConfiguration extends AnnotatedConfig implements ProxyConfi
|
||||
return advanced.isBungeePluginMessageChannel();
|
||||
}
|
||||
|
||||
public boolean isShowPingRequests() {
|
||||
return advanced.isShowPingRequests();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return MoreObjects.toStringHelper(this)
|
||||
@ -679,6 +683,10 @@ public class VelocityConfiguration extends AnnotatedConfig implements ProxyConfi
|
||||
@ConfigKey("bungee-plugin-message-channel")
|
||||
private boolean bungeePluginMessageChannel = true;
|
||||
|
||||
@Comment("Shows ping requests to the proxy from clients.")
|
||||
@ConfigKey("show-ping-requests")
|
||||
private boolean showPingRequests = false;
|
||||
|
||||
private Advanced() {
|
||||
}
|
||||
|
||||
@ -692,6 +700,7 @@ public class VelocityConfiguration extends AnnotatedConfig implements ProxyConfi
|
||||
this.proxyProtocol = toml.getBoolean("proxy-protocol", false);
|
||||
this.tcpFastOpen = toml.getBoolean("tcp-fast-open", false);
|
||||
this.bungeePluginMessageChannel = toml.getBoolean("bungee-plugin-message-channel", true);
|
||||
this.showPingRequests = toml.getBoolean("show-ping-requests", false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -727,6 +736,10 @@ public class VelocityConfiguration extends AnnotatedConfig implements ProxyConfi
|
||||
return bungeePluginMessageChannel;
|
||||
}
|
||||
|
||||
public boolean isShowPingRequests() {
|
||||
return showPingRequests;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Advanced{"
|
||||
@ -738,6 +751,7 @@ public class VelocityConfiguration extends AnnotatedConfig implements ProxyConfi
|
||||
+ ", proxyProtocol=" + proxyProtocol
|
||||
+ ", tcpFastOpen=" + tcpFastOpen
|
||||
+ ", bungeePluginMessageChannel=" + bungeePluginMessageChannel
|
||||
+ ", showPingRequests=" + showPingRequests
|
||||
+ '}';
|
||||
}
|
||||
}
|
||||
|
@ -25,9 +25,13 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
public class StatusSessionHandler implements MinecraftSessionHandler {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(StatusSessionHandler.class);
|
||||
|
||||
private final VelocityServer server;
|
||||
private final MinecraftConnection connection;
|
||||
private final InboundConnection inbound;
|
||||
@ -39,6 +43,14 @@ public class StatusSessionHandler implements MinecraftSessionHandler {
|
||||
this.inbound = inbound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void activated() {
|
||||
if (server.getConfiguration().isShowPingRequests()) {
|
||||
logger.info("{} is pinging the server with version {}", this.inbound,
|
||||
this.connection.getProtocolVersion());
|
||||
}
|
||||
}
|
||||
|
||||
private ServerPing constructLocalPing(ProtocolVersion version) {
|
||||
VelocityConfiguration configuration = server.getConfiguration();
|
||||
return new ServerPing(
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren