Skip to content

Commit

Permalink
Fix #87 by always checking whether Essentials is null
Browse files Browse the repository at this point in the history
  • Loading branch information
skbeh committed May 14, 2023
1 parent e18edb5 commit 411a89d
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ public class SpectateManagerImpl implements Loadable, SpectateManager {
private final Multimap<Arena, SpectatorImpl> arenas = HashMultimap.create();

private Teleport teleport;
@Nullable
private MyPetHook myPet;
@Nullable
private EssentialsHook essentials;

public SpectateManagerImpl(final DuelsPlugin plugin) {
Expand Down Expand Up @@ -139,7 +141,7 @@ public Result startSpectating(@NotNull final Player player, @NotNull final Playe
final MatchImpl match = arena.getMatch();

// Hide from players in match
if (match != null && !essentials.isVanished(player)) {
if (match != null && !(essentials != null && essentials.isVanished(player))) {
match.getAllPlayers()
.stream()
.filter(arenaPlayer -> arenaPlayer.isOnline() && arenaPlayer.canSee(player))
Expand Down Expand Up @@ -224,7 +226,7 @@ public void stopSpectating(final Player player, final SpectatorImpl spectator) {
final MatchImpl match = spectator.getArena().getMatch();

// Show to players in match
if (match != null && !essentials.isVanished(player)) {
if (match != null && !(essentials != null && essentials.isVanished(player))) {
match.getAllPlayers()
.stream()
.filter(Player::isOnline)
Expand Down

0 comments on commit 411a89d

Please sign in to comment.