From 587fb37bdf3438708649c18c9271ec20bb36e74b Mon Sep 17 00:00:00 2001 From: Ivan Pekov Date: Sat, 2 Jul 2022 10:35:54 +1000 Subject: [PATCH] #3192, #3210: Handle null ServerPing#getPlayers upon a legacy ping --- .../java/net/md_5/bungee/connection/InitialHandler.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java index ce7b64d6..c5365630 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java @@ -208,14 +208,14 @@ public class InitialHandler extends PacketHandler implements PendingConnection + "\00" + 127 + '\00' + legacy.getVersion().getName() + '\00' + getFirstLine( legacy.getDescription() ) - + '\00' + legacy.getPlayers().getOnline() - + '\00' + legacy.getPlayers().getMax(); + + '\00' + ( ( legacy.getPlayers() != null ) ? legacy.getPlayers().getOnline() : "-1" ) + + '\00' + ( ( legacy.getPlayers() != null ) ? legacy.getPlayers().getMax() : "-1" ); } else { // Clients <= 1.3 don't support colored motds because the color char is used as delimiter kickMessage = ChatColor.stripColor( getFirstLine( legacy.getDescription() ) ) - + '\u00a7' + legacy.getPlayers().getOnline() - + '\u00a7' + legacy.getPlayers().getMax(); + + '\u00a7' + ( ( legacy.getPlayers() != null ) ? legacy.getPlayers().getOnline() : "-1" ) + + '\u00a7' + ( ( legacy.getPlayers() != null ) ? legacy.getPlayers().getMax() : "-1" ); } ch.close( kickMessage );