diff --git a/src/main/java/dev/micle/loginprotection/setup/Config.java b/src/main/java/dev/micle/loginprotection/setup/Config.java index d4cb02e..6d1f8b1 100644 --- a/src/main/java/dev/micle/loginprotection/setup/Config.java +++ b/src/main/java/dev/micle/loginprotection/setup/Config.java @@ -25,9 +25,6 @@ public final class Config { } public static class Server { - public static ForgeConfigSpec.BooleanValue POST_GRACE_ENABLED; - public static ForgeConfigSpec.BooleanValue POST_GRACE_IGNORE_PLAYER_ENABLED; - public static ForgeConfigSpec.IntValue POST_GRACE_DURATION; public static ForgeConfigSpec.BooleanValue POST_REFILL_AIR_ENABLED; public static ForgeConfigSpec.BooleanValue POST_WATER_ENABLED; public static ForgeConfigSpec.IntValue POST_WATER_DURATION; @@ -36,21 +33,31 @@ public final class Config { public static ForgeConfigSpec.BooleanValue POST_FIRE_ENABLED; public static ForgeConfigSpec.IntValue POST_FIRE_DURATION; - public static ForgeConfigSpec.BooleanValue LOGIN_IGNORE_PLAYER_ENABLED; + public static ForgeConfigSpec.BooleanValue LOGIN_MOBS_IGNORE_PLAYER; + public static ForgeConfigSpec.BooleanValue LOGIN_APPLY_POST_EFFECTS; public static ForgeConfigSpec.ConfigValue> LOGIN_KEY_ALLOW_LIST; + public static ForgeConfigSpec.BooleanValue LOGIN_GRACE_ENABLED; + public static ForgeConfigSpec.BooleanValue LOGIN_GRACE_MOBS_IGNORE_PLAYER; + public static ForgeConfigSpec.IntValue LOGIN_GRACE_DURATION; public static ForgeConfigSpec.BooleanValue AFK_PROTECTION_ENABLED; public static ForgeConfigSpec.IntValue AFK_TIME_THRESHOLD; public static ForgeConfigSpec.BooleanValue AFK_APPLY_POST_EFFECTS; - public static ForgeConfigSpec.BooleanValue AFK_IGNORE_PLAYER_ENABLED; + public static ForgeConfigSpec.BooleanValue AFK_MOBS_IGNORE_PLAYER; public static ForgeConfigSpec.ConfigValue> AFK_KEY_ALLOW_LIST; + public static ForgeConfigSpec.BooleanValue AFK_GRACE_ENABLED; + public static ForgeConfigSpec.BooleanValue AFK_GRACE_MOBS_IGNORE_PLAYER; + public static ForgeConfigSpec.IntValue AFK_GRACE_DURATION; Server(ForgeConfigSpec.Builder builder) { - builder.comment("Settings for protecting players while they are joining.").push("login"); - LOGIN_IGNORE_PLAYER_ENABLED = builder + builder.comment("Settings for protecting players while they are joining.").push("Login"); + LOGIN_APPLY_POST_EFFECTS = builder + .comment("Whether to apply any post protection effects to joining players.") + .define("applyPostProtectionEffects", true); + LOGIN_MOBS_IGNORE_PLAYER = builder .comment("Whether mobs will ignore a protected player. (They will not attack/aggro)") .define("mobsIgnorePlayer", true); - builder.push("allowed_keys"); + builder.push("AllowedKeys"); LOGIN_KEY_ALLOW_LIST = builder .comment("Allowed keys players can press without becoming active.\n" + "Available values: PAUSE, DEBUG, FULLSCREEN, PERSPECTIVE, SMOOTH_CAMERA, SCREENSHOT, SPECTATOR_OUTLINES,\n" + @@ -60,9 +67,20 @@ public final class Config { KEYS.SCREENSHOT.toString(), KEYS.SPECTATOR_OUTLINES.toString(), KEYS.ADVANCEMENTS.toString(), KEYS.PLAYER_LIST.toString(), KEYS.CHAT.toString(), KEYS.SOCIAL_INTERACTIONS.toString(), KEYS.LOAD_HOTBAR_ACTIVATOR.toString(), KEYS.SAVE_HOTBAR_ACTIVATOR.toString(), KEYS.SWAP_ITEM.toString(), KEYS.HOTBAR.toString(), KEYS.PICK_BLOCK.toString()), o -> o instanceof String); builder.pop(); + builder.push("Grace"); + LOGIN_GRACE_ENABLED = builder + .comment("Whether a player receives a grace period after becoming active or not.") + .define("graceEnabled", true); + LOGIN_GRACE_MOBS_IGNORE_PLAYER = builder + .comment("Whether mobs ignore the player during their grace period.") + .define("graceMobsIgnorePlayer", true); + LOGIN_GRACE_DURATION = builder + .comment("How long the grace period lasts in seconds.") + .defineInRange("graceDuration", 10, 1, Integer.MAX_VALUE); + builder.pop(); builder.pop(); - builder.comment("Settings for protecting players that are afk.").push("afk"); + builder.comment("Settings for protecting players that are afk.").push("AFK"); AFK_PROTECTION_ENABLED = builder .comment("Enable protection of afk players?") .define("enabled", true); @@ -72,10 +90,10 @@ public final class Config { AFK_APPLY_POST_EFFECTS = builder .comment("Whether to apply any post protection effects to afk players.") .define("applyPostProtectionEffects", false); - AFK_IGNORE_PLAYER_ENABLED = builder + AFK_MOBS_IGNORE_PLAYER = builder .comment("Whether mobs will ignore a protected player. (They will not attack/aggro") .define("mobsIgnorePlayerEnabled", true); - builder.push("allowed_keys"); + builder.push("AllowedKeys"); AFK_KEY_ALLOW_LIST = builder .comment("Allowed keys players can press without becoming active.\n" + "Available values: PAUSE, DEBUG, FULLSCREEN, PERSPECTIVE, SMOOTH_CAMERA, SCREENSHOT, SPECTATOR_OUTLINES,\n" + @@ -83,21 +101,21 @@ public final class Config { "SWAP_ITEM, INVENTORY, HOTBAR, DROP_ITEM, USE_ITEM, PICK_BLOCK, ATTACK, MOVE, SNEAK, JUMP") .defineList("allowedKeys", Lists.newArrayList(KEYS.PAUSE.toString(), KEYS.FULLSCREEN.toString(), KEYS.SCREENSHOT.toString(), KEYS.ADVANCEMENTS.toString()), o -> o instanceof String); builder.pop(); + builder.push("Grace"); + AFK_GRACE_ENABLED = builder + .comment("Whether a player receives a grace period after becoming active or not.") + .define("graceEnabled", false); + AFK_GRACE_MOBS_IGNORE_PLAYER = builder + .comment("Whether mobs ignore the player during their grace period.") + .define("graceMobsIgnorePlayer", true); + AFK_GRACE_DURATION = builder + .comment("How long the grace period lasts in seconds.") + .defineInRange("graceDuration", 5, 1, Integer.MAX_VALUE); + builder.pop(); builder.pop(); - builder.comment("Additional protection settings that apply as soon as a player becomes active.").push("post"); - builder.push("grace_period"); - POST_GRACE_ENABLED = builder - .comment("Whether a player receives a grace period after becoming active or not.") - .define("enabled", false); - POST_GRACE_DURATION = builder - .comment("Grace period duration in seconds.") - .defineInRange("duration", 10, 1, Integer.MAX_VALUE); - POST_GRACE_IGNORE_PLAYER_ENABLED = builder - .comment("Whether mobs will ignore a player during their grace period.") - .define("mobsIgnorePlayer", false); - builder.pop(); - builder.push("water_protection"); + builder.comment("Additional protection settings that apply as soon as a player becomes active if enabled.").push("Post"); + builder.push("WaterProtection"); POST_REFILL_AIR_ENABLED = builder .comment("Whether a player's air supply gets refilled.") .define("refillAir", true); @@ -108,7 +126,7 @@ public final class Config { .comment("Water breathing duration in seconds.") .defineInRange("waterDuration", 10, 1, Integer.MAX_VALUE/20); builder.pop(); - builder.push("lava_protection"); + builder.push("LavaProtection"); POST_LAVA_ENABLED = builder .comment("Whether a player receives fire resistance when in lava.") .define("enabled", true); @@ -116,7 +134,7 @@ public final class Config { .comment("Fire resistance duration in seconds.") .defineInRange("duration", 10, 1, Integer.MAX_VALUE/20); builder.pop(); - builder.push("fire_protection"); + builder.push("FireProtection"); POST_FIRE_ENABLED = builder .comment("Whether a player receives fire resistance when on fire.") .define("enabled", false);