Skip to content

Commit

Permalink
Merge pull request #390 from BentoBoxWorld/389_jets_minions_bug
Browse files Browse the repository at this point in the history
Fix for null players, i.e., minions at end of phase.
  • Loading branch information
tastybento authored May 2, 2024
2 parents a0a69b6 + 5be4eb8 commit 3c96738
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ protected boolean phaseRequirementsFail(@Nullable Player player, @NonNull Island
return false;
}

if (player == null) {
// Minions cannot fulfill requirements
return true;
}
return phase.getRequirements().stream()
.anyMatch(r -> checkRequirement(r, User.getInstance(player), i, is, world));
}
Expand Down Expand Up @@ -206,7 +210,8 @@ List<String> replacePlaceholders(@Nullable Player player, @NonNull String phaseN
.map(l -> ((Level) l).getIslandLevel(addon.getOverWorld(), i.getOwner())).orElse(0L);
double balance = addon.getAddonByName("Bank").map(b -> ((Bank) b).getBankManager().getBalance(i).getValue())
.orElse(0D);
double ecoBalance = addon.getPlugin().getVault()
double ecoBalance = player == null ? 0D
: addon.getPlugin().getVault()
.map(v -> v.getBalance(User.getInstance(player), addon.getOverWorld())).orElse(0D);

return c.replace("[island]", i.getName() == null ? "" : i.getName())
Expand Down

0 comments on commit 3c96738

Please sign in to comment.