Code Monkey home page Code Monkey logo

taboolib's Introduction

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

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

taboolib's People

Contributors

bkm016 avatar izzelaliz avatar tony-all avatar score2 avatar kylepoops avatar 602723113 avatar polar-pumpkin avatar ling556 avatar thehrz avatar liangbai2333 avatar arasple avatar itsflicker avatar czisky avatar xbaimiao avatar nadecancode avatar micalhl avatar soldier233 avatar eric-liucn avatar shaokeyibb avatar kzheart avatar pkuliyi2015 avatar elabosak233 avatar npc5 avatar glomzzz avatar luohuayu avatar inrhor avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.