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

feat: add ability to select any cosmetic in wardrobe, resolves #55

This commit is contained in:
LoJoSho
2023-05-23 11:11:24 -05:00
parent f072f0e044
commit 04810b91ef
4 changed files with 11 additions and 3 deletions

View File

@@ -32,6 +32,7 @@ public class WardrobeSettings {
private static final String VIEWER_LOCATION_PATH = "viewer-location";
private static final String LEAVE_LOCATION_PATH = "leave-location";
private static final String EQUIP_PUMPKIN_WARDROBE = "equip-pumpkin";
private static final String TRY_COSMETICS_WARDROBE = "unchecked-wardrobe-cosmetics";
private static final String RETURN_LAST_LOCATION = "return-last-location";
private static final String GAMEMODE_OPTIONS_PATH = "gamemode-options";
private static final String FORCE_EXIT_GAMEMODE_PATH = "exit-gamemode-enabled";
@@ -61,6 +62,7 @@ public class WardrobeSettings {
private static int despawnDelay;
private static float bossbarProgress;
private static boolean applyCosmeticsOnClose;
private static boolean tryCosmeticsInWardrobe;
private static boolean equipPumpkin;
private static boolean returnLastLocation;
private static boolean enabledBossbar;
@@ -91,6 +93,7 @@ public class WardrobeSettings {
applyCosmeticsOnClose = source.node(APPLY_COSMETICS_ON_CLOSE).getBoolean();
equipPumpkin = source.node(EQUIP_PUMPKIN_WARDROBE).getBoolean();
returnLastLocation = source.node(RETURN_LAST_LOCATION).getBoolean(false);
tryCosmeticsInWardrobe = source.node(TRY_COSMETICS_WARDROBE).getBoolean(false);
ConfigurationNode gamemodeNode = source.node(GAMEMODE_OPTIONS_PATH);
forceExitGamemode = gamemodeNode.node(FORCE_EXIT_GAMEMODE_PATH).getBoolean(false);
@@ -267,6 +270,10 @@ public class WardrobeSettings {
return exitGamemode;
}
public static boolean isTryCosmeticsInWardrobe() {
return tryCosmeticsInWardrobe;
}
/**
* Sets where the NPC/Mannequin will spawn in the wardrobe
* @param newLocation

View File

@@ -376,6 +376,7 @@ public class CosmeticUser {
public boolean canEquipCosmetic(Cosmetic cosmetic) {
if (!cosmetic.requiresPermission()) return true;
if (isInWardrobe() && WardrobeSettings.isTryCosmeticsInWardrobe()) return true;
if (getPlayer().hasPermission(cosmetic.getPermission())) return true;
return false;
}

View File

@@ -215,9 +215,7 @@ public class UserWardrobeManager {
// For Wardrobe Temp Cosmetics
for (Cosmetic cosmetic : user.getCosmetics()) {
if (cosmetic.requiresPermission()) {
if (!player.hasPermission(cosmetic.getPermission())) user.removeCosmeticSlot(cosmetic.getSlot());
}
if (!user.canEquipCosmetic(cosmetic)) user.removeCosmeticSlot(cosmetic.getSlot());
}
user.updateCosmetic();

View File

@@ -71,6 +71,8 @@ wardrobe:
equip-pumpkin: false
# Rather than having a set exit location, this will send the player back to where they entered the wardrobe. Not recommended for WG regions
return-last-location: false
# If players in wardrobes should be able to equip any cosmetic, regardless of permission (Cosmetics they do not have access to will be removed when they leave the wardrobe)
unchecked-wardrobe-cosmetics: false
gamemode-options:
exit-gamemode-enabled: false # Setting this to false will set the gamemode the player came in as. True sets to exit-gamemode gamemode