Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #87 by always checking whether Essentials is null #100

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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