codechicken.lib.config.ConfigFile Java Examples

The following examples show how to use codechicken.lib.config.ConfigFile. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NEIServerConfig.java    From NotEnoughItems with MIT License 6 votes vote down vote up
private static void loadConfig() {
    File file = new File(saveDir, "server.cfg");
    serverConfig = new ConfigFile(file);

    serverConfig.setNewLineMode(1);
    serverConfig.getTag("permissions").useBraces();
    serverConfig.getTag("permissions").setComment("List of players who can use these features.\nEg. time=CodeChicken, Friend1");

    setDefaultFeature("time");
    setDefaultFeature("rain");
    setDefaultFeature("heal");
    setDefaultFeature("magnet");
    setDefaultFeature("creative");
    setDefaultFeature("creative+");
    setDefaultFeature("adventure");
    setDefaultFeature("enchant");
    setDefaultFeature("potion");
    setDefaultFeature("save-state");
    setDefaultFeature("item");
    setDefaultFeature("delete");
    setDefaultFeature("notify-item", "CONSOLE, OP");
}
 
Example #2
Source File: NEIServerConfig.java    From NotEnoughItems with MIT License 6 votes vote down vote up
private static void loadConfig() {
    File file = new File(saveDir, "server.cfg");
    serverConfig = new ConfigFile(file);

    serverConfig.setNewLineMode(1);
    serverConfig.getTag("permissions").useBraces();
    serverConfig.getTag("permissions").setComment("List of players who can use these features.\nEg. time=CodeChicken, Friend1");

    setDefaultFeature("time");
    setDefaultFeature("rain");
    setDefaultFeature("heal");
    setDefaultFeature("magnet");
    setDefaultFeature("creative");
    setDefaultFeature("creative+");
    setDefaultFeature("adventure");
    setDefaultFeature("enchant");
    setDefaultFeature("potion");
    setDefaultFeature("save-state");
    setDefaultFeature("item");
    setDefaultFeature("delete");
    setDefaultFeature("notify-item", "CONSOLE, OP");
}
 
Example #3
Source File: NEIClientConfig.java    From NotEnoughItems with MIT License 5 votes vote down vote up
public static void loadWorld(String saveName) {
    setInternalEnabled(true);
    LogHelper.debug("Loading " + (Minecraft.getMinecraft().isSingleplayer() ? "Local" : "Remote") + " World");
    //ItemMobSpawner.loadSpawners(ClientUtils.getWorld());

    File saveDir = new File(CommonUtils.getMinecraftDir(), "saves/NEI/" + saveName);
    boolean newWorld = !saveDir.exists();
    if (newWorld) {
        saveDir.mkdirs();
    }

    world = new ConfigSet(new File(saveDir, "NEI.dat"), new ConfigFile(new File(saveDir, "NEI.cfg")));
    onWorldLoad(newWorld);
}
 
Example #4
Source File: ChunkLoaderManager.java    From ChickenChunks with MIT License 5 votes vote down vote up
public static void initConfig(ConfigFile config) {
    config.getTag("players").setPosition(0).useBraces().setComment("Per player chunk limiting. Values ignored if 0.:Simply add <username>=<value>");
    config.getTag("players.DEFAULT").setComment("Forge gives everyone 12500 by default").getIntValue(5000);
    config.getTag("players.OP").setComment("For server op's only.").getIntValue(5000);
    config.getTag("allowoffline").setPosition(1).useBraces().setComment("If set to false, players will have to be logged in for their chunkloaders to work.:Simply add <username>=<true|false>");
    config.getTag("allowoffline.DEFAULT").getBooleanValue(true);
    config.getTag("allowoffline.OP").getBooleanValue(true);
    config.getTag("allowchunkviewer").setPosition(2).useBraces().setComment("Set to false to deny a player access to the chunk viewer");
    config.getTag("allowchunkviewer.DEFAULT").getBooleanValue(true);
    config.getTag("allowchunkviewer.OP").getBooleanValue(true);
    if (!FMLCommonHandler.instance().getModName().contains("mcpc"))
        cleanupTicks = config.getTag("cleanuptime")
                .setComment("The number of ticks to wait between attempting to unload orphaned chunks")
                .getIntValue(1200);
    reloadDimensions = config.getTag("reload-dimensions")
            .setComment("Set to false to disable the automatic reloading of mystcraft dimensions on server restart")
            .getBooleanValue(true);
    opInteract = config.getTag("op-interact")
            .setComment("Enabling this lets OPs alter other player's chunkloaders. WARNING: If you change a chunkloader, you have no idea what may break/explode by not being chunkloaded.")
            .getBooleanValue(false);
    maxChunks = config.getTag("maxchunks")
            .setComment("The maximum number of chunks per chunkloader")
            .getIntValue(400);
    awayTimeout = config.getTag("awayTimeout")
            .setComment("The number of minutes since last login within which chunks from a player will remain active, 0 for infinite.")
            .getIntValue(0);
}
 
