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 c941049a..63cf694e 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/config/Settings.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/config/Settings.java @@ -42,6 +42,7 @@ public class Settings { 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_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"; private static final String COSMETIC_EMOTE_INVINCIBLE_PATH = "emote-invincible"; private static final String COSMETIC_ADD_ENCHANTS_HELMET_PATH = "helmet-add-enchantments"; @@ -70,6 +71,7 @@ public class Settings { private static boolean addChestplateEnchants; private static boolean addLeggingEnchants; private static boolean addBootsEnchants; + private static boolean emoteAirCheck; private static boolean emoteDamageLeave; private static boolean emoteInvincible; private static boolean destroyLooseCosmetics; @@ -105,6 +107,7 @@ public class Settings { forcePermissionJoin = cosmeticSettings.node(FORCE_PERMISSION_JOIN_PATH).getBoolean(false); 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); emoteDamageLeave = cosmeticSettings.node(COSMETIC_EMOTE_DAMAGE_PATH).getBoolean(false); emoteInvincible = cosmeticSettings.node(COSMETIC_EMOTE_INVINCIBLE_PATH).getBoolean(false); destroyLooseCosmetics = cosmeticSettings.node(COSMETIC_DESTROY_LOOSE_COSMETIC_PATH).getBoolean(false); @@ -263,6 +266,10 @@ public class Settings { return cosmeticEmoteBlockCheck; } + public static boolean getEmoteAirCheck() { + return emoteAirCheck; + } + public static boolean isEmoteDamageLeave() { return emoteDamageLeave; } diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserEmoteModel.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserEmoteModel.java index 403d5055..e7455cf7 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserEmoteModel.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/user/manager/UserEmoteModel.java @@ -67,6 +67,11 @@ public class UserEmoteModel extends PlayerModel { MessagesUtil.sendMessage(player, "emote-blocked"); return; } + // Check if block below player is an air block + if (Settings.getEmoteAirCheck() && newLocation.clone().subtract(0, 1, 0).getBlock().getType().isAir()) { + stopAnimation(); + MessagesUtil.sendMessage(player, "emote-blocked"); + } user.getPlayer().setInvisible(true); user.hideCosmetics(CosmeticUser.HiddenReason.EMOTE); diff --git a/common/src/main/resources/config.yml b/common/src/main/resources/config.yml index 6739cedf..353f3f07 100644 --- a/common/src/main/resources/config.yml +++ b/common/src/main/resources/config.yml @@ -25,6 +25,7 @@ cosmetic-settings: 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 emote-damage-leave: true # If the player should leave the emote when they take damage emote-invincible: false # If the player should not take damage while doing an emote