Warning: file_put_contents(/www/wwwroot/nmbt.106988770/cache/modrinth_versions_tEQ06Fzn.json): Failed to open stream: Permission denied in /www/wwwroot/nmbt.106988770/resource_detail.php on line 53
KFramework - 墨喵 Minecraft 资源
KFramework 图标

KFramework

作者:rebot | 分类:模组

价格:0 墨喵币 下载量:0 点赞:0 版本 1.0.1
本资源为搬运资源,原资源地址: https://modrinth.com/mod/kframework
资源信息

Minecraft 版本: 1.21 1.21.1 1.21.2 1.21.3 1.21.4 1.21.5 1.21.6 1.21.7 1.21.8 1.21.9 1.21.10 1.21.11

平台: paper

资源介绍

KotlinFramework

Lightweight Kotlin framework for Paper plugin development. Less boilerplate, more plugin.

I built this because I kept copy-pasting the same companion object, instance setup, and registerEvents into every single plugin. It's not trying to replace anything, it just removes the repetitive parts.


Features

  • Base class (KotlinFramework) with automatic instance, startup logging, and safe error handling
  • Inline command registration: no separate class for simple commands
  • Inline event listening: no @EventHandler, no separate Listener class
  • KotlinCommand base class for commands that need their own file
  • Scheduler helpers: runLater, runTimer, runAsync
  • Config helpers: saveLocation, getLocation, config, setConfig
  • Message helpers: msg, broadcastMsg, colorize with & color support

Installation

Add JitPack to your repositories and the framework as a dependency:

repositories {
    maven("https://jitpack.io")
}

dependencies {
    implementation("com.github.kolerz:kframework:1.0.0")
}

⚠️ Use shadowJar to bundle the framework into your plugin jar, otherwise it won't load.


Quick example

class MyPlugin : KotlinFramework() {

    override fun onStart() {

        registerCommand("heal", playerOnly = true) {
            player!!.health = 20.0
            reply("&aHealed!")
        }

        registerCommand("broadcast", permission = "myplugin.broadcast") {
            requireArgs(1, "/broadcast <message>") {
                broadcastMsg("&8[&cBroadcast&8] &f${args.joinToString(" ")}")
            }
        }

        registerListener {
            on<PlayerJoinEvent> {
                player.msg("&aWelcome, &f${player.name}&a!")
            }
        }

        runTimer(0L, 20L * 60L * 5L) {
            broadcastMsg("&eRemember to vote!")
        }
    }
}

Requirements

  • Paper 1.21+
  • Java 21+
  • Kotlin 2.x

Source

github.com/kolerz/kframework


License

MIT

下载与版本
评论(0)
请 登录 后发表评论。

暂无评论,抢个沙发吧~

举报此资源

请登录后举报

赞助作者

请 登录 后赞助作者。

🔥 相关推荐
Morne-Brume

价格:0 墨喵币
下载量:0

查看详情
MoneySimple+

价格:0 墨喵币
下载量:0

查看详情
The Golden Paradise

价格:0 墨喵币
下载量:0

查看详情
Snoop On Immortality

价格:0 墨喵币
下载量:0

查看详情