Added common configuration file with the following exposed values: graceEnabled, graceLength and keyRefillAir. This has not been tested in LAN.
This commit is contained in:
41
src/main/java/com/micle/loginprotection/setup/Config.java
Normal file
41
src/main/java/com/micle/loginprotection/setup/Config.java
Normal file
@ -0,0 +1,41 @@
|
||||
package com.micle.loginprotection.setup;
|
||||
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.config.ModConfig;
|
||||
|
||||
public class Config {
|
||||
public static ForgeConfigSpec COMMON_CONFIG;
|
||||
|
||||
public static ForgeConfigSpec.BooleanValue GRACE_ENABLED;
|
||||
public static ForgeConfigSpec.IntValue GRACE_LENGTH;
|
||||
|
||||
public static ForgeConfigSpec.BooleanValue KEY_REFILL_AIR;
|
||||
|
||||
public static void init() {
|
||||
initCommon();
|
||||
|
||||
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, COMMON_CONFIG);
|
||||
}
|
||||
|
||||
private static void initCommon() {
|
||||
ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder();
|
||||
|
||||
builder.comment("Grace period settings").push("grace");
|
||||
GRACE_ENABLED = builder
|
||||
.comment("Whether a player receives a grace period after becoming active or not.")
|
||||
.define("graceEnabled", true);
|
||||
GRACE_LENGTH = builder
|
||||
.comment("How long the grace period lasts for a player in seconds.")
|
||||
.defineInRange("graceLength", 10, 1, Integer.MAX_VALUE/40);
|
||||
builder.pop();
|
||||
|
||||
builder.comment("Key settings").push("key");
|
||||
KEY_REFILL_AIR = builder
|
||||
.comment("Whether a player's air supply gets refilled upon becoming active.")
|
||||
.define("keyRefillAir", true);
|
||||
builder.pop();
|
||||
|
||||
COMMON_CONFIG = builder.build();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user