Skip to content

Commit

Permalink
Add missing null check
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremiahwinsley committed Dec 26, 2021
1 parent f39505b commit d211c64
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/main/java/net/permutated/pylons/Pylons.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.permutated.pylons.block.AbstractPylonBlock;
import net.permutated.pylons.client.ClientSetup;
import net.permutated.pylons.item.PlayerFilterCard;
import net.permutated.pylons.util.ChunkManager;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemStackHandler;
import net.permutated.pylons.ChunkManager;
import net.permutated.pylons.util.ChunkManager;
import net.permutated.pylons.util.Constants;
import org.apache.commons.lang3.StringUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.state.BlockState;
import net.permutated.pylons.ChunkManager;
import net.permutated.pylons.util.ChunkManager;
import net.permutated.pylons.ModRegistry;
import net.permutated.pylons.item.PotionFilterCard;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.permutated.pylons;
package net.permutated.pylons.util;

import net.minecraft.core.BlockPos;
import net.minecraft.core.SectionPos;
Expand All @@ -11,6 +11,8 @@
import net.minecraftforge.event.server.ServerStoppingEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.permutated.pylons.ConfigManager;
import net.permutated.pylons.Pylons;

import java.util.Map;
import java.util.UUID;
Expand Down Expand Up @@ -45,7 +47,9 @@ public static void onLoginEvent(PlayerEvent.PlayerLoggedInEvent event) {
var server = event.getPlayer().getServer();
if (location != null && server != null) {
var level = server.getLevel(location.level);
loadChunk(uuid, level, location.blockPos);
if (level != null) {
loadChunk(uuid, level, location.blockPos);
}
}
}
}
Expand All @@ -58,7 +62,9 @@ public static void onLogoutEvent(PlayerEvent.PlayerLoggedOutEvent event) {
var server = event.getPlayer().getServer();
if (location != null && server != null) {
var level = server.getLevel(location.level);
unloadChunk(uuid, level, location.blockPos);
if (level != null) {
unloadChunk(uuid, level, location.blockPos);
}
}
}
}
Expand Down

0 comments on commit d211c64

Please sign in to comment.