From 8a16b0828ca65ccfb8d408f6fd68c409b4ef6899 Mon Sep 17 00:00:00 2001 From: VADemon Date: Mon, 4 Mar 2019 15:42:01 +0100 Subject: [PATCH] Fix NPE in LogoutSpot, add @Nullable to getWorld --- src/main/java/com/matt/forgehax/Helper.java | 1 + src/main/java/com/matt/forgehax/mods/LogoutSpot.java | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/main/java/com/matt/forgehax/Helper.java b/src/main/java/com/matt/forgehax/Helper.java index fd92d6c2b..20a2c6543 100644 --- a/src/main/java/com/matt/forgehax/Helper.java +++ b/src/main/java/com/matt/forgehax/Helper.java @@ -66,6 +66,7 @@ public static Entity getRidingOrPlayer() { return getRidingEntity() != null ? getRidingEntity() : getLocalPlayer(); } + @Nullable public static WorldClient getWorld() { return MC.world; } diff --git a/src/main/java/com/matt/forgehax/mods/LogoutSpot.java b/src/main/java/com/matt/forgehax/mods/LogoutSpot.java index 9a4de5488..0c5637e63 100644 --- a/src/main/java/com/matt/forgehax/mods/LogoutSpot.java +++ b/src/main/java/com/matt/forgehax/mods/LogoutSpot.java @@ -98,6 +98,8 @@ public void onPlayerConnect(PlayerConnectEvent.Join event) { @SubscribeEvent public void onPlayerDisconnect(PlayerConnectEvent.Leave event) { + if (getWorld() == null) return; + EntityPlayer player = getWorld().getPlayerEntityByUUID(event.getPlayerInfo().getId()); if (player != null && getLocalPlayer() != null && !getLocalPlayer().equals(player)) { AxisAlignedBB bb = player.getEntityBoundingBox();