{"id":17501948,"url":"https://github.com/itsdoot/kotfigurator","last_synced_at":"2025-03-28T19:23:30.181Z","repository":{"id":119858675,"uuid":"148074344","full_name":"ItsDoot/Kotfigurator","owner":"ItsDoot","description":"A Kotlin library for easily mapping configurate values to class fields.","archived":false,"fork":false,"pushed_at":"2018-09-09T23:19:07.000Z","size":67,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-02T20:52:49.576Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ItsDoot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-09T23:26:26.000Z","updated_at":"2019-03-21T01:21:21.000Z","dependencies_parsed_at":"2023-06-03T10:15:48.779Z","dependency_job_id":null,"html_url":"https://github.com/ItsDoot/Kotfigurator","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItsDoot%2FKotfigurator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItsDoot%2FKotfigurator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItsDoot%2FKotfigurator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItsDoot%2FKotfigurator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ItsDoot","download_url":"https://codeload.github.com/ItsDoot/Kotfigurator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246086176,"owners_count":20721296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-19T20:33:59.860Z","updated_at":"2025-03-28T19:23:30.129Z","avatar_url":"https://github.com/ItsDoot.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kotfigurator\n\nA Kotlin library for easily mapping [configurate](https://github.com/SpongePowered/configurate) values to class fields.\n\n**NOTE:** Comments only work when the configuration format itself supports comments.\n\n## Usage\n\n#### Gradle\n\n```groovy\nrepositories {\n    mavenCentral()\n    maven {\n        name = 'jitpack'\n        url = 'https://jitpack.io'\n    }\n}\n\ndependencies {\n    compile 'com.github.TheFrontier:Kotfigurator:1.0.0'\n}\n```\n\n#### Maven\n\n```xml\n\u003crepositories\u003e\n    \u003crepository\u003e\n        \u003cid\u003ejitpack\u003c/id\u003e\n        \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n    \u003c/repository\u003e\n\u003c/repositories\u003e\n\n\u003cdependencies\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.github.TheFrontier\u003c/groupId\u003e\n        \u003cartifactId\u003eKotfigurator\u003c/artifactId\u003e\n        \u003cversion\u003e1.0.0\u003c/version\u003e\n    \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\n## Example\n\n#### Supported Data Types:\n- `String`\n- `Boolean`\n- `Int`\n- `Long`\n- `Float`\n- `Double`\n- Any type with an associated TypeSerializer\n- `List`s of the aforementioned types\n- `Map`s of the aforementioned types\n\n```kotlin\nclass MyPluginConfig(adapter: ConfigAdapter) {\n\n    val joinMessage: String by adapter.string(comment = \"The broadcasted message when a player joins.\") { \"\u0026e%player% has joined the game.\" }\n\n    val enabledModules: List\u003cString\u003e by adapter.list(key = \"enabled-modules\") { listOf(\"module-1\", \"module-2\") }\n\n    val blocks: BlocksSection by adapter.section(comment = \"Blocks that require a permission to obtain\") { BlocksSection(it) }\n\n    class BlocksSection(adapter: ConfigAdapter) {\n\n        val blockPermissions: Map\u003cString, String\u003e by adapter.map(key = \"blocks-with-permissions\") {\n            mapOf(\"minecraft:grass\" to \"my.grass.permission\",\n                    \"minecraft:bedrock\" to \"my.admin.permission\")\n        }\n    }\n}\n\nfun initializeConfig() {\n    val loader: HoconConfigurationLoader = ... // Works with any configuration format supported by configurate.\n    val node = loader.load()\n\n    val myPluginConfig = MyPluginConfig(NodeConfigAdapter(node))\n    \n    print(myPluginConfig.joinMessage)\n    for (module in myPluginConfig.enabledModules) {\n       // enable them\n    }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsdoot%2Fkotfigurator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitsdoot%2Fkotfigurator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsdoot%2Fkotfigurator/lists"}