Matt-MX / KtPaperGui

Declarative GUI focused library for PaperMC. Made for personal use but open source enjoy! :)
Apache License 2.0
25 stars 5 forks source link

AutoConfig API #38

Open Matt-MX opened 2 months ago

Matt-MX commented 2 months ago

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.

Matt-MX commented 2 months ago

Very low priority

Matt-MX commented 2 months ago

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>"