Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-25 15:50:19 +01:00
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();
|
return advanced.isBungeePluginMessageChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isShowPingRequests() {
|
||||||
|
return advanced.isShowPingRequests();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return MoreObjects.toStringHelper(this)
|
return MoreObjects.toStringHelper(this)
|
||||||
@ -679,6 +683,10 @@ public class VelocityConfiguration extends AnnotatedConfig implements ProxyConfi
|
|||||||
@ConfigKey("bungee-plugin-message-channel")
|
@ConfigKey("bungee-plugin-message-channel")
|
||||||
private boolean bungeePluginMessageChannel = true;
|
private boolean bungeePluginMessageChannel = true;
|
||||||
|
|
||||||
|
@Comment("Shows ping requests to the proxy from clients.")
|
||||||
|
@ConfigKey("show-ping-requests")
|
||||||
|
private boolean showPingRequests = false;
|
||||||
|
|
||||||
private Advanced() {
|
private Advanced() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -692,6 +700,7 @@ public class VelocityConfiguration extends AnnotatedConfig implements ProxyConfi
|
|||||||
this.proxyProtocol = toml.getBoolean("proxy-protocol", false);
|
this.proxyProtocol = toml.getBoolean("proxy-protocol", false);
|
||||||
this.tcpFastOpen = toml.getBoolean("tcp-fast-open", false);
|
this.tcpFastOpen = toml.getBoolean("tcp-fast-open", false);
|
||||||
this.bungeePluginMessageChannel = toml.getBoolean("bungee-plugin-message-channel", true);
|
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;
|
return bungeePluginMessageChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isShowPingRequests() {
|
||||||
|
return showPingRequests;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Advanced{"
|
return "Advanced{"
|
||||||
@ -738,6 +751,7 @@ public class VelocityConfiguration extends AnnotatedConfig implements ProxyConfi
|
|||||||
+ ", proxyProtocol=" + proxyProtocol
|
+ ", proxyProtocol=" + proxyProtocol
|
||||||
+ ", tcpFastOpen=" + tcpFastOpen
|
+ ", tcpFastOpen=" + tcpFastOpen
|
||||||
+ ", bungeePluginMessageChannel=" + bungeePluginMessageChannel
|
+ ", bungeePluginMessageChannel=" + bungeePluginMessageChannel
|
||||||
|
+ ", showPingRequests=" + showPingRequests
|
||||||
+ '}';
|
+ '}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,9 +25,13 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
public class StatusSessionHandler implements MinecraftSessionHandler {
|
public class StatusSessionHandler implements MinecraftSessionHandler {
|
||||||
|
|
||||||
|
private static final Logger logger = LogManager.getLogger(StatusSessionHandler.class);
|
||||||
|
|
||||||
private final VelocityServer server;
|
private final VelocityServer server;
|
||||||
private final MinecraftConnection connection;
|
private final MinecraftConnection connection;
|
||||||
private final InboundConnection inbound;
|
private final InboundConnection inbound;
|
||||||
@ -39,6 +43,14 @@ public class StatusSessionHandler implements MinecraftSessionHandler {
|
|||||||
this.inbound = inbound;
|
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) {
|
private ServerPing constructLocalPing(ProtocolVersion version) {
|
||||||
VelocityConfiguration configuration = server.getConfiguration();
|
VelocityConfiguration configuration = server.getConfiguration();
|
||||||
return new ServerPing(
|
return new ServerPing(
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren