From c4d7b657dd3cf79493d71f8b2ebdc5e318524066 Mon Sep 17 00:00:00 2001 From: LoJoSho Date: Fri, 6 Oct 2023 12:44:59 -0500 Subject: [PATCH] feat: add option to disable emotes entirely --- .../java/com/hibiscusmc/hmccosmetics/HMCCosmeticsPlugin.java | 4 ++-- .../java/com/hibiscusmc/hmccosmetics/config/Settings.java | 4 ++++ common/src/main/resources/config.yml | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/HMCCosmeticsPlugin.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/HMCCosmeticsPlugin.java index 7d496b15..19a8f333 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/HMCCosmeticsPlugin.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/HMCCosmeticsPlugin.java @@ -98,7 +98,7 @@ public final class HMCCosmeticsPlugin extends JavaPlugin { if (!emoteFile.exists()) emoteFile.mkdir(); // Player Animator - if (!NMSHandlers.getVersion().contains("v1_20_R2")) PlayerAnimatorImpl.initialize(this); // PlayerAnimator does not support 1.20.2 yet + if (Settings.isEmotesEnabled() && !NMSHandlers.getVersion().contains("v1_20_R2")) PlayerAnimatorImpl.initialize(this); // PlayerAnimator does not support 1.20.2 yet // Configuration Sync final File configFile = Path.of(getInstance().getDataFolder().getPath(), "config.yml").toFile(); @@ -252,7 +252,7 @@ public final class HMCCosmeticsPlugin extends JavaPlugin { } } - if (!NMSHandlers.getVersion().contains("v1_20_R2")) EmoteManager.loadEmotes(); // PlayerAnimator does not support 1.20.2 yet + if (Settings.isEmotesEnabled() && !NMSHandlers.getVersion().contains("v1_20_R2")) EmoteManager.loadEmotes(); // PlayerAnimator does not support 1.20.2 yet getInstance().getLogger().info("Successfully Enabled HMCCosmetics"); getInstance().getLogger().info(Cosmetics.values().size() + " Cosmetics Successfully Setup"); 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 95a82d3f..91ad46a0 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/config/Settings.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/config/Settings.java @@ -33,6 +33,7 @@ public class Settings { private static final String HOOK_WORLDGUARD_PATH = "worldguard"; private static final String HOOK_WG_MOVE_CHECK_PATH = "player-move-check"; private static final String HOOK_WG_MOVE_CHECK_PATH_LEGACY = "player_move_check"; + private static final String COSMETIC_EMOTE_ENABLE = "emote-enable"; private static final String COSMETIC_EMOTE_CHECK_PATH = "emote-block-check"; private static final String COSMETIC_EMOTE_AIR_CHECK_PATH = "emote-air-check"; private static final String COSMETIC_EMOTE_DAMAGE_PATH = "emote-damage-leave"; @@ -107,6 +108,8 @@ public class Settings { @Getter private static boolean cosmeticForceOffhandCosmeticShow; @Getter + private static boolean emotesEnabled; + @Getter private static int viewDistance; @Getter private static int tickPeriod; @@ -164,6 +167,7 @@ public class Settings { unapplyOnDeath = cosmeticSettings.node(UNAPPLY_DEATH_PATH).getBoolean(false); forcePermissionJoin = cosmeticSettings.node(FORCE_PERMISSION_JOIN_PATH).getBoolean(false); forceShowOnJoin = cosmeticSettings.node(FORCE_SHOW_COSMETICS_PATH).getBoolean(false); + emotesEnabled = cosmeticSettings.node(COSMETIC_EMOTE_ENABLE).getBoolean(true); emoteDistance = cosmeticSettings.node(EMOTE_DISTANCE_PATH).getDouble(-3); cosmeticEmoteBlockCheck = cosmeticSettings.node(COSMETIC_EMOTE_CHECK_PATH).getBoolean(true); emoteAirCheck = cosmeticSettings.node(COSMETIC_EMOTE_AIR_CHECK_PATH).getBoolean(true); diff --git a/common/src/main/resources/config.yml b/common/src/main/resources/config.yml index 28f6c829..34c5a1d0 100644 --- a/common/src/main/resources/config.yml +++ b/common/src/main/resources/config.yml @@ -24,6 +24,8 @@ cosmetic-settings: force-permission-join: true # Checks a player permission if they can have a cosmetic when they join the server. force-show-join: false # If the plugin should force show a player's cosmetics when they join the server. + # This disables the entire internal emote system within the plugin. This option requires a restart. + emote-enable: true emote-distance: -3 # This shows how far away the camera should be while a player is doing an emote. Negative is behind player. emote-block-check: true # If the server should check if the block is open where the camera is placed (prevents players viewing through blocks) emote-air-check: true # Check if there is air under a player, if there is, don't play emote