Skip to content

Commit

Permalink
Merge pull request #10 from skbeh/check-essentials
Browse files Browse the repository at this point in the history
Fix Realizedd#87 by always checking whether Essentials is null
  • Loading branch information
SrBedrock authored May 14, 2023
2 parents 28b0abc + 411a89d commit 52dfa29
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 @@ -226,7 +228,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 52dfa29

Please sign in to comment.