项目
在 GitHub 查看 MCCoroutine
Shynixn/MCCoroutine
关于
MCCoroutine 是一个库,可在 Minecraft 服务器环境中广泛支持 Kotlin 协程。
系统与基础设施可以做什么
- Full implementation of Kotlin Coroutines (async/await)
- Extension functions for already established functions
- Connection to events, commands, schedulers
- Coroutine LifeCycle scope for plugins (supports plugin reloading)
实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文MCCoroutine 
MCCoroutine is a library, which adds extensive support for Kotlin Coroutines for Minecraft Server environments.
Plugins for game servers and proxy servers often need to perform asynchronous operations (e.g. accessing databases) to be scalable for a large amount of players. MCCoroutine brings the full power of Kotlin Coroutines to them by extending the existing APIs with suspendable commands, events and schedules.
Supported Game Servers:
- CraftBukkit
- Fabric
- Folia
- Minestom
- Paper
- Spigot
- SpongeVanilla v7.x.x
- SpongeForge v7.x.x
Supported Proxies:
- BungeeCord
- Waterfall
- Velocity
Examples:
// Allows to prepend suspend to any listener function.
class PlayerConnectListener : Listener {
@EventHandler
suspend fun onPlayerJoinEvent(playerJoinEvent: PlayerJoinEvent) {
}
}
// Adds a new interface for suspendable command executors.
class AdminCommandExecutor: SuspendingCommandExecutor {
override suspend fun onCommand(sender: CommandSender,command: Command,label: String,args: Array<out String>): Boolean {
return false
}
}
// Adds a new extension function to switch into a suspendable plugin coroutine.
fun bar() {
plugin.launch {
delay(1000)
bob()
}
}
private suspend fun bob() {
}
Getting started
Resources
- MCCoroutine JavaDocs for the Bukkit-API
- MCCoroutine JavaDocs for the BungeeCord-API
- MCCoroutine JavaDocs for the Fabric-API
- MCCoroutine JavaDocs for the Folia-API
- MCCoroutine JavaDocs for the Minestom-API
- MCCoroutine JavaDocs for the Sponge-v7.x.x-API
- MCCoroutine JavaDocs for the Velocity-API
- Article on custom frameworks
Features
- Full implementation of Kotlin Coroutines (async/await)
- Extension functions for already established functions
- Connection to events, commands, schedulers
- Coroutine LifeCycle scope for plugins (supports plugin reloading)
- No NMS
- Support for Minecraft 1.7 - Latest
- Support for Java 8+
Contributing
- Fork the MCCoroutine project on GitHub and clone it to your local environment
- Install Java 8+
- Execute gradle sync for dependencies
Licence
The source code is licensed under the MIT license.
探索相关项目
加载中…