Example #5
Source File: NEIClientConfig.java    From NotEnoughItems with MIT License 5 votes vote down vote up
public static void loadWorld(String saveName) {
    setInternalEnabled(true);
    logger.debug("Loading "+(Minecraft.getMinecraft().isSingleplayer() ? "Local" : "Remote")+" World");
    bootNEI(ClientUtils.getWorld());

    File saveDir = new File(CommonUtils.getMinecraftDir(), "saves/NEI/" + saveName);
    boolean newWorld = !saveDir.exists();
    if (newWorld)
        saveDir.mkdirs();

    world = new ConfigSet(new File(saveDir, "NEI.dat"), new ConfigFile(new File(saveDir, "NEI.cfg")));
    onWorldLoad(newWorld);
}
 
Example #6
Source File: ASMHelper.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static ConfigFile loadConfig() {
    try {//weak reference for environments without FML
        File mcDir = (File)((Object[])Class.forName("net.minecraftforge.fml.relauncher.FMLInjectionData").getMethod("data").invoke(null))[6];
        File file = new File(mcDir, "config/CodeChickenLib.cfg");
        if(ObfMapping.obfuscated)
            return new DefaultingConfigFile(file);
        else
            return new ConfigFile(file).setComment("CodeChickenLib development configuration file.");
    } catch (Exception ignored) {
        return null;//no config for these systems
    }
}
 
Example #7
Source File: EnderStorageManager.java    From EnderStorage with MIT License 4 votes vote down vote up
public static void loadConfig(ConfigFile config2) {
    config = config2;
    for (Entry<String, EnderStoragePlugin> plugin : plugins.entrySet())
        plugin.getValue().loadConfig(config.getTag(plugin.getKey()));
}
 
Example #8
Source File: EnderStorage.java    From EnderStorage with MIT License 4 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
    config = new ConfigFile(new File(CommonUtils.getMinecraftDir() + "/config", "EnderStorage.cfg")).setComment("EnderStorage Configuration File\nDeleting any element will restore it to it's default value\nBlock ID's will be automatically generated the first time it's run");

    proxy.preInit();
}
 
Example #9
Source File: ChickenChunks.java    From ChickenChunks with MIT License 4 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
    config = new ConfigFile(new File(event.getModConfigurationDirectory(), "ChickenChunks.cfg"))
            .setComment("ChunkLoader Configuration File\nDeleting any element will restore it to it's default value\nBlock ID's will be automatically generated the first time it's run");
}
 
Example #10
Source File: CodeChickenCoreModContainer.java    From CodeChickenCore with MIT License 4 votes vote down vote up
public static void loadConfig() {
    if(config == null)
        config = new ConfigFile(new File(CodeChickenCorePlugin.minecraftDir, "config/CodeChickenCore.cfg")).setComment("CodeChickenCore configuration file.");
}
 
Example #11
Source File: Translocator.java    From Translocators with MIT License 4 votes vote down vote up
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
    config = new ConfigFile(new File(CommonUtils.getMinecraftDir() + "/config", "Translocator.cfg")).setComment("Translocator Configuration File\nDeleting any element will restore it to it's default value\nBlock ID's will be automatically generated the first time it's run");
}
 
Example #12
Source File: SaveManager.java    From WirelessRedstone with MIT License 4 votes vote down vote up
public static ConfigFile config()
{
    return globalconfig;
}