Matt-MX/KtPaperGui

AutoConfig API

Matt-MX opened this issue · 2 comments

Lightweight API allowing for developers to give users control to customize GUIs and save them to YAML.

e.g

val existingGui = gui(!"title") {
    configButton("button.hello.world") {
        // todo configure default props
    }
}

configurableGui(existingGui) {
    buttonCustomizeClickHandler {
        ConfigurableButtonGui(button).open(player)
    }
}.open(player)

This aims to generalize the process of letting an admin configure a gui from in-game.

Very low priority

Additionally having the ability to pull lines from a lang file.

val lang by plugin.yaml()

("cmd" / someArg).runs<Player> {
    val msg_cmd_response by lang("&cOptional default response")
    // TODO what about placeholders support?
    reply(!msg_cmd_response)
}

lang.yaml (default)

msg:
  cmd:
    response: "&aYou ran this command %someArgValue%"

I saw some other plugin implementing some MiniMessage styled stuff for interacting with the player like this:

msg:
  cmd:
    response:
     - "<lgreen>You ran this command %SomeArgValue%"
     - "<title><lgreen>Command ran<subtitle><white>Subtitle</title>"
     - "<sound:block_note_block_pling:0.3:2>"