diff options
author | alemi <me@alemi.dev> | 2023-03-15 10:51:40 +0100 |
---|---|---|
committer | alemi <me@alemi.dev> | 2023-03-15 10:51:40 +0100 |
commit | 58af56f3171d6b937852fe2fd62294b48b58043b (patch) | |
tree | 6325d92999bd0a6485d39a509f389ffb3abc17ea /src/main/java/ftbsc | |
parent | 288c6c5d3f00cd47ad315b78361913904f678dff (diff) |
fix: bungeecord server switching crash
Diffstat (limited to 'src/main/java/ftbsc')
-rw-r--r-- | src/main/java/ftbsc/bscv/modules/hud/InfoDisplay.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/java/ftbsc/bscv/modules/hud/InfoDisplay.java b/src/main/java/ftbsc/bscv/modules/hud/InfoDisplay.java index df48b3f..2df6b10 100644 --- a/src/main/java/ftbsc/bscv/modules/hud/InfoDisplay.java +++ b/src/main/java/ftbsc/bscv/modules/hud/InfoDisplay.java @@ -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; |