mirror of
https://github.com/HibiscusMC/HMCCosmetics.git
synced 2025-12-19 15:09:19 +00:00
feat: add BetterHUD support for huds in wardrobes
This commit is contained in:
@@ -81,6 +81,9 @@ allprojects {
|
||||
compileOnly("me.clip:placeholderapi:2.11.6")
|
||||
compileOnly("com.ticxo.modelengine:ModelEngine:R4.0.6")
|
||||
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.12")
|
||||
compileOnly("io.github.toxicity188:BetterHud-standard-api:1.12") //Standard api
|
||||
compileOnly("io.github.toxicity188:BetterHud-bukkit-api:1.12") //Platform api
|
||||
compileOnly("io.github.toxicity188:BetterCommand:1.12") //BetterCommand library
|
||||
//compileOnly("it.unimi.dsi:fastutil:8.5.14")
|
||||
compileOnly("org.projectlombok:lombok:1.18.34")
|
||||
compileOnly("me.lojosho:HibiscusCommons:0.6.0-85d65299")
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.hibiscusmc.hmccosmetics.emotes.EmoteManager;
|
||||
import com.hibiscusmc.hmccosmetics.gui.Menu;
|
||||
import com.hibiscusmc.hmccosmetics.gui.Menus;
|
||||
import com.hibiscusmc.hmccosmetics.hooks.items.HookHMCCosmetics;
|
||||
import com.hibiscusmc.hmccosmetics.hooks.misc.HookBetterHud;
|
||||
import com.hibiscusmc.hmccosmetics.hooks.placeholders.HMCPlaceholderExpansion;
|
||||
import com.hibiscusmc.hmccosmetics.hooks.worldguard.WGHook;
|
||||
import com.hibiscusmc.hmccosmetics.hooks.worldguard.WGListener;
|
||||
@@ -52,6 +53,7 @@ public final class HMCCosmeticsPlugin extends HibiscusPlugin {
|
||||
public HMCCosmeticsPlugin() {
|
||||
super(13873, 1879);
|
||||
new HookHMCCosmetics();
|
||||
new HookBetterHud();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -73,6 +73,8 @@ public class Settings {
|
||||
private static final String ENABLED_PATH = "enabled";
|
||||
private static final String SLOT_OPTIONS_PATH = "slot-options";
|
||||
private static final String BACKPACK_PREVENT_DARKNESS_PATH = "backpack-prevent-darkness";
|
||||
private static final String BETTER_HUD_PATH = "betterhud";
|
||||
private static final String BETTER_HUD_HIDE_IN_WARDROBE_PATH = "wardrobe-hide";
|
||||
|
||||
@Getter
|
||||
private static String defaultMenu;
|
||||
@@ -169,6 +171,8 @@ public class Settings {
|
||||
private static boolean emoteMoveCheck;
|
||||
@Getter @Setter
|
||||
private static boolean allPlayersHidden;
|
||||
@Getter
|
||||
private static boolean showBetterHudInWardrobe;
|
||||
|
||||
|
||||
public static void load(ConfigurationNode source) {
|
||||
@@ -271,6 +275,9 @@ public class Settings {
|
||||
ConfigurationNode nexoSettings = hookSettings.node(HOOK_NEXO_PATH);
|
||||
nexoChangeReload = nexoSettings.node(HOOK_RELOAD_CHANGE_PATH).getBoolean(true);
|
||||
|
||||
ConfigurationNode betterHudSettings = hookSettings.node(BETTER_HUD_PATH);
|
||||
showBetterHudInWardrobe = betterHudSettings.node(BETTER_HUD_HIDE_IN_WARDROBE_PATH).getBoolean(true);
|
||||
|
||||
ConfigurationNode worldGuardSettings = hookSettings.node(HOOK_WORLDGUARD_PATH);
|
||||
worldGuardMoveCheck = worldGuardSettings.node(HOOK_WG_MOVE_CHECK_PATH).getBoolean(true);
|
||||
// I messed up in release 2.2.6 and forgot to change player_move_check to player-move-check.
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.hibiscusmc.hmccosmetics.hooks.misc;
|
||||
|
||||
import com.hibiscusmc.hmccosmetics.api.events.PlayerWardrobeEnterEvent;
|
||||
import com.hibiscusmc.hmccosmetics.api.events.PlayerWardrobeLeaveEvent;
|
||||
import kr.toxicity.hud.api.BetterHud;
|
||||
import kr.toxicity.hud.api.player.HudPlayer;
|
||||
import me.lojosho.hibiscuscommons.hooks.Hook;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class HookBetterHud extends Hook {
|
||||
|
||||
public HookBetterHud() {
|
||||
super("BetterHUD");
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onPlayerEnterWardrobe(PlayerWardrobeEnterEvent event) {
|
||||
UUID uuid = event.getUniqueId();
|
||||
HudPlayer hudPlayer = BetterHud.getInstance().getPlayerManager().getHudPlayer(uuid);
|
||||
if (hudPlayer == null) return;
|
||||
hudPlayer.setHudEnabled(false);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onPlayerLeaveWardrobe(PlayerWardrobeLeaveEvent event) {
|
||||
UUID uuid = event.getUniqueId();
|
||||
HudPlayer hudPlayer = BetterHud.getInstance().getPlayerManager().getHudPlayer(uuid);
|
||||
if (hudPlayer == null) return;
|
||||
hudPlayer.setHudEnabled(true);
|
||||
}
|
||||
}
|
||||
@@ -139,6 +139,8 @@ hook-settings:
|
||||
# Checks worldguard regions for HMCC flags. If set to false, flags will not work properly.
|
||||
# Requires restart to apply changes.
|
||||
player-move-check: true
|
||||
betterhud:
|
||||
wardrobe-hide: true
|
||||
wardrobe:
|
||||
# how much yaw should change per tick, set to 0 for none
|
||||
rotation-speed: 3
|
||||
|
||||
Reference in New Issue
Block a user