mirror of
https://github.com/JonasunderscoreJones/BetterSimpleConfig.git
synced 2025-10-22 20:39:19 +02:00
Initial project files
This commit is contained in:
parent
85739099de
commit
05bfbcccf4
6 changed files with 330 additions and 1 deletions
36
config/ModConfigs.java
Normal file
36
config/ModConfigs.java
Normal file
|
@ -0,0 +1,36 @@
|
|||
package net.fabric.examplemod.config;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import me.jonasjones.consolemc.ConsoleMC;
|
||||
|
||||
public class ModConfigs {
|
||||
public static SimpleConfig CONFIG;
|
||||
private static ModConfigProvider configs;
|
||||
|
||||
public static boolean IS_ENABLED;
|
||||
public static boolean REUQIRE_OP;
|
||||
public static boolean ALLOW_CMD_BLOCKS;
|
||||
|
||||
public static void registerConfigs() {
|
||||
configs = new ModConfigProvider();
|
||||
createConfigs();
|
||||
|
||||
CONFIG = SimpleConfig.of(ConsoleMC.MOD_ID + "config").provider(configs).request();
|
||||
|
||||
assignConfigs();
|
||||
}
|
||||
|
||||
private static void createConfigs() {
|
||||
configs.addKeyValuePair(new Pair<>("cmd.enable", true), "whether or not to allow chat command execution.");
|
||||
configs.addKeyValuePair(new Pair<>("cmd.requireOp", true), "whether or not operator level is required in order to run commands.");
|
||||
configs.addKeyValuePair(new Pair<>("cmd.allowCmdBlocks", false), "whether or not commands can be run through command blocks");
|
||||
}
|
||||
|
||||
private static void assignConfigs() {
|
||||
IS_ENABLED = CONFIG.getOrDefault("cmd.enable", true);
|
||||
REUQIRE_OP = CONFIG.getOrDefault("cmd.requireOp", true);
|
||||
ALLOW_CMD_BLOCKS = CONFIG.getOrDefault("cmd.allowCmdBlocks", false);
|
||||
|
||||
System.out.println("All " + configs.getConfigsList().size() + " have been set properly");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue