Skip to content

Powerful framework for creating multi-platform Minecraft plugin

License

Notifications You must be signed in to change notification settings

tsunami047/taboolib

 
 

Repository files navigation

TabooLib Framework

[中文版本/Chinese Ver.]

TabooLib 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.

  • TabooLib started out for Bukkit, but now is developing horizontally.
  • TabooLib is offered under the MIT License, which is a loose open source license.
  • Development speed comes first

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("tp") {
    literal("random") {
        execute<ProxyPlayer> { sender, _, _ ->
            sender.teleport(sender.entities().randomOrNull() ?: return@execute)
        }
    }
    player {
        execute<ProxyPlayer> { sender, ctx, _ ->
            sender.teleport(ctx.player())
        }
    }
    execute<ProxyPlayer> { sender, _, _ ->
        sender.teleport(sender.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

Build Version Distribution Date Distributor Plugin Version

Modules

  • common: Core parts of TabooLib, the environment deployment and cross-platform interface
  • common-5: Some tools retained from TabooLib v5.0
  • module-ai: Manage and register custom entity AI (Pathfinder)
  • module-chat: Building Tools for Component (Json) Information & 1.16 RGB Color Transformations
  • module-configuration: Solutions for Configuration(Yaml & Toml & Hocon & Json)
  • module-configuration-legacy: YAML Interface Wrappers & Configuration Management Tools ( previous version, before v6.0.3)
  • module-database: Database Management Tools
  • module-database-mongodb: Database Management Tools(MongoDB)
  • module-effect: Particles Generation Utilities
  • module-kether: Build-in scripts (action statements) solutions
  • module-lang: Language File Utilities
  • module-metrics: Integration of bStats
  • module-navigation: Entity-less Pathfinding Utilities
  • module-nms: Multi-version NMS Solutions & Packet Management Tools
  • module-nms-util: Collection of Common NMS Tools
  • module-porticus: BungeeCord Communication Tools
  • module-ui: Chest Menu Builder
  • module-ui-receptacle: Chest Menu Builder Implemented with Packet
  • platform-bukkit: Bukkit Implementation
  • platform-bungee: BungeeCord Implementation
  • platform-nukkit: Nukkit Implementation
  • platform-sponge-api7: Sponge (api7) Implementation
  • platform-sponge-api8: Sponge (api8) Implementation
  • platform-sponge-api9: Sponge (api9) Implementation
  • platform-velocity: Velocity Implementation
  • platform-cloudnet-v3: CloudNet (v3) Implementation
  • platform-application: Standalone Application Implementation

Links

Contributors

About

Powerful framework for creating multi-platform Minecraft plugin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 53.7%
  • Java 46.3%