在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):TabooLib/taboolib开源软件地址(OpenSource Url):https://github.com/TabooLib/taboolib开源编程语言(OpenSource Language):Kotlin 50.3%开源软件介绍(OpenSource Introduction):TabooLib FrameworkTabooLib is a multi-platform plugin development framework for Minecraft Java Version. However, TabooLib itself is neither a platform nor a runtime environment for plugins, but a tool designed to help developers speed up development on various platforms, replacing some frequently used or relatively complex operations, as well as solving some painful problems.
Along with the 6.0 update, we focused more on security and stability. The hot-loading system which was problematic in the previous version has been abandoned. While it significantly reduced the size of plugins and introduced a centralized plugin manager, with the advent of updates to Minecraft and a multitude of derivatives of Spigot, this has become troublesome. So it was a foregone conclusion that a huge update to v6.0 was in order, in which we carefully redesigned every single component of TabooLib. Most TabooLib-based plugins are supposed to work across multiple Minecraft versions without special updates. i.e. in most cases, server owners would not need to be concerned about incompatibility of plugins. Even with extensive use of nms code, TabooLib provides several magical tools. Simpler, for example you can quickly register commands using the method provided in TabooLib. command("tpuuid") {
literal("random") {
execute<ProxyPlayer> { player, _, _ ->
player.teleport(player.entities().randomOrNull() ?: return@execute)
}
}
dynamic(optional = true) {
suggestion<ProxyPlayer> { player, _ ->
player.entities().map { it.toString() }
}
execute<ProxyPlayer> { player, _, argument ->
player.teleport(UUID.fromString(argument))
}
}
execute<ProxyPlayer> { player, _, _ ->
player.teleport(player.entityNearly() ?: return@execute)
}
} For more complex ones, you are able to create your own multi-platform implementation like the following, where TabooLib will select the appropriate implementation class based on the platform currently running. import org.bukkit.Bukkit
import org.bukkit.entity.Player
import taboolib.common.platform.*
import taboolib.platform.util.toBukkitLocation
import java.util.*
interface PlatformEntityHandler {
fun entities(player: ProxyPlayer): List<UUID>
fun entityNearly(player: ProxyPlayer): UUID?
fun teleport(player: ProxyPlayer, uuid: UUID)
@PlatformImplementation(Platform.BUKKIT)
class BukkitSide : PlatformEntityHandler {
override fun entities(player: ProxyPlayer): List<UUID> {
return player.cast<Player>().world.entities.map { it.uniqueId }
}
override fun entityNearly(player: ProxyPlayer): UUID? {
return player.cast<Player>().world.entities
.filter { it != player.origin }
.minByOrNull { it.location.distance(player.location.toBukkitLocation()) }?.uniqueId
}
override fun teleport(player: ProxyPlayer, uuid: UUID) {
player.cast<Player>().teleport(Bukkit.getEntity(uuid) ?: return)
}
}
}
fun ProxyPlayer.entities(): List<UUID> {
return implementations<PlatformEntityHandler>().entities(this)
}
fun ProxyPlayer.entityNearly(): UUID? {
return implementations<PlatformEntityHandler>().entityNearly(this)
}
fun ProxyPlayer.teleport(uuid: UUID) {
implementations<PlatformEntityHandler>().teleport(this, uuid)
} There is no need to do so if your plugin is designed to work only on the Bukkit platform. Since the duty of TabooLib is to help developers get their development done as fast as possible, instead of creating pointless methods to increase the size of the repository. Versions
Modules
Links |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论