Skip to content

Commit

Permalink
Merge pull request #1388 from Syrent/master
Browse files Browse the repository at this point in the history
fix: avoid using TAB's internal vanish checks when a registered vanish integration is available
  • Loading branch information
NEZNAMY authored Nov 24, 2024
2 parents e182366 + ee5ff07 commit 378041c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,13 @@ public interface Platform {
* @return {@code true} if can see, {@code false} if not.
*/
default boolean canSee(@NotNull TabPlayer viewer, @NotNull TabPlayer target) {
try {
if (VanishIntegration.getHandlers().stream().anyMatch(integration -> !integration.canSee(viewer, target))) return false;
} catch (ConcurrentModificationException e) {
// PV error, try again
return canSee(viewer, target);
if (!VanishIntegration.getHandlers().isEmpty()) {
try {
return VanishIntegration.getHandlers().stream().allMatch(integration -> integration.canSee(viewer, target));
} catch (ConcurrentModificationException e) {
// PV error, try again
return canSee(viewer, target);
}
}
return !target.isVanished() || viewer.hasPermission(TabConstants.Permission.SEE_VANISHED);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,11 @@ public void sendPluginMessage(@NotNull OutgoingMessage message) {

@Override
public boolean isVanished() {
for (VanishIntegration i : VanishIntegration.getHandlers()) {
if (i.isVanished(this)) return true;
if (!VanishIntegration.getHandlers().isEmpty()) {
for (VanishIntegration integration : VanishIntegration.getHandlers()) {
if (integration.isVanished(this)) return true;
}
return false;
}
return vanished;
}
Expand Down

0 comments on commit 378041c

Please sign in to comment.