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:
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user