### Configuring TabooLibLegacyStyleCommandHelper Language Files (YAML) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/airm/TabooLibLegacyStyleCommandHelper.md Example YAML configuration defining the structure and content of the command help messages. It includes placeholders like {pluginId}, {command}, {subCommands}, {name}, {usage}, and {description} for dynamic content. ```YAML command-helper: - '&7' - ' &f&l{pluginId} &7v{pluginVersion}' - '&7' - ' &7命令: &f/{command} &8\[...\]' - ' &7参数:' - '{subCommands}' - '&7' command-sub: - ' &8- [&f{name}](h=/{command} {name} {usage}&8- &7{description};suggest=/{command} {name})' - ' &7{description}' ``` -------------------------------- ### Create Empty Component - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/chat/Components.md Creates and returns an empty chat component. This can be used as a starting point for building more complex components. ```Kotlin empty(): ComponentText ``` -------------------------------- ### Basic ResourceReader Usage (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/i18n/ResourceReader.md Demonstrates how to create a ResourceReader instance to automatically load language files, access loaded files by language code, manually load nodes from a custom configuration file, and create a reader with migration disabled. Includes an example structure for a language file. ```kotlin // 创建ResourceReader实例,自动加载语言文件 val resourceReader = ResourceReader(MyPlugin::class.java) // 获取特定语言代码的语言文件 val chineseFile = resourceReader.files["zh_CN"] val englishFile = resourceReader.files["en_US"] // 手动加载配置文件中的节点 val config = Configuration.loadFromFile(File("custom_lang.yml")) val nodes = HashMap() resourceReader.loadNodes(config, nodes, "custom") // 禁用迁移功能的ResourceReader val noMigrateReader = ResourceReader(MyPlugin::class.java, migrate = false) // 语言文件结构示例 /* welcome: type: text text: "欢迎 %player% 加入服务器!" commands: - type: text text: "/help - 显示帮助信息" - type: text text: "/stats - 显示统计信息" notification: type: json text: - "点击 [这里] 查看详情" args: - hover: "点击查看" command: "/details" */ ``` -------------------------------- ### Handling Command with ItemManager Parsing (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/airm/itemmanager/ItemManager.md Provides a basic function handleGiveCommand that takes player and arguments, checks for an item ID argument, uses itemManager.parse2ItemStack to get the item, adds it to the player's inventory, and sends feedback messages, including error handling. ```Kotlin fun handleGiveCommand(sender: Player, args: Array) { if (args.isEmpty()) { sender.sendMessage("请指定物品ID") return } val itemManager = ItemManager() // 实际应用中应该使用单例或注入 val itemId = args[0] try { val buildResult = itemManager.parse2ItemStack(itemId, sender) sender.inventory.addItem(buildResult.itemStack) sender.sendMessage("已给予物品: $itemId (来源: ${buildResult.source})") } catch (e: Exception) { sender.sendMessage("无法创建物品: $itemId") } } ``` -------------------------------- ### Parsing List/Compound Conditions with ParserUtils (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/airm/entitymatch/util/ParserUtils.md Shows examples of using `ParserUtils.parseListCondition` to parse complex and nested list conditions, such as 'any' or 'all' combinations of other conditions. ```kotlin // 解析复合条件 val compound = ParserUtils.parseListCondition("any(contains(\"test\"),startsWith(\"a\"))") // 解析嵌套条件 val nested = ParserUtils.parseListCondition("all(any(contains(\"a\"),contains(\"b\")),startsWith(\"c\"))") ``` -------------------------------- ### Parsing Item ID with ItemManager (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/airm/itemmanager/ItemManager.md Demonstrates how to instantiate ItemManager, use parse2ItemStack to get a BuildSourceItem from an ID string (like "mythicmobs:DragonSword"), extract the ItemStack, and add it to a player's inventory. Also shows accessing source information. ```Kotlin val itemManager = ItemManager() val player = // 获取玩家 // 解析并获取物品 val itemResult = itemManager.parse2ItemStack("mythicmobs:DragonSword", player) val item = itemResult.itemStack // 给予玩家 player.inventory.addItem(item) // 获取物品来源信息 println("物品ID: ${itemResult.id}") println("物品来源: ${itemResult.source}") ``` -------------------------------- ### Creating Ray Effect (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/effect/EffectGeneric.md Creates a Ray particle effect shape starting from the origin, extending in the given direction up to a maximum length. Parameters control the step size between particles, the ray's range, and the stop condition. The effect runs periodically with a default period of 20 ticks. A lambda function (`(p: Location) -> Unit`) can be provided via the `spawner` parameter to define custom particle generation logic at each point `p` on the shape. If omitted, no particles are spawned. Returns a `Ray` object which supports further configuration and starting the effect. ```Kotlin createRay(origin: Location, direction: Vector, maxLength: Double, step: Double, range: Double = 0.5, stopType: RayStopType, period: Long = 20L, spawner: (p: Location) -> Unit = {}): Ray ``` -------------------------------- ### Creating Line Effect (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/effect/EffectGeneric.md Creates a Line particle effect shape between two specified locations (start and end). The `step` parameter controls the density of particles along the line. The effect runs periodically with a default period of 20 ticks. A lambda function (`(p: Location) -> Unit`) can be provided via the `spawner` parameter to define custom particle generation logic at each point `p` on the shape. If omitted, no particles are spawned. Returns a `Line` object which supports further configuration and starting the effect. ```Kotlin createLine(start: Location, end: Location, step: Double = 1.0, period: Long = 20, spawner: (p: Location) -> Unit = {}): Line ``` -------------------------------- ### Retrieving Specific ItemSource from ItemManager (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/airm/itemmanager/ItemManager.md Shows how to get an ItemSource using the map access operator (itemManager["name"]) or the getSource method (which supports aliases). It also includes a check for the source's availability (isLoaded) before using it to build an item. ```Kotlin val itemManager = ItemManager() // 直接通过名称获取 val mythicSource = itemManager["mythicmobs"] // 或使用getSource方法,支持别名 val sameSource = itemManager.getSource("mm") // 检查物品源是否可用 if (mythicSource != null && mythicSource.isLoaded) { // 使用特定物品源构建物品 val mythicItem = mythicSource.build("DragonSword", player) player.inventory.addItem(mythicItem) } ``` -------------------------------- ### Creating Arc Effect (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/effect/EffectGeneric.md Creates an Arc particle effect shape centered at the origin with a specified radius. Parameters control the start angle, total angle, and step size between particles. The effect runs periodically with a default period of 20 ticks. A lambda function (`(p: Location) -> Unit`) can be provided via the `spawner` parameter to define custom particle generation logic at each point `p` on the shape. If omitted, no particles are spawned. Returns an `Arc` object which supports further configuration and starting the effect. ```Kotlin createArc(origin: Location, startAngle: Double = 0.0, angle: Double = 30.0, radius: Double = 1.0, step: Double = 1.0, period: Long = 20, spawner: (p: Location) -> Unit = {}): Arc ``` -------------------------------- ### Getting All Members of Redis Set - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/alkaid-redis/IRedisConnection.md Returns all members of the set stored at the specified key. If the key does not exist, an empty set is returned. ```Kotlin smembers(key: String): Set ``` -------------------------------- ### Creating Star Effect (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/effect/EffectGeneric.md Creates a five-pointed Star particle effect shape centered at the origin with a specified radius. The `step` parameter controls the density of particles along the shape. The effect runs periodically with a default period of 20 ticks. A lambda function (`(p: Location) -> Unit`) can be provided via the `spawner` parameter to define custom particle generation logic at each point `p` on the shape. If omitted, no particles are spawned. Returns a `Star` object which supports further configuration and starting the effect. ```Kotlin createStar(origin: Location, radius: Double, step: Double, period: Long = 20L, spawner: (p: Location) -> Unit = {}): Star ``` -------------------------------- ### Getting Value by Key from Redis - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/alkaid-redis/IRedisConnection.md Retrieves the value associated with the specified key from Redis. Returns the value as a String, or null if the key does not exist. ```Kotlin get(key: String): String? ``` -------------------------------- ### Creating Sphere Effect (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/effect/EffectGeneric.md Creates a Sphere particle effect shape centered at the origin with a specified radius. The `sample` parameter controls the number of particles used to represent the sphere's surface. The effect runs periodically with a default period of 20 ticks. A lambda function (`(p: Location) -> Unit`) can be provided via the `spawner` parameter to define custom particle generation logic at each point `p` on the shape. If omitted, no particles are spawned. Returns a `Sphere` object which supports further configuration and starting the effect. ```Kotlin createSphere(origin: Location, radius: Double = 1.0, sample: Int = 100, period: Long = 20, spawner: (p: Location) -> Unit = {}): Sphere ``` -------------------------------- ### Creating Astroid Effect (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/effect/EffectGeneric.md Creates an Astroid (hypocycloid with four cusps) particle effect shape centered at the origin with a specified radius. The `step` parameter controls the density of particles along the shape. The effect runs periodically with a default period of 20 ticks. A lambda function (`(p: Location) -> Unit`) can be provided via the `spawner` parameter to define custom particle generation logic at each point `p` on the shape. If omitted, no particles are spawned. Returns an `Astroid` object which supports further configuration and starting the effect. ```Kotlin createAstroid(origin: Location, radius: Double = 1.0, step: Double = 1.0, period: Long = 20, spawner: (p: Location) -> Unit = {}): Astroid ``` -------------------------------- ### Creating Cube Effect (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/effect/EffectGeneric.md Creates a Cube particle effect shape defined by two corner locations (min and max). The `step` parameter controls the density of particles along the edges. The effect runs periodically with a default period of 20 ticks. A lambda function (`(p: Location) -> Unit`) can be provided via the `spawner` parameter to define custom particle generation logic at each point `p` on the shape. If omitted, no particles are spawned. Returns a `Cube` object which supports further configuration and starting the effect. ```Kotlin createCube(min: Location, max: Location, step: Double = 1.0, period: Long = 20, spawner: (p: Location) -> Unit = {}): Cube ``` -------------------------------- ### Creating Circle Effect (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/effect/EffectGeneric.md Creates a Circle particle effect shape centered at the origin with a specified radius. The `step` parameter controls the density of particles along the circumference. The effect runs periodically with a default period of 20 ticks. A lambda function (`(p: Location) -> Unit`) can be provided via the `spawner` parameter to define custom particle generation logic at each point `p` on the shape. If omitted, no particles are spawned. Returns a `Circle` object which supports further configuration and starting the effect. ```Kotlin createCircle(origin: Location, radius: Double = 1.0, step: Double = 1.0, period: Long = 20, spawner: (p: Location) -> Unit = {}): Circle ``` -------------------------------- ### Creating Heart Effect (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/effect/EffectGeneric.md Creates a Heart particle effect shape centered at the origin, scaled by the provided x and y rates. The effect runs periodically. A lambda function (`(p: Location) -> Unit`) can be provided via the `spawner` parameter to define custom particle generation logic at each point `p` on the shape. If omitted, no particles are spawned. Returns a `Heart` object which supports further configuration and starting the effect. ```Kotlin createHeart(xScaleRate: Double, yScaleRate: Double, origin: Location, period: Long, spawner: (p: Location) -> Unit = {}): Heart ``` -------------------------------- ### Creating Lotus Effect (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/effect/EffectGeneric.md Creates a Lotus particle effect shape centered at the specified origin. The effect runs periodically with a default period of 20 ticks. A lambda function (`(p: Location) -> Unit`) can be provided via the `spawner` parameter to define custom particle generation logic at each point `p` on the shape. If omitted, no particles are spawned. Returns a `Lotus` object which supports further configuration and starting the effect. ```Kotlin createLotus(origin: Location, period: Long = 20, spawner: (p: Location) -> Unit = {}): Lotus ``` -------------------------------- ### Getting Cardinality of Redis Set - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/alkaid-redis/IRedisConnection.md Returns the number of elements (cardinality) of the set stored at the specified key. If the key does not exist, it is treated as an empty set and 0 is returned. ```Kotlin scard(key: String): Long ``` -------------------------------- ### Creating Filled Circle Effect (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/effect/EffectGeneric.md Creates a Filled Circle particle effect shape centered at the origin with a specified radius. The `sample` parameter controls the number of particles used to fill the circle. The effect runs periodically with a default period of 20 ticks. A lambda function (`(p: Location) -> Unit`) can be provided via the `spawner` parameter to define custom particle generation logic at each point `p` within the shape. If omitted, no particles are spawned. Returns a `FilledCircle` object which supports further configuration and starting the effect. ```Kotlin createFilledCircle(origin: Location, radius: Double = 1.0, sample: Int = 100, period: Long = 20, spawner: (p: Location) -> Unit = {}): FilledCircle ``` -------------------------------- ### Creating Polygon Effect (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/effect/EffectGeneric.md Creates a regular Polygon particle effect shape centered at the origin with a specified radius and number of sides. The `step` parameter controls the density of particles along the edges. The effect runs periodically with a default period of 20 ticks. A lambda function (`(p: Location) -> Unit`) can be provided via the `spawner` parameter to define custom particle generation logic at each point `p` on the shape. If omitted, no particles are spawned. Returns a `Polygon` object which supports further configuration and starting the effect. ```Kotlin createPolygon(origin: Location, radius: Double = 1.0, sides: Int = 3, step: Double = 1.0, period: Long = 20, spawner: (p: Location) -> Unit = {}): Polygon ``` -------------------------------- ### Creating SQL Host from Configuration Section (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/core/FileToHost.md This Kotlin extension function on `ConfigurationSection` retrieves a child configuration section by the given `name` and uses it to create a `HostSQL` database connection. If the named section is not found, an empty configuration is used, potentially leading to default connection settings. ```Kotlin ConfigurationSection.getHost(name: String): HostSQL ``` -------------------------------- ### Initializing Kether Engine (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/kether/api/Kether.md Initializes the Kether engine, including registering the text converter. Called during the INIT lifecycle. ```Kotlin init() ``` -------------------------------- ### Registering Custom ItemSource with ItemManager (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/airm/itemmanager/ItemManager.md Illustrates creating a class MyCustomSource that implements ItemSource, providing its name, aliases, plugin name, and build logic. It then shows how to instantiate ItemManager and call register with the custom source instance. ```Kotlin class MyCustomSource : ItemSource { override val name: String get() = "mycustom" override val alias: List get() = listOf("mc", "custom") override val pluginName: String get() = "MyCustomPlugin" override val isLoaded: Boolean get() = true // 或检查实际插件是否加载 override fun build(id: String, player: Player?): ItemStack { // 自定义物品构建逻辑 return ItemStack(Material.DIAMOND_SWORD) // 示例 } } // 注册自定义源 val itemManager = ItemManager() itemManager.register(MyCustomSource()) // 使用自定义源 val item = itemManager.parse2ItemStack("mycustom:special_item", player) ``` -------------------------------- ### Creating SQLite Host from File (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/core/FileToHost.md This Kotlin extension function on the `File` class creates a `HostSQLite` database connection using the file path. It directly passes the `File` object to the `HostSQLite` constructor. ```Kotlin File.getHost(): HostSQLite ``` -------------------------------- ### Integrating TabooLibLegacyStyleCommandHelper into Command Definition (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/airm/TabooLibLegacyStyleCommandHelper.md Shows how to use createTabooLegacyStyleCommandHelper() within a TabooLib command block to enable the legacy-style help system for the command and its literals. ```Kotlin command("example") { createTabooLegacyStyleCommandHelper() literal("test1") { execute { sender, _, _ -> // 命令逻辑 } } } ``` -------------------------------- ### Create Keybind Component - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/chat/Components.md Creates a chat component that displays the current key binding for a specific action (e.g., 'key.jump'). The client will show the actual bound key. ```Kotlin keybind(key: String): ComponentText ``` -------------------------------- ### Kether Script Service Instance (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/kether/api/Kether.md A lazily initialized instance of the ScriptService, providing core scripting functionalities. ```Kotlin scriptService: ScriptService ``` -------------------------------- ### Creating Redis Pub/Sub Object - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/alkaid-redis/IRedisConnection.md Creates a JedisPubSub object for handling Redis publish/subscribe operations. Allows for custom handling of subscription events and messages. Supports pattern matching. ```Kotlin createPubSub(patternMode: Boolean, func: RedisMessage.() -> Unit): JedisPubSub ``` -------------------------------- ### Kether Script Registry Instance (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/kether/api/Kether.md A lazily initialized instance of the script registry, used for managing registered actions, properties, and operators. ```Kotlin scriptRegistry ``` -------------------------------- ### Create Selector Component - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/chat/Components.md Creates a chat component that displays the names of entities matched by a given selector (e.g., '@a', '@p[level=10+]'). ```Kotlin selector(selector: String): ComponentText ``` -------------------------------- ### Parsing Number Conditions with ParserUtils (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/airm/entitymatch/util/ParserUtils.md Illustrates the usage of `ParserUtils.parseNumberCondition` for parsing numerical matching conditions, covering simple values, values with comparison operators, and values associated with a tag. ```kotlin // 解析简单数值 val simple = ParserUtils.parseNumberCondition("10") // 解析带操作符的数值 val withOperator = ParserUtils.parseNumberCondition(">10") // 解析带标签的数值 val withTag = ParserUtils.parseNumberCondition("health>10") ``` -------------------------------- ### Create Translation Component (List) - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/chat/Components.md Creates a chat component that displays a translated string based on a translation key, with optional arguments provided as a list. ```Kotlin translation(text: String, obj: List): ComponentText ``` -------------------------------- ### Adding Multiple Kether Actions (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/kether/api/Kether.md Registers multiple script action parsers under the given names. ```Kotlin addAction(name: Array, parser: QuestActionParser): Unit ``` -------------------------------- ### Create Text Component - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/chat/Components.md Creates and returns a simple text chat component from a given string. This is the most basic type of chat component. ```Kotlin text(text: String): ComponentText ``` -------------------------------- ### Adding Single Kether Action (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/kether/api/Kether.md Registers a single script action parser under the given name and optional namespace. ```Kotlin addAction(name: String, parser: QuestActionParser, namespace: String? = null): Unit ``` -------------------------------- ### Parse Simple List to Legacy RawMessage List - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/chat/Components.md Parses a list of strings in the simplified format and converts each into a BungeeCord RawMessage object, allowing for custom transformations. ```Kotlin parseSimpleToLegacyRaw(text: List, transfer: TextTransfer.() -> Unit): List ``` -------------------------------- ### Parsing String Conditions with ParserUtils (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/airm/entitymatch/util/ParserUtils.md Demonstrates how to use `ParserUtils.parseStringCondition` to parse different types of string matching conditions, including exact match, contains, and conditions with modifiers. ```kotlin // 解析精确匹配 val exact = ParserUtils.parseStringCondition("exact(\"test\")") // 解析包含匹配 val contains = ParserUtils.parseStringCondition("contains(\"test\")") // 解析带修饰符的条件 val withModifier = ParserUtils.parseStringCondition("contains[uncolored](\"test\")") ``` -------------------------------- ### Parse Simple to Legacy RawMessage - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/chat/Components.md Parses a single string in the simplified format and converts it into a BungeeCord RawMessage object, allowing for custom transformations. ```Kotlin parseSimpleToLegacyRaw(text: String, transfer: TextTransfer.() -> Unit): RawMessage ``` -------------------------------- ### Create Translation Component (Vararg) - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/chat/Components.md Creates a chat component that displays a translated string based on a translation key, with optional arguments provided as a variable number of arguments. ```Kotlin translation(text: String, vararg obj: Any): ComponentText ``` -------------------------------- ### Create Score Component - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/chat/Components.md Creates a chat component that displays a player's score from a specific objective. Requires the player name and objective name. ```Kotlin score(name: String, objective: String): ComponentText ``` -------------------------------- ### Executing Lua Script on Redis (Keys List) - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/alkaid-redis/IRedisConnection.md Executes a Lua script on the Redis server. This method takes the script string, a list of keys involved in the script, and a list of arguments. It is used for complex atomic operations. ```Kotlin eval(script: String, keys: List, args: List): Any? ``` -------------------------------- ### Parse Simple List to Raw JSON List - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/chat/Components.md Parses a list of strings in the simplified format and converts each into its raw JSON string representation, allowing for custom transformations. ```Kotlin parseSimpleToRaw(text: List, transfer: TextTransfer.() -> Unit): List ``` -------------------------------- ### Adding Kether Player Operator (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/kether/api/Kether.md Registers a player operator under the given name. ```Kotlin addPlayerOperator(name: String, operator: PlayerOperator): Unit ``` -------------------------------- ### Subscribing to Redis Channels - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/alkaid-redis/IRedisConnection.md Subscribes to one or more Redis channels. A function block is provided to handle incoming messages. Supports pattern matching for channels. ```Kotlin subscribe(vararg channel: String, patternMode: Boolean = false, func: RedisMessage.() -> Unit) ``` -------------------------------- ### Count Items Matching Custom Rule in Inventory (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/util/ItemMatcher.md Counts the total number of items in the Inventory that match a custom 'matcher' function. Returns the count as an integer. The 'matcher' is a lambda function that takes an ItemStack and returns a Boolean. ```Kotlin Inventory.countItem(matcher: (itemStack: ItemStack) -> Boolean): Int ``` -------------------------------- ### Parse Simple Format Component - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/chat/Components.md Parses a chat component from a custom simplified format string (e.g., 'Text1[SpecialText2](property=value)Text3'). Returns a SimpleComponent. ```Kotlin parseSimple(text: String): SimpleComponent ``` -------------------------------- ### Parse Simple to Raw JSON - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/chat/Components.md Parses a single string in the simplified format and converts it into its raw JSON string representation, allowing for custom transformations during the process. ```Kotlin parseSimpleToRaw(text: String, transfer: TextTransfer.() -> Unit): String ``` -------------------------------- ### Executing Lua Script on Redis (Key Count) - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/alkaid-redis/IRedisConnection.md Executes a Lua script on the Redis server. This overload takes the script string, the number of keys, and a list of arguments. It is used for complex atomic operations. ```Kotlin eval(script: String, keyC: Int, args: List): Any? ``` -------------------------------- ### Check Inventory for Items Matching Custom Rule (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/util/ItemMatcher.md Checks if an Inventory contains items matching a custom 'matcher' function in the required amount. Returns true if the required amount of matching items is found, false otherwise. The 'matcher' is a lambda function that takes an ItemStack and returns a Boolean. ```Kotlin Inventory.hasItem(amount: Int = 1, matcher: (itemStack: ItemStack) -> Boolean): Boolean ``` -------------------------------- ### Registered Kether Player Operators Map (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/kether/api/Kether.md A public static field storing registered player operators, mapped by their name, maintaining insertion order. ```Kotlin registeredPlayerOperator: LinkedHashMap ``` -------------------------------- ### Publishing Message to Redis Channel - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/alkaid-redis/IRedisConnection.md Publishes a message to a specified Redis channel. Subscribers listening on this channel will receive the message. Used for implementing message communication. ```Kotlin publish(channel: String, message: Any) ``` -------------------------------- ### Measure Code Block Execution Time - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/common-util/util/Execution.md This Kotlin extension function executes a given code block (`task`) and returns a Pair containing the result of the block and the time taken for execution in milliseconds. It utilizes `System.nanoTime()` for high-precision timing. ```Kotlin execution(crossinline task: () -> T): Pair ``` -------------------------------- ### Public Methods Overview - ItemTagSerializer - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/nms/tag/ItemTagSerializer.md Lists the primary public methods provided by the ItemTagSerializer object for converting ItemTag, ItemTagList, and ItemTagData to and from JSON formats (JsonObject, JsonArray, JsonElement). These methods form the core API for serialization and deserialization. ```Kotlin fun serializeTag(tag: ItemTag): JsonObject fun serializeList(tagList: ItemTagList): JsonArray fun serializeData(tagData: ItemTagData): JsonElement fun deserializeTag(json: JsonObject): ItemTag fun deserializeArray(json: JsonArray): ItemTagList fun deserializeData(json: JsonElement): ItemTagData ``` -------------------------------- ### Parse Raw JSON Component - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/minecraft/chat/Components.md Parses a chat component from its raw JSON string representation. This is the standard format used by the game. ```Kotlin parseRaw(text: String): ComponentText ``` -------------------------------- ### Check Player Inventory for Specific Item (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/util/ItemMatcher.md Checks if a player's inventory contains a specific ItemStack in the required amount. Optionally removes the items if the 'remove' flag is true. Returns true if the items are found (and removed if requested), false otherwise. Throws an error if the item is air. ```Kotlin Player.checkItem(item: ItemStack, amount: Int = 1, remove: Boolean = false): Boolean ``` -------------------------------- ### Registered Kether Script Properties Map (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/kether/api/Kether.md A public static field storing registered script properties, mapped by the target class and property ID. ```Kotlin registeredScriptProperty: HashMap, MutableMap>> ``` -------------------------------- ### Adding Kether Script Property (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/kether/api/Kether.md Registers a script property for a specific target class. ```Kotlin addScriptProperty(clazz: Class<*>, property: ScriptProperty<*>): Unit ``` -------------------------------- ### Kether Tolerance Parser Flag (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/kether/api/Kether.md A public static field controlling whether the lenient parser mode is enabled for Kether scripts. Defaults to true. ```Kotlin isAllowToleranceParser: Boolean ``` -------------------------------- ### Remove Items Matching Custom Rule from Inventory (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/util/ItemMatcher.md Removes a specific amount of items matching a custom 'matcher' function from the Inventory. The removed items are added to the 'takeList'. Returns true if the items were successfully removed, false otherwise. Note that this method modifies the original inventory content. ```Kotlin Inventory.takeItem(amount: Int = 1, takeList: MutableList = mutableListOf(), matcher: (itemStack: ItemStack) -> Boolean): Boolean ``` -------------------------------- ### Check Inventory for Specific Item (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/util/ItemMatcher.md Checks if an Inventory contains a specific ItemStack in the required amount. Optionally removes the items if the 'remove' flag is true. Returns true if the items are found (and removed if requested), false otherwise. Throws an error if the item is air. ```Kotlin Inventory.checkItem(item: ItemStack, amount: Int = 1, remove: Boolean = false): Boolean ``` -------------------------------- ### Acquiring Distributed Lock and Executing Action - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/alkaid-redis/IRedisConnection.md Obtains a distributed lock object for the specified lock name and immediately executes a provided action block within the lock's context. Ensures the action is performed atomically. ```Kotlin getLock(lockName: String, action: Lock.() -> Unit): Lock ``` -------------------------------- ### Adding Members to Redis Set - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/alkaid-redis/IRedisConnection.md Adds one or more members to a set stored at the specified key. If the key does not exist, a new set is created. Returns the number of elements that were added. ```Kotlin sadd(key: String, vararg value: String): Long ``` -------------------------------- ### Setting Key-Value Pair If Not Exists - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/alkaid-redis/IRedisConnection.md Sets the value for a given key only if the key does not already exist in Redis. This operation is atomic and commonly used for implementing locks or ensuring unique resource creation. ```Kotlin setNx(key: String, value: String?) ``` -------------------------------- ### Deserialization Logic - ItemTagSerializer - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/nms/tag/ItemTagSerializer.md Describes the process of deserializing JSON back into ItemTagData. The logic branches based on the JsonElement type (Array, Object, Primitive). String primitives are further parsed based on suffixes or the presence of a closing bracket ']' to identify basic or array types. NumberConversions is used for type casting. ```Kotlin // Conceptual deserialization flow for JsonPrimitive strings: fun parseStringPrimitive(str: String): ItemTagData { return when { str.endsWith("]") -> parseArray(str) // Handles INT_ARRAY, BYTE_ARRAY, LONG_ARRAY else -> parsePrimitive(str) // Handles BYTE, SHORT, INT, LONG, FLOAT, DOUBLE, STRING based on suffix } } ``` -------------------------------- ### Setting Key-Value Pair with Expiration - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/alkaid-redis/IRedisConnection.md Sets the value for a given key and specifies an expiration time. The key will be automatically removed from Redis after the specified duration. Time unit can be specified. ```Kotlin setEx(key: String, value: String?, seconds: Long, timeUnit: TimeUnit) ``` -------------------------------- ### Checking Key Existence in Redis - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/alkaid-redis/IRedisConnection.md Checks if a specified key exists in Redis. Returns true if the key exists, false otherwise. ```Kotlin contains(key: String): Boolean ``` -------------------------------- ### Serialization Logic & Suffixes - ItemTagSerializer - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/nms/tag/ItemTagSerializer.md Explains the custom serialization format used by ItemTagSerializer. Compound and List types are handled recursively. Basic types are serialized as strings with specific suffixes indicating their original type. Array types are comma-separated strings with a type identifier and closing bracket. ```Kotlin // Basic type suffixes: // BYTE: "b" (e.g., "10b") // SHORT: "s" (e.g., "100s") // INT: "i" (e.g., "1000i") // LONG: "l" (e.g., "10000l") // FLOAT: "f" (e.g., "10.5f") // DOUBLE: "d" (e.g., "10.5d") // STRING/END: "t" (e.g., "textt") // Array type suffixes: // INT_ARRAY: "i]" (e.g., "1,2,3i]") // BYTE_ARRAY: "b]" (e.g., "1,2,3b]") // LONG_ARRAY: "l]" (e.g., "1,2,3l]") ``` -------------------------------- ### Setting Key Expiration Time - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/alkaid-redis/IRedisConnection.md Sets the expiration time for an existing key in Redis. The key will be automatically removed after the specified duration. Time unit can be specified. ```Kotlin expire(key: String, value: Long, timeUnit: TimeUnit) ``` -------------------------------- ### Setting Key-Value Pair in Redis - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/alkaid-redis/IRedisConnection.md Sets the value for a given key in Redis. If the key already exists, its value is overwritten. A null value can be used to effectively remove the key. ```Kotlin set(key: String, value: String?) ``` -------------------------------- ### Removing Kether Action (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/kether/api/Kether.md Removes a registered script action parser by name and optional namespace. ```Kotlin removeAction(name: String, namespace: String? = null): Unit ``` -------------------------------- ### Replace ItemStack Lore (Batch) (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/util/ItemModifier.md Performs multiple lore replacements on each line of the ItemStack's lore based on the provided map of old string to new string. This operation only applies if the item already has lore. ```Kotlin ItemStack.replaceLore(map: Map): ItemStack ``` -------------------------------- ### Deleting Key from Redis - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/alkaid-redis/IRedisConnection.md Removes the specified key and its associated value from Redis. If the key does not exist, the command is ignored. ```Kotlin delete(key: String) ``` -------------------------------- ### Checking Membership in Redis Set - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/alkaid-redis/IRedisConnection.md Checks if a given member is a member of the set stored at the specified key. Returns true if the element is a member, false otherwise or if the key does not exist. ```Kotlin sismember(key: String, value: String): Boolean ``` -------------------------------- ### Replace ItemStack Lore (Single) (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/util/ItemModifier.md Replaces the first occurrence of a specific substring (loreOld) with another string (loreNew) within each line of the ItemStack's lore. This operation only applies if the item already has lore. ```Kotlin ItemStack.replaceLore(loreOld: String, loreNew: String): ItemStack ``` -------------------------------- ### Replace ItemStack Name (Batch) (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/util/ItemModifier.md Performs multiple name replacements on the ItemStack's display name based on the provided map of old string to new string. This operation only applies if the item already has a name. ```Kotlin ItemStack.replaceName(map: Map): ItemStack ``` -------------------------------- ### Check ItemStack Has Lore (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/util/ItemModifier.md Checks if an ItemStack has any lore lines. If a specific lore string is provided, it checks if any line of the item's lore matches that string. The lore check is case-sensitive. ```Kotlin ItemStack.hasLore(lore: String? = null): Boolean ``` -------------------------------- ### Acquiring Distributed Lock on Redis - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/alkaid-redis/IRedisConnection.md Obtains a distributed lock object for the specified lock name. This is used to implement synchronization in distributed systems, as mentioned in the usage scenarios. ```Kotlin getLock(lockName: String): Lock ``` -------------------------------- ### Defining ProxyLocation Type Alias in Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/common-util/util/Alias.md Defines a type alias `ProxyLocation` for the `Location` type, serving as a proxy or compatibility layer for location data across different platforms or implementations. ```Kotlin typealias ProxyLocation = Location ``` -------------------------------- ### Check Material is Not Air (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/util/ItemModifier.md Checks if a Material is not considered "air". This is the inverse of isAir(). Uses Kotlin contracts for null safety, ensuring the object is not null when the function returns true. ```Kotlin Material?.isNotAir(): Boolean ``` -------------------------------- ### Check Material for Air (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/util/ItemModifier.md Checks if a Material is considered "air" (null, Material.AIR, or name ending in "_AIR"). Uses Kotlin contracts for null safety, ensuring the object is not null when the function returns false. ```Kotlin Material?.isAir(): Boolean ``` -------------------------------- ### Closing Redis Connection - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/alkaid-redis/IRedisConnection.md Closes the current Redis connection, releasing associated resources. It is important to properly close connections when they are no longer needed. ```Kotlin close() ``` -------------------------------- ### Check ItemStack Has Name (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/util/ItemModifier.md Checks if an ItemStack has a custom display name. If a specific name string is provided, it checks if the item's name matches that string. The name check is case-sensitive. ```Kotlin ItemStack.hasName(name: String? = null): Boolean ``` -------------------------------- ### Modify ItemMeta Lore (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/util/ItemModifier.md Edits the lore (description lines) of an ItemMeta using a lambda function that operates on a mutable list of strings. This provides a fluent way to add, remove, or modify lore lines. ```Kotlin ItemMeta.modifyLore(func: MutableList.() -> Unit): ItemMeta ``` -------------------------------- ### Check ItemStack is Not Air (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/util/ItemModifier.md Checks if an ItemStack is not considered "air". This is the inverse of isAir(). Uses Kotlin contracts for null safety, ensuring the object is not null when the function returns true. ```Kotlin ItemStack?.isNotAir(): Boolean ``` -------------------------------- ### Replace ItemStack Name (Single) (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/util/ItemModifier.md Replaces the first occurrence of a specific substring (nameOld) with another string (nameNew) within the ItemStack's display name. This operation only applies if the item already has a name. ```Kotlin ItemStack.replaceName(nameOld: String, nameNew: String): ItemStack ``` -------------------------------- ### Removing Kether Script Property (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/kether/api/Kether.md Removes a registered script property for a specific class by its ID. ```Kotlin removeScriptProperty(clazz: Class<*>, id: String): Unit ``` -------------------------------- ### Removing Members from Redis Set - Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/database/alkaid-redis/IRedisConnection.md Removes one or more members from a set stored at the specified key. Members that do not exist in the set are ignored. Returns the number of elements that were removed. ```Kotlin srem(key: String, vararg value: String): Long ``` -------------------------------- ### Modify ItemStack Lore (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/util/ItemModifier.md Edits the lore (description lines) of an ItemStack using a lambda function that operates on a mutable list of strings. This provides a fluent way to add, remove, or modify lore lines directly on the ItemStack. Calling this on an "air" item will throw an "air" error. ```Kotlin ItemStack.modifyLore(func: MutableList.() -> Unit): ItemStack ``` -------------------------------- ### Defining MapList Type Alias in Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/common-util/util/Alias.md Defines a type alias `MapList` for a list of maps, useful for representing a collection of key-value pairs where the collection itself is ordered. ```Kotlin typealias MapList = List> ``` -------------------------------- ### Check ItemStack for Air (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/util/ItemModifier.md Checks if an ItemStack is considered "air" (null, Material.AIR, or name ending in "_AIR"). Uses Kotlin contracts for null safety, ensuring the object is not null when the function returns false. Calling modifyMeta or modifyLore on an "air" item will throw an error. ```Kotlin ItemStack?.isAir(): Boolean ``` -------------------------------- ### Defining ProxyVector Type Alias in Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/common-util/util/Alias.md Defines a type alias `ProxyVector` for the `Vector` type, intended for use as a proxy or compatibility layer across different platforms or implementations. ```Kotlin typealias ProxyVector = Vector ``` -------------------------------- ### Defining MatrixList Type Alias in Kotlin Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/common-util/util/Alias.md Defines a type alias `MatrixList` for a list of lists, commonly used to represent a 2D list or matrix structure in Kotlin. ```Kotlin typealias MatrixList = List> ``` -------------------------------- ### Modify ItemStack Metadata (Kotlin) Source: https://github.com/blue-soul-commits/taboolib-doc/blob/master/module/util/ItemModifier.md Edits the metadata of an ItemStack using a lambda function. Supports generic ItemMeta types, allowing operations on specific metadata subclasses. Calling this on an "air" item will throw an "air" error. ```Kotlin ItemStack.modifyMeta(func: T.() -> Unit): ItemStack ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.