9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-19 15:09:19 +00:00

fix: user initialization not checking potion effects

This commit is contained in:
LoJoSho
2025-08-06 16:27:27 -05:00
parent c99a57a6bf
commit dfe51ba5b8
2 changed files with 7 additions and 1 deletions

View File

@@ -85,7 +85,7 @@ public abstract class Data {
private boolean shouldHiddenSave(CosmeticUser.HiddenReason reason) {
switch (reason) {
case EMOTE, NONE, GAMEMODE, WORLD, DISABLED -> {
case EMOTE, NONE, GAMEMODE, WORLD, DISABLED, POTION -> {
return false;
}
default -> {

View File

@@ -36,6 +36,7 @@ import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.*;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitTask;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -148,6 +149,11 @@ public class CosmeticUser implements CosmeticHolder {
MessagesUtil.sendDebugMessages("Showing Cosmetics due to world");
showCosmetics(HiddenReason.WORLD);
}
if (bukkitPlayer != null && bukkitPlayer.hasPotionEffect(PotionEffectType.INVISIBILITY)) {
hideCosmetics(HiddenReason.POTION);
}
if (Settings.isAllPlayersHidden()) {
hideCosmetics(HiddenReason.DISABLED);
}