Skip to content

Commit

Permalink
Prevent crash with broken server state (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
miozune authored Dec 12, 2022
1 parent 2b27b55 commit 48bb351
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,12 @@ public static int syphonFromNetwork(ItemStack ist, int damageToBeDone) {
}

public static int syphonFromNetwork(String ownerName, int damageToBeDone) {
if (MinecraftServer.getServer() == null) {
MinecraftServer mcServer = MinecraftServer.getServer();
if (mcServer == null || mcServer.worldServers.length == 0) {
return 0;
}

World world = MinecraftServer.getServer().worldServers[0];
World world = mcServer.worldServers[0];
LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName);

if (data == null) {
Expand Down

0 comments on commit 48bb351

Please sign in to comment.