From c3eaee6267c53c15603996e7e38532a04ee3245e Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 22 Nov 2021 16:32:17 -0500 Subject: [PATCH] Legacy API: return null if player is null --- .../org/geysermc/connector/GeyserConnector.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/geysermc/connector/GeyserConnector.java b/core/src/main/java/org/geysermc/connector/GeyserConnector.java index 8a1103834..0ecc40c7e 100644 --- a/core/src/main/java/org/geysermc/connector/GeyserConnector.java +++ b/core/src/main/java/org/geysermc/connector/GeyserConnector.java @@ -73,11 +73,21 @@ public class GeyserConnector { } public GeyserSession getPlayerByXuid(String xuid) { - return new GeyserSession(GeyserImpl.getInstance().connectionByXuid(xuid)); + org.geysermc.geyser.session.GeyserSession session = GeyserImpl.getInstance().connectionByXuid(xuid); + if (session != null) { + return new GeyserSession(session); + } else { + return null; + } } public GeyserSession getPlayerByUuid(UUID uuid) { - return new GeyserSession(GeyserImpl.getInstance().connectionByUuid(uuid)); + org.geysermc.geyser.session.GeyserSession session = GeyserImpl.getInstance().connectionByUuid(uuid); + if (session != null) { + return new GeyserSession(session); + } else { + return null; + } } public boolean isProductionEnvironment() {