Updated implementation of Config.java. Fixed issue where server would create infinite amounts of backup files for the config file; this was caused by checking if the allowedKeys list values were of type KEYS instead of String.

This commit is contained in:
2021-09-30 23:01:58 +01:00
parent e7346e53d9
commit 6d244db8ea
6 changed files with 144 additions and 138 deletions

View File

@ -11,7 +11,7 @@ public class ProtectedPlayer {
public ProtectedPlayer(UUID player_uuid) {
this.player_uuid = player_uuid;
this.grace_period = (Config.POST_GRACE_DURATION.get() * 40);
this.grace_period = (Config.Server.POST_GRACE_DURATION.get() * 40);
this.is_loading = true;
}

View File

@ -41,7 +41,7 @@ public class ProtectedPlayers {
ServerPlayerEntity player = ServerLifecycleHooks.getCurrentServer().getPlayerList().getPlayer(player_uuid);
if (player == null) { return; }
if (!Config.POST_GRACE_ENABLED.get()) { return; }
if (!Config.Server.POST_GRACE_ENABLED.get()) { return; }
player.sendMessage(new StringTextComponent("[LoginProtection] Grace period ended!"), player_uuid);
}

View File

@ -44,42 +44,42 @@ public class OnKeyPressEventHandler {
private static boolean checkKeyAllowed(Minecraft instance, int key) {
boolean isAllowed = false;
if (key == GLFW.GLFW_KEY_ESCAPE) { isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.PAUSE); }
if (key == GLFW.GLFW_KEY_F3) { isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.DEBUG); }
if (key == instance.options.keyFullscreen.getKey().getValue()) { isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.FULLSCREEN); }
if (key == instance.options.keyTogglePerspective.getKey().getValue()) { isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.PERSPECTIVE); }
if (key == instance.options.keySmoothCamera.getKey().getValue()) { isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.SMOOTH_CAMERA); }
if (key == instance.options.keyScreenshot.getKey().getValue()) { isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.SCREENSHOT); }
if (key == instance.options.keySpectatorOutlines.getKey().getValue()) { isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.SPECTATOR_OUTLINES); }
if (key == instance.options.keyAdvancements.getKey().getValue()) { isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.ADVANCEMENTS); }
if (key == instance.options.keyPlayerList.getKey().getValue()) { isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.PLAYER_LIST); }
if (key == GLFW.GLFW_KEY_ESCAPE) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.PAUSE); }
if (key == GLFW.GLFW_KEY_F3) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.DEBUG); }
if (key == instance.options.keyFullscreen.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.FULLSCREEN); }
if (key == instance.options.keyTogglePerspective.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.PERSPECTIVE); }
if (key == instance.options.keySmoothCamera.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.SMOOTH_CAMERA); }
if (key == instance.options.keyScreenshot.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.SCREENSHOT); }
if (key == instance.options.keySpectatorOutlines.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.SPECTATOR_OUTLINES); }
if (key == instance.options.keyAdvancements.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.ADVANCEMENTS); }
if (key == instance.options.keyPlayerList.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.PLAYER_LIST); }
if (key == instance.options.keyChat.getKey().getValue() ||
key == instance.options.keyCommand.getKey().getValue() ||
key == GLFW.GLFW_KEY_ENTER) {
isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.CHAT);
isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.CHAT);
}
if (key == instance.options.keySocialInteractions.getKey().getValue()) { isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.SOCIAL_INTERACTIONS); }
if (key == instance.options.keyLoadHotbarActivator.getKey().getValue()) { isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.LOAD_HOTBAR_ACTIVATOR); }
if (key == instance.options.keySaveHotbarActivator.getKey().getValue()) { isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.SAVE_HOTBAR_ACTIVATOR); }
if (key == instance.options.keySwapOffhand.getKey().getValue()) { isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.SWAP_ITEM); }
if (key == instance.options.keyInventory.getKey().getValue()) { isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.INVENTORY); }
if (key == instance.options.keySocialInteractions.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.SOCIAL_INTERACTIONS); }
if (key == instance.options.keyLoadHotbarActivator.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.LOAD_HOTBAR_ACTIVATOR); }
if (key == instance.options.keySaveHotbarActivator.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.SAVE_HOTBAR_ACTIVATOR); }
if (key == instance.options.keySwapOffhand.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.SWAP_ITEM); }
if (key == instance.options.keyInventory.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.INVENTORY); }
for (int i = 0; i < instance.options.keyHotbarSlots.length; i++) {
if (key == instance.options.keyHotbarSlots[i].getKey().getValue()) { isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.HOTBAR); }
if (key == instance.options.keyHotbarSlots[i].getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.HOTBAR); }
}
if (key == instance.options.keyDrop.getKey().getValue()) { isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.DROP_ITEM); }
if (key == instance.options.keyUse.getKey().getValue()) { isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.USE_ITEM); }
if (key == instance.options.keyPickItem.getKey().getValue()) { isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.PICK_BLOCK); }
if (key == instance.options.keyAttack.getKey().getValue()) { isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.ATTACK); }
if (key == instance.options.keyDrop.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.DROP_ITEM); }
if (key == instance.options.keyUse.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.USE_ITEM); }
if (key == instance.options.keyPickItem.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.PICK_BLOCK); }
if (key == instance.options.keyAttack.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.ATTACK); }
if (key == instance.options.keyUp.getKey().getValue() ||
key == instance.options.keyRight.getKey().getValue() ||
key == instance.options.keyDown.getKey().getValue() ||
key == instance.options.keyLeft.getKey().getValue() ||
key == instance.options.keySprint.getKey().getValue()) {
isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.MOVE);
isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.MOVE);
}
if (key == instance.options.keyShift.getKey().getValue()) { isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.SNEAK); }
if (key == instance.options.keyJump.getKey().getValue()) { isAllowed = Config.MAIN_KEY_ALLOW_LIST.get().contains(Config.KEYS.JUMP); }
if (key == instance.options.keyShift.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.SNEAK); }
if (key == instance.options.keyJump.getKey().getValue()) { isAllowed = Config.Server.MAIN_KEY_ALLOW_LIST.get().contains(Config.Server.KEYS.JUMP); }
return isAllowed;
}

