9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-30 12:29:16 +00:00

fix: unchecked wardrobes not unapplying

This commit is contained in:
LoJoSho
2023-06-10 15:17:11 -05:00
parent 2e4130012f
commit f5105200de
2 changed files with 12 additions and 6 deletions

View File

@@ -374,7 +374,9 @@ public class CosmeticUser {
public boolean canEquipCosmetic(Cosmetic cosmetic) {
if (!cosmetic.requiresPermission()) return true;
if (isInWardrobe() && WardrobeSettings.isTryCosmeticsInWardrobe()) return true;
if (isInWardrobe()) {
if (WardrobeSettings.isTryCosmeticsInWardrobe() && userWardrobeManager.getWardrobeStatus().equals(UserWardrobeManager.WardrobeStatus.RUNNING)) return true;
}
return getPlayer().hasPermission(cosmetic.getPermission());
}

View File

@@ -168,6 +168,15 @@ public class UserWardrobeManager {
Runnable run = () -> {
this.active = false;
// For Wardrobe Temp Cosmetics
for (Cosmetic cosmetic : user.getCosmetics()) {
MessagesUtil.sendDebugMessages("Checking... " + cosmetic.getId());
if (!user.canEquipCosmetic(cosmetic)) {
MessagesUtil.sendDebugMessages("Unable to keep " + cosmetic.getId());
user.removeCosmeticSlot(cosmetic.getSlot());
}
}
// NPC
if (user.hasCosmeticInSlot(CosmeticSlot.BALLOON)) user.getBalloonManager().sendRemoveLeashPacket();
PacketManager.sendEntityDestroyPacket(NPC_ID, viewer); // Success
@@ -213,11 +222,6 @@ public class UserWardrobeManager {
target.hideBossBar(bossBar);
}
// For Wardrobe Temp Cosmetics
for (Cosmetic cosmetic : user.getCosmetics()) {
if (!user.canEquipCosmetic(cosmetic)) user.removeCosmeticSlot(cosmetic.getSlot());
}
user.updateCosmetic();
};
run.run();