Added IGeyserPingPassthrough#getPingInformation(InetSocketAddress) to make logging of the pinging IPs possible (#1633)

Co-authored-by: qlow <info@qlow.eu>
This commit is contained in:
qlow 2020-12-07 20:04:50 +01:00 committed by GitHub
parent 798ae34cd1
commit a173005767
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 48 additions and 26 deletions

View file

@ -63,7 +63,7 @@ public class ConnectorServerEventHandler implements BedrockServerEventHandler {
GeyserPingInfo pingInfo = null;
if (config.isPassthroughMotd() || config.isPassthroughPlayerCounts()) {
IGeyserPingPassthrough pingPassthrough = connector.getBootstrap().getGeyserPingPassthrough();
pingInfo = pingPassthrough.getPingInformation();
pingInfo = pingPassthrough.getPingInformation(inetSocketAddress);
}
BedrockPong pong = new BedrockPong();

View file

@ -70,7 +70,7 @@ public class GeyserLegacyPingPassthrough implements IGeyserPingPassthrough, Runn
}
@Override
public GeyserPingInfo getPingInformation() {
public GeyserPingInfo getPingInformation(InetSocketAddress inetSocketAddress) {
return pingInfo;
}

View file

@ -27,15 +27,29 @@ package org.geysermc.connector.ping;
import org.geysermc.connector.common.ping.GeyserPingInfo;
import java.net.Inet4Address;
import java.net.InetSocketAddress;
/**
* Interface that retrieves ping passthrough information from the Java server
*/
public interface IGeyserPingPassthrough {
/**
* Get the MOTD of the server displayed on the multiplayer screen
* Get the MOTD of the server displayed on the multiplayer screen. It uses a fake remote, as the remote isn't important in this context.
*
* @return string of the MOTD
*/
GeyserPingInfo getPingInformation();
default GeyserPingInfo getPingInformation() {
return this.getPingInformation(new InetSocketAddress(Inet4Address.getLoopbackAddress(), 69));
}
/**
* Get the MOTD of the server displayed on the multiplayer screen
*
* @param inetSocketAddress the ip address of the client pinging the server
* @return string of the MOTD
*/
GeyserPingInfo getPingInformation(InetSocketAddress inetSocketAddress);
}