View File

@ -16,8 +16,8 @@ public class OnLivingSetAttackTargetEventHandler {
ProtectedPlayer player = LoginProtection.protected_players.getPlayer(target.getUUID());
if (player == null) { return; }
if (player.isLoading() && !Config.MAIN_IGNORE_PLAYER_ENABLED.get()) { return; }
if (!player.isLoading() && !Config.POST_GRACE_IGNORE_PLAYER_ENABLED.get()) { return; }
if (player.isLoading() && !Config.Server.MAIN_IGNORE_PLAYER_ENABLED.get()) { return; }
if (!player.isLoading() && !Config.Server.POST_GRACE_IGNORE_PLAYER_ENABLED.get()) { return; }
((MobEntity) event.getEntityLiving()).setTarget(null);
}
}

View File

@ -28,7 +28,7 @@ public class C2SKeyPress {
if (LoginProtection.protected_players.getPlayer(sender.getUUID()) == null) { return; }
if (!LoginProtection.protected_players.getPlayer(sender.getUUID()).isLoading()) { return; }
if (!Config.POST_GRACE_ENABLED.get()) {
if (!Config.Server.POST_GRACE_ENABLED.get()) {
LoginProtection.protected_players.removePlayer(sender.getUUID());
sender.sendMessage(new StringTextComponent("[LoginProtection] You are now seen as active."), sender.getUUID());
} else {
@ -36,18 +36,18 @@ public class C2SKeyPress {
sender.sendMessage(new StringTextComponent("[LoginProtection] Grace period started!"), sender.getUUID());
}
if (sender.isInWater()) {
if (Config.POST_DROWN_ENABLED.get()) {
if (Config.Server.POST_DROWN_ENABLED.get()) {
sender.setAirSupply(sender.getMaxAirSupply());
}
if (Config.POST_WATER_ENABLED.get()) {
sender.addEffect(new EffectInstance(Effects.WATER_BREATHING, Config.POST_WATER_DURATION.get()*20, 0));
if (Config.Server.POST_WATER_ENABLED.get()) {
sender.addEffect(new EffectInstance(Effects.WATER_BREATHING, Config.Server.POST_WATER_DURATION.get()*20, 0));
}
}
if (sender.isInLava() && Config.POST_LAVA_ENABLED.get()) {
sender.addEffect(new EffectInstance(Effects.FIRE_RESISTANCE, Config.POST_LAVA_DURATION.get()*20, 0));
if (sender.isInLava() && Config.Server.POST_LAVA_ENABLED.get()) {
sender.addEffect(new EffectInstance(Effects.FIRE_RESISTANCE, Config.Server.POST_LAVA_DURATION.get()*20, 0));
}
if (sender.isOnFire() && Config.POST_FIRE_ENABLED.get()) {
sender.addEffect(new EffectInstance(Effects.FIRE_RESISTANCE, Config.POST_FIRE_DURATION.get()*20, 0));
if (sender.isOnFire() && Config.Server.POST_FIRE_ENABLED.get()) {
sender.addEffect(new EffectInstance(Effects.FIRE_RESISTANCE, Config.Server.POST_FIRE_DURATION.get()*20, 0));
}
});
context.setPacketHandled(true);

View File

@ -1,121 +1,127 @@
package com.micle.loginprotection.setup;
import com.google.common.collect.Lists;
import com.micle.loginprotection.LoginProtection;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig;
import org.apache.commons.lang3.tuple.Pair;
import java.util.List;
public class Config {
public enum KEYS {
PAUSE,
DEBUG,
FULLSCREEN,
PERSPECTIVE,
SMOOTH_CAMERA,
SCREENSHOT,
SPECTATOR_OUTLINES,
ADVANCEMENTS,
PLAYER_LIST,
CHAT,
SOCIAL_INTERACTIONS,
LOAD_HOTBAR_ACTIVATOR,
SAVE_HOTBAR_ACTIVATOR,
SWAP_ITEM,
INVENTORY,
HOTBAR,
DROP_ITEM,
USE_ITEM,
PICK_BLOCK,
ATTACK,
MOVE,
SNEAK,
JUMP
@Mod.EventBusSubscriber(modid = LoginProtection.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public final class Config {
public static final Server SERVER;
public static final ForgeConfigSpec SERVER_SPEC;
static {
Pair<Server, ForgeConfigSpec> spec_pair = new ForgeConfigSpec.Builder().configure(Server::new);
SERVER = spec_pair.getLeft();
SERVER_SPEC = spec_pair.getRight();
}
public static ForgeConfigSpec SERVER_CONFIG;
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_DROWN_ENABLED;
public static ForgeConfigSpec.BooleanValue POST_WATER_ENABLED;
public static ForgeConfigSpec.IntValue POST_WATER_DURATION;
public static ForgeConfigSpec.BooleanValue POST_LAVA_ENABLED;
public static ForgeConfigSpec.IntValue POST_LAVA_DURATION;
public static ForgeConfigSpec.BooleanValue POST_FIRE_ENABLED;
public static ForgeConfigSpec.IntValue POST_FIRE_DURATION;
public static ForgeConfigSpec.BooleanValue MAIN_IGNORE_PLAYER_ENABLED;
public static ForgeConfigSpec.ConfigValue<List<? extends KEYS>> MAIN_KEY_ALLOW_LIST;
public static void init() {
initServer();
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, SERVER_CONFIG);
ModLoadingContext.get().registerConfig(ModConfig.Type.SERVER, SERVER_SPEC);
}
private static void initServer() {
ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder();
public static class Server {
public enum KEYS {
PAUSE,
DEBUG,
FULLSCREEN,
PERSPECTIVE,
SMOOTH_CAMERA,
SCREENSHOT,
SPECTATOR_OUTLINES,
ADVANCEMENTS,
PLAYER_LIST,
CHAT,
SOCIAL_INTERACTIONS,
LOAD_HOTBAR_ACTIVATOR,
SAVE_HOTBAR_ACTIVATOR,
SWAP_ITEM,
INVENTORY,
HOTBAR,
DROP_ITEM,
USE_ITEM,
PICK_BLOCK,
ATTACK,
MOVE,
SNEAK,
JUMP
}
builder.comment("Main protection settings for protecting inactive (loading) players.").push("main");
MAIN_IGNORE_PLAYER_ENABLED = builder
.comment("Whether mobs will ignore a protected player. (They will not attack/aggro)")
.define("ignorePlayerEnabled", true);
builder.push("allow_keys");
MAIN_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" +
"ADVANCEMENTS, PLAYER_LIST, CHAT, SOCIAL_INTERACTIONS, LOAD_HOTBAR_ACTIVATOR, SAVE_HOTBAR_ACTIVATOR,\n" +
"SWAP_ITEM, INVENTORY, HOTBAR, DROP_ITEM, USE_ITEM, PICK_BLOCK, ATTACK, MOVE, SNEAK, JUMP")
.defineList("allowedKeys", Lists.newArrayList(KEYS.PAUSE, KEYS.DEBUG, KEYS.FULLSCREEN, KEYS.PERSPECTIVE, KEYS.SMOOTH_CAMERA,
KEYS.SCREENSHOT, KEYS.SPECTATOR_OUTLINES, KEYS.ADVANCEMENTS, KEYS.PLAYER_LIST, KEYS.CHAT, KEYS.SOCIAL_INTERACTIONS,
KEYS.LOAD_HOTBAR_ACTIVATOR, KEYS.SAVE_HOTBAR_ACTIVATOR, KEYS.SWAP_ITEM, KEYS.HOTBAR, KEYS.PICK_BLOCK), o -> o instanceof KEYS);
builder.pop();
builder.pop();
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_DROWN_ENABLED;
public static ForgeConfigSpec.BooleanValue POST_WATER_ENABLED;
public static ForgeConfigSpec.IntValue POST_WATER_DURATION;
public static ForgeConfigSpec.BooleanValue POST_LAVA_ENABLED;
public static ForgeConfigSpec.IntValue POST_LAVA_DURATION;
public static ForgeConfigSpec.BooleanValue POST_FIRE_ENABLED;
public static ForgeConfigSpec.IntValue POST_FIRE_DURATION;
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("graceEnabled", false);
POST_GRACE_DURATION = builder
.comment("Grace period duration in seconds.")
.defineInRange("graceDuration", 10, 1, Integer.MAX_VALUE/40);
POST_GRACE_IGNORE_PLAYER_ENABLED = builder
.comment("Whether mobs will ignore a player during their grace period.")
.define("graceIgnorePlayerEnabled", false);
builder.pop();
builder.push("water_protection");
POST_DROWN_ENABLED = builder
.comment("Whether a player's air supply gets refilled.")
.define("drownEnabled", true);
POST_WATER_ENABLED = builder
.comment("Whether a player receives water breating when in water.")
.define("waterEnabled", false);
POST_WATER_DURATION = builder
.comment("Water breathing duration in seconds.")
.defineInRange("waterDuration", 10, 1, Integer.MAX_VALUE/20);
builder.pop();
builder.push("lava_protection");
POST_LAVA_ENABLED = builder
.comment("Whether a player receives fire resistance when in lava.")
.define("lavaEnabled", true);
POST_LAVA_DURATION = builder
.comment("Fire resistance duration in seconds.")
.defineInRange("lavaDuration", 10, 1, Integer.MAX_VALUE/20);
builder.pop();
builder.push("fire_protection");
POST_FIRE_ENABLED = builder
.comment("Whether a player receives fire resistance when on fire.")
.define("fireEnabled", false);
POST_FIRE_DURATION = builder
.comment("Fire resistance duration in seconds.")
.defineInRange("fireDuration", 10, 1, Integer.MAX_VALUE/20);
builder.pop();
builder.pop();
public static ForgeConfigSpec.BooleanValue MAIN_IGNORE_PLAYER_ENABLED;
public static ForgeConfigSpec.ConfigValue<List<? extends KEYS>> MAIN_KEY_ALLOW_LIST;
SERVER_CONFIG = builder.build();
Server(ForgeConfigSpec.Builder builder) {
builder.comment("Main protection settings for protecting inactive (loading) players.").push("main");
MAIN_IGNORE_PLAYER_ENABLED = builder
.comment("Whether mobs will ignore a protected player. (They will not attack/aggro)")
.define("ignorePlayerEnabled", true);
builder.push("allow_keys");
MAIN_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" +
"ADVANCEMENTS, PLAYER_LIST, CHAT, SOCIAL_INTERACTIONS, LOAD_HOTBAR_ACTIVATOR, SAVE_HOTBAR_ACTIVATOR,\n" +
"SWAP_ITEM, INVENTORY, HOTBAR, DROP_ITEM, USE_ITEM, PICK_BLOCK, ATTACK, MOVE, SNEAK, JUMP")
.defineList("allowedKeys", Lists.newArrayList(KEYS.PAUSE, KEYS.DEBUG, KEYS.FULLSCREEN, KEYS.PERSPECTIVE, KEYS.SMOOTH_CAMERA,
KEYS.SCREENSHOT, KEYS.SPECTATOR_OUTLINES, KEYS.ADVANCEMENTS, KEYS.PLAYER_LIST, KEYS.CHAT, KEYS.SOCIAL_INTERACTIONS,
KEYS.LOAD_HOTBAR_ACTIVATOR, KEYS.SAVE_HOTBAR_ACTIVATOR, KEYS.SWAP_ITEM, KEYS.HOTBAR, KEYS.PICK_BLOCK), o -> o instanceof String);
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("graceEnabled", false);
POST_GRACE_DURATION = builder
.comment("Grace period duration in seconds.")
.defineInRange("graceDuration", 10, 1, Integer.MAX_VALUE/40);
POST_GRACE_IGNORE_PLAYER_ENABLED = builder
.comment("Whether mobs will ignore a player during their grace period.")
.define("graceIgnorePlayerEnabled", false);
builder.pop();
builder.push("water_protection");
POST_DROWN_ENABLED = builder
.comment("Whether a player's air supply gets refilled.")
.define("drownEnabled", true);
POST_WATER_ENABLED = builder
.comment("Whether a player receives water breating when in water.")
.define("waterEnabled", false);
POST_WATER_DURATION = builder
.comment("Water breathing duration in seconds.")
.defineInRange("waterDuration", 10, 1, Integer.MAX_VALUE/20);
builder.pop();
builder.push("lava_protection");
POST_LAVA_ENABLED = builder
.comment("Whether a player receives fire resistance when in lava.")
.define("lavaEnabled", true);
POST_LAVA_DURATION = builder
.comment("Fire resistance duration in seconds.")
.defineInRange("lavaDuration", 10, 1, Integer.MAX_VALUE/20);
builder.pop();
builder.push("fire_protection");
POST_FIRE_ENABLED = builder
.comment("Whether a player receives fire resistance when on fire.")
.define("fireEnabled", false);
POST_FIRE_DURATION = builder
.comment("Fire resistance duration in seconds.")
.defineInRange("fireDuration", 10, 1, Integer.MAX_VALUE/20);
builder.pop();
builder.pop();
}
}
}