9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-28 11:29:18 +00:00

feat: Improvements to emote block checking

This commit is contained in:
LoJoSho
2023-03-11 20:48:09 -06:00
parent a907cd51b9
commit 17abd0c8cc
3 changed files with 10 additions and 1 deletions

View File

@@ -35,6 +35,7 @@ public class Settings {
private static final String HOOK_SETTING_PATH = "hook-settings";
private static final String HOOK_ITEMADDER_PATH = "itemsadder";
private static final String HOOK_RELOAD_CHANGE_PATH = "reload-on-change";
private static final String COSMETIC_EMOTE_CHECK_PATH = "emote-block-check";
private static String defaultMenu;
private static String dyeMenuName;
@@ -50,6 +51,7 @@ public class Settings {
private static boolean unapplyOnDeath;
private static boolean forcePermissionJoin;
private static boolean itemsAdderChangeReload;
private static boolean cosmeticEmoteBlockCheck;
private static int lookDownPitch;
private static int viewDistance;
private static int tickPeriod;
@@ -81,6 +83,7 @@ public class Settings {
unapplyOnDeath = cosmeticSettings.node(UNAPPLY_DEATH_PATH).getBoolean(false);
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);
tickPeriod = cosmeticSettings.node(TICK_PERIOD_PATH).getInt(-1);
lookDownPitch = cosmeticSettings.node(LOOK_DOWN_PITCH_PATH).getInt();
@@ -219,6 +222,11 @@ public class Settings {
public static double getEmoteDistance() {
return emoteDistance;
}
public static boolean getCosmeticEmoteBlockCheck() {
return cosmeticEmoteBlockCheck;
}
public static void setDebugMode(boolean newSetting) {
debugMode = newSetting;

View File

@@ -57,7 +57,7 @@ public class UserEmoteModel extends PlayerModel {
double DISTANCE = Settings.getEmoteDistance();
Location thirdPersonLocation = newLocation.add(newLocation.getDirection().normalize().multiply(DISTANCE));
if (thirdPersonLocation.getBlock().getType() != Material.AIR) {
if (Settings.getCosmeticEmoteBlockCheck() && thirdPersonLocation.getBlock().getType().isOccluding()) {
stopAnimation();
MessagesUtil.sendMessage(player, "emote-blocked");
return;

View File

@@ -24,6 +24,7 @@ cosmetic-settings:
force-permission-join: true # Checks a player permission if they can have a cosmetic when they join the server.
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 (prevents players viewing through blocks)
# view distance in blocks that other players will see the backpack cosmetic
# setting this to lower than the server player view distance should fix the