Documentation is a work in progress — some pages may be incomplete.
Unify

Config

YAML configuration with type safety and enum-based patterns

Unify wraps Bukkit's FileConfiguration with a simpler, safer API.

Basic Usage

import me.jordanfails.unify.Config

class MyPlugin : JavaPlugin() {

    lateinit var config: Config

    override fun onEnable() {
        config = Config(this, "config")

        val prefix = config.getString("prefix", "&8[&bPlugin&8] ")
        val maxPlayers = config.getInt("max-players", 10)
        val debug = config.getBoolean("debug", false)
    }
}

Creating Default Configs

// Creates config.yml in your plugin folder
// Copies from resources/config.yml if it exists
val config = Config(this, "config")

// Creates shops/shops.yml
val shops = Config(this, "shops/shops")

Type-Safe Access

MethodDefaultReturns
getString(path, default)""String
getInt(path, default)0Int
getDouble(path, default)0.0Double
getBoolean(path, default)falseBoolean
getStringList(path)emptyList()List<String>
getSection(path)ConfigurationSection?

Saving & Reloading

config.set("player-data.kills", kills)
config.save()

config.reload()

Advanced Patterns

On this page