fix: bungeecord server switching crash
This commit is contained in:
parent
288c6c5d3f
commit
58af56f317
1 changed files with 5 additions and 2 deletions
|
@ -127,9 +127,12 @@ public class InfoDisplay extends HudModule {
|
||||||
if (MC.player != null) {
|
if (MC.player != null) {
|
||||||
this.instant_speed = this.last_position.distanceTo(MC.player.position());
|
this.instant_speed = this.last_position.distanceTo(MC.player.position());
|
||||||
this.last_position = MC.player.position();
|
this.last_position = MC.player.position();
|
||||||
this.instant_ping = MC.getConnection().getPlayerInfo(
|
NetworkPlayerInfo info = MC.getConnection().getPlayerInfo(
|
||||||
MC.player.getGameProfile().getId()
|
MC.player.getGameProfile().getId()
|
||||||
).getLatency();
|
);
|
||||||
|
if (info != null) { // bungeecord switching makes this null for a second
|
||||||
|
this.instant_ping = info.getLatency();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.instant_speed = 0.0;
|
this.instant_speed = 0.0;
|
||||||
this.instant_ping = 0;
|
this.instant_ping = 0;
|
||||||
|
|
Loading…
Reference in a new issue