Skip to content

Commit

Permalink
Merge pull request fr1kin#75 from VADemon/logoutspot-fix
Browse files Browse the repository at this point in the history
Fix NPE in LogoutSpot, add @nullable to getWorld
  • Loading branch information
babbaj authored Mar 4, 2019
2 parents c1d38ba + 8a16b08 commit 9fb0e0c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/java/com/matt/forgehax/Helper.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public static Entity getRidingOrPlayer() {
return getRidingEntity() != null ? getRidingEntity() : getLocalPlayer();
}

@Nullable
public static WorldClient getWorld() {
return MC.world;
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/matt/forgehax/mods/LogoutSpot.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 9fb0e0c

Please sign in to comment.