aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/notenoughupdates/gui/repogui.kt
blob: 23c8d1877aa3ac1e9bba39156765e1e326949d81 (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.config.user = "NotEnoughUpdates"
            RepoManager.config.repo = "NotEnoughUpdates-REPO"
            RepoManager.config.branch = "dangerous"
            reload()
        }
    }
}