9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2026-01-03 14:22:14 +00:00

Stopped displaying cosmetics if player is hidden

This commit is contained in:
HeroBrineGoat
2022-02-06 12:35:45 -05:00
parent 0b4e2a6966
commit 4d632c612a
2 changed files with 7 additions and 4 deletions

View File

@@ -133,7 +133,7 @@ public class User {
public void updateArmorStand(final Player other, final Settings settings, final Location location) {
final List<Pair<EnumWrappers.ItemSlot, ItemStack>> equipmentList = new ArrayList<>();
final boolean hidden = this.isHidden(other);
final boolean hidden = !this.shouldShow(other);
if (hidden) {
equipmentList.add(new Pair<>(EnumWrappers.ItemSlot.HEAD,
new ItemStack(Material.AIR)
@@ -176,9 +176,12 @@ public class User {
}
}
public boolean isHidden(final Player other) {
public boolean shouldShow(final Player other) {
final Player player = this.getPlayer();
return player != null && (player.hasPotionEffect(PotionEffectType.INVISIBILITY) || !other.canSee(player));
return player == null ||
(!player.hasPotionEffect(PotionEffectType.INVISIBILITY) &&
other.canSee(player) &&
!player.isSwimming());
}
private boolean isFacingDown(final Location location, final int pitchLimit) {

View File

@@ -134,7 +134,7 @@ public class UserManager {
final PlayerArmor playerArmor = user.getPlayerArmor();
final List<Pair<EnumWrappers.ItemSlot, ItemStack>> equipmentList = new ArrayList<>();
final boolean hidden = user.isHidden(other);
final boolean hidden = !user.shouldShow(other);
equipmentList.add(
new Pair<>(