mirror of
https://github.com/GeyserMC/Geyser.git
synced 2025-12-27 02:39:15 +00:00
Resolve issue with querying session ping after it disconnected
This commit is contained in:
@@ -2187,6 +2187,11 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource {
|
||||
|
||||
@Override
|
||||
public int ping() {
|
||||
// Can otherwise cause issues if the player isn't logged in yet / already left
|
||||
if (getUpstream().isInitialized() || getUpstream().isClosed()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
RakSessionCodec rakSessionCodec = ((RakChildChannel) getUpstream().getSession().getPeer().getChannel()).rakPipeline().get(RakSessionCodec.class);
|
||||
return (int) Math.floor(rakSessionCodec.getPing());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user