aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/notenoughupdates/gui/repogui.kt
blob: b2fba91ab04ba4f59193238faf3dfbbd73a51231 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package moe.nea.notenoughupdates.gui

import net.minecraft.text.Text
import moe.nea.notenoughupdates.repo.RepoManager

fun repoGui(): ConfigGui<RepoManager.Config> {
    return ConfigGui(RepoManager) {
        title(Text.translatable("notenoughupdates.gui.repo.title"))
        toggle(Text.translatable("notenoughupdates.gui.repo.autoupdate"), RepoManager.Config::autoUpdate)
        textfield(
            Text.translatable("notenoughupdates.gui.repo.username"),
            Text.translatable("notenoughupdates.gui.repo.hint.username"),
            RepoManager.Config::user,
            maxLength = 255
        )
        textfield(
            Text.translatable("notenoughupdates.gui.repo.reponame"),
            Text.translatable("notenoughupdates.gui.repo.hint.reponame"),
            RepoManager.Config::repo
        )
        textfield(
            Text.translatable("notenoughupdates.gui.repo.branch"),
            Text.translatable("notenoughupdates.gui.repo.hint.branch"),
            RepoManager.Config::branch
        )
        button(
            Text.translatable("notenoughupdates.gui.repo.reset.label"),
            Text.translatable("notenoughupdates.gui.repo.reset"),
        ) {
            RepoManager.data.user = "NotEnoughUpdates"
            RepoManager.data.repo = "NotEnoughUpdates-REPO"
            RepoManager.data.branch = "dangerous"
            reload()
        }
    }
}