mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-27 02:49:08 +00:00
feat: Option to open menu on wardrobe enter
This commit is contained in:
@@ -33,6 +33,10 @@ public class WardrobeSettings {
|
||||
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 WARDROBE_MENU_OPTIONS = "menu-options";
|
||||
private static final String WARDROBE_ENTER_OPEN_MENU_PATH = "enter-open-menu";
|
||||
|
||||
private static final String GAMEMODE_OPTIONS_PATH = "gamemode-options";
|
||||
private static final String FORCE_EXIT_GAMEMODE_PATH = "exit-gamemode-enabled";
|
||||
private static final String EXIT_GAMEMODE_PATH = "exit-gamemode";
|
||||
@@ -68,6 +72,7 @@ public class WardrobeSettings {
|
||||
private static boolean equipPumpkin;
|
||||
private static boolean returnLastLocation;
|
||||
private static boolean enabledBossbar;
|
||||
private static boolean enterOpenMenu;
|
||||
private static boolean forceExitGamemode;
|
||||
private static GameMode exitGamemode;
|
||||
private static HashMap<String, Wardrobe> wardrobes;
|
||||
@@ -97,6 +102,9 @@ public class WardrobeSettings {
|
||||
returnLastLocation = source.node(RETURN_LAST_LOCATION).getBoolean(false);
|
||||
tryCosmeticsInWardrobe = source.node(TRY_COSMETICS_WARDROBE).getBoolean(false);
|
||||
|
||||
ConfigurationNode menuOptionsNode = source.node(WARDROBE_MENU_OPTIONS);
|
||||
enterOpenMenu = menuOptionsNode.node(WARDROBE_ENTER_OPEN_MENU_PATH).getBoolean(false);
|
||||
|
||||
ConfigurationNode gamemodeNode = source.node(GAMEMODE_OPTIONS_PATH);
|
||||
forceExitGamemode = gamemodeNode.node(FORCE_EXIT_GAMEMODE_PATH).getBoolean(false);
|
||||
exitGamemode = GameMode.valueOf(gamemodeNode.node(EXIT_GAMEMODE_PATH).getString("SURVIVAL"));
|
||||
@@ -274,6 +282,10 @@ public class WardrobeSettings {
|
||||
return transitionFadeOut;
|
||||
}
|
||||
|
||||
public static boolean isEnterOpenMenu() {
|
||||
return enterOpenMenu;
|
||||
}
|
||||
|
||||
public static boolean isForceExitGamemode() {
|
||||
return forceExitGamemode;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import com.hibiscusmc.hmccosmetics.config.WardrobeLocation;
|
||||
import com.hibiscusmc.hmccosmetics.config.WardrobeSettings;
|
||||
import com.hibiscusmc.hmccosmetics.cosmetic.Cosmetic;
|
||||
import com.hibiscusmc.hmccosmetics.cosmetic.CosmeticSlot;
|
||||
import com.hibiscusmc.hmccosmetics.gui.Menu;
|
||||
import com.hibiscusmc.hmccosmetics.gui.Menus;
|
||||
import com.hibiscusmc.hmccosmetics.nms.NMSHandlers;
|
||||
import com.hibiscusmc.hmccosmetics.user.CosmeticUser;
|
||||
import com.hibiscusmc.hmccosmetics.util.MessagesUtil;
|
||||
@@ -135,6 +137,11 @@ public class UserWardrobeManager {
|
||||
target.showBossBar(bossBar);
|
||||
}
|
||||
|
||||
if (WardrobeSettings.isEnterOpenMenu()) {
|
||||
Menu menu = Menus.getDefaultMenu();
|
||||
if (menu != null) menu.openMenu(user);
|
||||
}
|
||||
|
||||
this.active = true;
|
||||
update();
|
||||
setWardrobeStatus(WardrobeStatus.RUNNING);
|
||||
|
||||
@@ -74,6 +74,9 @@ 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
|
||||
|
||||
menu-options:
|
||||
enter-open-menu: false # If the menu should open when a player enters a wardrobe
|
||||
|
||||
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
|
||||
exit-gamemode: "SURVIVAL" # Only activates if exit-gamemode-enabled is true, find gamemodes here: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/GameMode.html
|
||||
|
||||
Reference in New Issue
Block a user