fix: bungeecord server switching crash

This commit is contained in:
əlemi 2023-03-15 10:51:40 +01:00
parent 288c6c5d3f
commit 58af56f317
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -127,9 +127,12 @@ public class InfoDisplay extends HudModule {
if (MC.player != null) {
this.instant_speed = this.last_position.distanceTo(MC.player.position());
this.last_position = MC.player.position();
this.instant_ping = MC.getConnection().getPlayerInfo(
NetworkPlayerInfo info = MC.getConnection().getPlayerInfo(
MC.player.getGameProfile().getId()
).getLatency();
);
if (info != null) { // bungeecord switching makes this null for a second
this.instant_ping = info.getLatency();
}
} else {
this.instant_speed = 0.0;
this.instant_ping = 0;