From f2fab91916502004ad62925d8593d8a443dd76c7 Mon Sep 17 00:00:00 2001 From: LoJoSho Date: Fri, 18 Aug 2023 10:01:19 -0500 Subject: [PATCH] feat: add option to move in emote when out of camera mode --- .../com/hibiscusmc/hmccosmetics/config/Settings.java | 9 +++++++-- .../hmccosmetics/listener/PlayerGameListener.java | 2 +- common/src/main/resources/config.yml | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/config/Settings.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/config/Settings.java index e44f59f8..ee10dae4 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/config/Settings.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/config/Settings.java @@ -37,6 +37,8 @@ public class Settings { private static final String COSMETIC_EMOTE_AIR_CHECK_PATH = "emote-air-check"; private static final String COSMETIC_EMOTE_DAMAGE_PATH = "emote-damage-leave"; private static final String COSMETIC_EMOTE_INVINCIBLE_PATH = "emote-invincible"; + private static final String COSMETIC_EMOTE_CAMERA_PATH = "emote-camera"; + private static final String COSMETIC_EMOTE_MOVE_CHECK_PATH = "emote-move"; private static final String COSMETIC_ADD_ENCHANTS_HELMET_PATH = "helmet-add-enchantments"; private static final String COSMETIC_ADD_ENCHANTS_CHESTPLATE_PATH = "chest-add-enchantments"; private static final String COSMETIC_ADD_ENCHANTS_LEGGINGS_PATH = "leggings-add-enchantments"; @@ -129,6 +131,8 @@ public class Settings { private static String lockedCosmeticColor; @Getter private static boolean emoteCameraEnabled; + @Getter + private static boolean emoteMoveCheck; public static void load(ConfigurationNode source) { @@ -162,8 +166,9 @@ public class Settings { addLeggingEnchants = cosmeticSettings.node(COSMETIC_ADD_ENCHANTS_LEGGINGS_PATH).getBoolean(false); addBootsEnchants = cosmeticSettings.node(COSMETIC_ADD_ENCHANTS_BOOTS_PATH).getBoolean(false); tickPeriod = cosmeticSettings.node(TICK_PERIOD_PATH).getInt(-1); - viewDistance = cosmeticSettings.node(VIEW_DISTANCE_PATH).getInt(); - emoteCameraEnabled = cosmeticSettings.node("emote-camera").getBoolean(true); + viewDistance = cosmeticSettings.node(VIEW_DISTANCE_PATH).getInt(-3); + emoteCameraEnabled = cosmeticSettings.node(COSMETIC_EMOTE_CAMERA_PATH).getBoolean(true); + emoteMoveCheck = cosmeticSettings.node(COSMETIC_EMOTE_MOVE_CHECK_PATH).getBoolean(false); ConfigurationNode menuSettings = source.node(MENU_SETTINGS_PATH); diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/listener/PlayerGameListener.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/listener/PlayerGameListener.java index fcc628b0..423e5263 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/listener/PlayerGameListener.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/listener/PlayerGameListener.java @@ -190,7 +190,7 @@ public class PlayerGameListener implements Listener { Player player = event.getPlayer(); CosmeticUser user = CosmeticUsers.getUser(player); if (user == null) return; - if (user.getUserEmoteManager().isPlayingEmote()) { + if (!Settings.isEmoteMoveCheck() && user.getUserEmoteManager().isPlayingEmote()) { event.setCancelled(true); return; } diff --git a/common/src/main/resources/config.yml b/common/src/main/resources/config.yml index 8e0ee145..bf6c82c3 100644 --- a/common/src/main/resources/config.yml +++ b/common/src/main/resources/config.yml @@ -31,6 +31,8 @@ cosmetic-settings: emote-invincible: false # If the player should not take damage while doing an emote # If a player should be put into camera mode when looking at an emote. Highly recommend keeping it as true. emote-camera: true + # If a player should be able to move in an emote. This option really only affects if "emote-camera" is false + emote-move: false helmet-add-enchantments: false # If the plugin should keep enchants on helmets. This is useful as some enchantments are client side only. chest-add-enchantments: false # If the plugin should keep enchants on chestplate. This is useful as some enchantments are client side only.