mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-20 07:29:15 +00:00
feat: add config options to prevent damage while in the wardrobe
This commit is contained in:
@@ -33,6 +33,8 @@ public class WardrobeSettings {
|
|||||||
private static final String EQUIP_PUMPKIN_WARDROBE = "equip-pumpkin";
|
private static final String EQUIP_PUMPKIN_WARDROBE = "equip-pumpkin";
|
||||||
private static final String TRY_COSMETICS_WARDROBE = "unchecked-wardrobe-cosmetics";
|
private static final String TRY_COSMETICS_WARDROBE = "unchecked-wardrobe-cosmetics";
|
||||||
private static final String RETURN_LAST_LOCATION = "return-last-location";
|
private static final String RETURN_LAST_LOCATION = "return-last-location";
|
||||||
|
private static final String DAMAGE_KICK_PATH = "damage-kicked";
|
||||||
|
private static final String PREVENT_DAMAGE_PATH = "prevent-damage";
|
||||||
|
|
||||||
private static final String WARDROBE_MENU_OPTIONS = "menu-options";
|
private static final String WARDROBE_MENU_OPTIONS = "menu-options";
|
||||||
private static final String WARDROBE_ENTER_OPEN_MENU_PATH = "enter-open-menu";
|
private static final String WARDROBE_ENTER_OPEN_MENU_PATH = "enter-open-menu";
|
||||||
@@ -87,6 +89,10 @@ public class WardrobeSettings {
|
|||||||
@Getter
|
@Getter
|
||||||
private static boolean forceExitGamemode;
|
private static boolean forceExitGamemode;
|
||||||
@Getter
|
@Getter
|
||||||
|
private static boolean damagedKicked;
|
||||||
|
@Getter
|
||||||
|
private static boolean preventDamage;
|
||||||
|
@Getter
|
||||||
private static GameMode exitGamemode;
|
private static GameMode exitGamemode;
|
||||||
private static HashMap<String, Wardrobe> wardrobes;
|
private static HashMap<String, Wardrobe> wardrobes;
|
||||||
@Getter
|
@Getter
|
||||||
@@ -121,6 +127,8 @@ public class WardrobeSettings {
|
|||||||
equipPumpkin = source.node(EQUIP_PUMPKIN_WARDROBE).getBoolean();
|
equipPumpkin = source.node(EQUIP_PUMPKIN_WARDROBE).getBoolean();
|
||||||
returnLastLocation = source.node(RETURN_LAST_LOCATION).getBoolean(false);
|
returnLastLocation = source.node(RETURN_LAST_LOCATION).getBoolean(false);
|
||||||
tryCosmeticsInWardrobe = source.node(TRY_COSMETICS_WARDROBE).getBoolean(false);
|
tryCosmeticsInWardrobe = source.node(TRY_COSMETICS_WARDROBE).getBoolean(false);
|
||||||
|
damagedKicked = source.node(DAMAGE_KICK_PATH).getBoolean(false);
|
||||||
|
preventDamage = source.node(PREVENT_DAMAGE_PATH).getBoolean(true);
|
||||||
|
|
||||||
ConfigurationNode menuOptionsNode = source.node(WARDROBE_MENU_OPTIONS);
|
ConfigurationNode menuOptionsNode = source.node(WARDROBE_MENU_OPTIONS);
|
||||||
enterOpenMenu = menuOptionsNode.node(WARDROBE_ENTER_OPEN_MENU_PATH).getBoolean(false);
|
enterOpenMenu = menuOptionsNode.node(WARDROBE_ENTER_OPEN_MENU_PATH).getBoolean(false);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.comphenix.protocol.wrappers.Pair;
|
|||||||
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
import com.hibiscusmc.hmccosmetics.HMCCosmeticsPlugin;
|
||||||
import com.hibiscusmc.hmccosmetics.api.events.PlayerCosmeticPostEquipEvent;
|
import com.hibiscusmc.hmccosmetics.api.events.PlayerCosmeticPostEquipEvent;
|
||||||
import com.hibiscusmc.hmccosmetics.config.Settings;
|
import com.hibiscusmc.hmccosmetics.config.Settings;
|
||||||
|
import com.hibiscusmc.hmccosmetics.config.WardrobeSettings;
|
||||||
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
||||||
import com.hibiscusmc.hmccosmetics.cosmetic.CosmeticSlot;
|
import com.hibiscusmc.hmccosmetics.cosmetic.CosmeticSlot;
|
||||||
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticArmorType;
|
import com.hibiscusmc.hmccosmetics.cosmetic.types.CosmeticArmorType;
|
||||||
@@ -195,7 +196,11 @@ public class PlayerGameListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (user.isInWardrobe()) {
|
if (user.isInWardrobe()) {
|
||||||
user.leaveWardrobe();
|
if (WardrobeSettings.isPreventDamage()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (WardrobeSettings.isDamagedKicked()) user.leaveWardrobe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,6 +115,10 @@ wardrobe:
|
|||||||
return-last-location: false
|
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)
|
# 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
|
unchecked-wardrobe-cosmetics: false
|
||||||
|
# If HMCC should prevent a player from being damaged while being in the wardrobe
|
||||||
|
prevent-damage: true
|
||||||
|
# If a player is damaged in a wardrobe, and if it's set to true, it'll kick them from the wardrobe (prevent-damage must be false)
|
||||||
|
damage-kicked: false
|
||||||
|
|
||||||
menu-options:
|
menu-options:
|
||||||
enter-open-menu: false # If the menu should open when a player enters a wardrobe
|
enter-open-menu: false # If the menu should open when a player enters a wardrobe
|
||||||
|
|||||||
Reference in New Issue
Block a user