From 6d0a1f6bfdb8f0a0b48ce3616790f8e4205879b7 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 4 Jun 2022 16:23:13 +0200 Subject: [PATCH] Fix geyser floodgate null Signed-off-by: Lixfel --- .../bungeecore/listeners/SubserverProtocolFixer.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/de/steamwar/bungeecore/listeners/SubserverProtocolFixer.java b/src/de/steamwar/bungeecore/listeners/SubserverProtocolFixer.java index b87c960..927d47c 100644 --- a/src/de/steamwar/bungeecore/listeners/SubserverProtocolFixer.java +++ b/src/de/steamwar/bungeecore/listeners/SubserverProtocolFixer.java @@ -49,12 +49,18 @@ public class SubserverProtocolFixer extends BasicListener { @EventHandler public void loginEvent(LoginEvent e) { InitialHandler initialHandler = ((InitialHandler) e.getConnection()); - LoginResult.Property[] properties = initialHandler.getLoginProfile().getProperties(); - try { - String extraData = "\00" + AddressUtil.sanitizeAddress(inetSocketAddress) + "\00" + UUIDUtils.undash(initialHandler.getUniqueId().toString()); + + String extraData = "\00" + AddressUtil.sanitizeAddress(inetSocketAddress) + "\00" + UUIDUtils.undash(initialHandler.getUniqueId().toString()); + + LoginResult result = initialHandler.getLoginProfile(); + if (result != null) { + LoginResult.Property[] properties = result.getProperties(); if (properties.length > 0) { extraData += "\00" + BungeeCord.getInstance().gson.toJson(properties); } + } + + try { field.set(initialHandler, extraData); } catch (IllegalAccessException ex) { BungeeCord.getInstance().getLogger().log(Level.SEVERE, ex.getMessage(), ex);