Skip to content

Commit

Permalink
Added function to force-reload a config.
Browse files Browse the repository at this point in the history
  • Loading branch information
RedstoneParadox committed Nov 14, 2019
1 parent 91e153d commit ff531d2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/java/redstoneparadox/paradoxconfig/ParadoxConfig.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package redstoneparadox.paradoxconfig

import net.fabricmc.loader.api.FabricLoader
import net.minecraft.util.Identifier
import org.apache.logging.log4j.LogManager
import redstoneparadox.paradoxconfig.conditions.registerConditions
import redstoneparadox.paradoxconfig.config.RootConfigCategory
Expand All @@ -25,6 +26,18 @@ fun init() {
}
}

/**
* Reloads the specified config file.
*
* @param id The identifier (mod id + path) of the config.
*/
fun forceReloadConfig(id: Identifier) {
val config = CONFIGS[id.toString()]
if (config != null) {
loadConfig(config, id.namespace)
}
}

internal fun getConfigData(): Collection<ConfigData> {
val data = arrayListOf<ConfigData>();

Expand Down

0 comments on commit ff531d2

Please sign in to comment.