Simply pingpassthrough logic, add fabric ping passthrough (#3930)

* Check if PingPassthrough is null
* Remove QueryPacketHandler
* Fabric ping passthrough
This commit is contained in:
Konicai 2023-11-13 18:17:40 -05:00 committed by GitHub
parent 13339f1ed1
commit bb6a1ec40a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 160 additions and 394 deletions

View file

@ -40,7 +40,6 @@ import org.geysermc.geyser.ping.IGeyserPingPassthrough;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.Arrays;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@ -61,16 +60,11 @@ public class GeyserBungeePingPassthrough implements IGeyserPingPassthrough, List
}));
ProxyPingEvent event = future.join();
ServerPing response = event.getResponse();
GeyserPingInfo geyserPingInfo = new GeyserPingInfo(
return new GeyserPingInfo(
response.getDescriptionComponent().toLegacyText(),
new GeyserPingInfo.Players(response.getPlayers().getMax(), response.getPlayers().getOnline()),
new GeyserPingInfo.Version(response.getVersion().getName(), response.getVersion().getProtocol())
response.getPlayers().getMax(),
response.getPlayers().getOnline()
);
if (event.getResponse().getPlayers().getSample() != null) {
Arrays.stream(event.getResponse().getPlayers().getSample()).forEach(proxiedPlayer ->
geyserPingInfo.getPlayerList().add(proxiedPlayer.getName()));
}
return geyserPingInfo;
}
// This is static so pending connection can use it