diff --git a/plugin/src/main/java/at/helpch/chatchat/hooks/vanish/EssentialsVanishHook.java b/plugin/src/main/java/at/helpch/chatchat/hooks/vanish/EssentialsVanishHook.java index d2acf10..2dce954 100644 --- a/plugin/src/main/java/at/helpch/chatchat/hooks/vanish/EssentialsVanishHook.java +++ b/plugin/src/main/java/at/helpch/chatchat/hooks/vanish/EssentialsVanishHook.java @@ -45,6 +45,8 @@ public void enable() { @Override public boolean canSee(@NotNull final ChatUser user, @NotNull final ChatUser target) { - return user.playerNotNull().canSee(target.playerNotNull()); + return user.player() + .map(player -> target.player().map(player::canSee).orElse(true)) + .orElse(true); } } diff --git a/plugin/src/main/java/at/helpch/chatchat/hooks/vanish/SuperVanishHook.java b/plugin/src/main/java/at/helpch/chatchat/hooks/vanish/SuperVanishHook.java index 47bd8d5..973d7ee 100644 --- a/plugin/src/main/java/at/helpch/chatchat/hooks/vanish/SuperVanishHook.java +++ b/plugin/src/main/java/at/helpch/chatchat/hooks/vanish/SuperVanishHook.java @@ -48,6 +48,9 @@ public void enable() { @Override public boolean canSee(@NotNull final ChatUser user, @NotNull final ChatUser target) { - return VanishAPI.canSee(user.playerNotNull(), target.playerNotNull()); + return user.player() + .map(player -> target.player().map(targetPlayer -> VanishAPI.canSee(player, targetPlayer)) + .orElse(true)) + .orElse(true); } } diff --git a/plugin/src/main/java/at/helpch/chatchat/hooks/vanish/VanillaVanishHook.java b/plugin/src/main/java/at/helpch/chatchat/hooks/vanish/VanillaVanishHook.java index 8da30fc..f06697b 100644 --- a/plugin/src/main/java/at/helpch/chatchat/hooks/vanish/VanillaVanishHook.java +++ b/plugin/src/main/java/at/helpch/chatchat/hooks/vanish/VanillaVanishHook.java @@ -44,6 +44,8 @@ public void enable() { @Override public boolean canSee(@NotNull final ChatUser user, @NotNull final ChatUser target) { - return user.playerNotNull().canSee(target.playerNotNull()); + return user.player() + .map(player -> target.player().map(player::canSee).orElse(true)) + .orElse(true); } }