正在积极寻找设计师为 Logo 提供设计
如果有兴趣,请通过 Discord 私聊我:nolly__
TextAPI 是一个以 Kotlin 为主的 Spigot API/库,用于高级文本解析、格式化和渲染。它将 MiniMessage 风格的标签、PlaceholderAPI 风格的占位符、渐变、彩虹效果、悬停/点击/插入事件以及运行时扩展性整合到一个高性能系统中。

概述
TextAPI 专为希望在游戏中实现丰富文本效果而不增加复杂性的插件开发者而设计。它可以作为其他插件的依赖项使用,也可以独立运行——如果你希望通过内置调试命令来测试和探索其功能的话。重点在于提供清晰的开发体验(DX)、强大的用户体验(UX)以及可预测的渲染行为。
它支持内置颜色、十六进制颜色、装饰效果、渐变、骄傲色预设、占位符、传统字符串输出以及组件输出。此外,开发者可以在运行时注册和注销自定义占位符、自定义标签和自定义渐变,而无需触碰渲染器内部逻辑。
功能特性
TextAPI 解析紧凑的标记语法,并将其转换为传统格式化文本或 Bungee 聊天组件。它支持:
- 命名颜色和十六进制颜色
- 粗体、斜体、下划线、删除线和随机乱码等装饰效果
- 带有多个颜色停止点的渐变
- 带相位控制的彩虹文字
- 悬停和点击操作
- 插入内容
- 占位符展开
- 带处理回调的运行时自定义标签
- 带命名预设的运行时自定义渐变
最终结果是一个灵活的格式引擎,感觉像是混合多种文本系统时更简洁、更轻量且更具可扩展性的替代方案。
性能
性能是核心设计目标之一。TextAPI 使用单遍词法分析器、基于栈的渲染器以及轻量级上下文解析,以保持解析快速且可预测。渐变和彩虹效果仅在需要时展开,占位符查找通过标准化注册表解决,而非反射或重型动态检查。
渲染管线旨在最小化不必要的内存分配,同时保留嵌套格式、事件支持和样式继承。自定义 TPS 跟踪器驱动实时的服务器时间占位符,无需依赖外部组件。最终结果是一个快速且实用的 API,完全适用于实时游戏内使用。
开发体验
该 API 旨在易于学习和扩展。开发者可以:
- 直接解析字符串
- 获取用于聊天输出的组件
- 向玩家发送消息
- 检查令牌以进行调试
- 在运行时注册和注销占位符
- 在运行时注册和注销标签
- 在运行时注册和注销渐变
命令系统也经过精心设计,足够强大,因此该项目可以在不编写额外集成代码的情况下,直接在游戏内进行独立测试。这使得它既可作为依赖项使用,也可作为实验期间的开发者工具。
内置内容
TextAPI 附带广泛默认功能集:
- 玩家占位符
- 服务器占位符
- 时间占位符
- TPS 占位符
- 14 种骄傲渐变预设
- 常用文本装饰
- 悬停和点击交互
- 重置与转义处理
- 组件与传统输出
这为开发者提供了开箱即用的大量功能,同时在需要时仍留有自定义行为的余地。
扩展模型
自定义标签基于处理器机制,这意味着标签可以动态修改样式并响应参数。自定义渐变按名称注册并包含颜色停止点列表,便于定义和复用。占位符也可以注册带有玩家感知能力的解析器,使该 API 适合用于动态内容,如等级、前缀、来自其他系统的占位符或每个玩家的元数据。
测试与调试
为了直接测试,TextAPI 包含一个全面的内置调试命令,可以:
- 渲染消息
- 导出组件
- 导出令牌
- 列出占位符、标签和渐变
- 注册和注销运行时内容
- 预览渐变
- 在游戏内运行完整的功能测试集
这使得验证语法、检查结果以及验证新的运行时注册变得轻松,无需离开服务器环境。
总结
TextAPI 是将 MiniMessage 风格的格式化和 PlaceholderAPI 风格的动态内容结合到基于 Kotlin 的 Spigot 库中,然后针对快速解析、清晰的扩展性以及面向开发者的运行时控制进行优化的产物。
Actively searching a graphist for the logo
DM me on discord if interested: nolly__
TextAPI is a Kotlin-first Spigot API/library for advanced text parsing, formatting, and rendering. It combines MiniMessage-style tags, PlaceholderAPI-like placeholders, gradients, rainbow effects, hover/click/insertion events, and runtime extensibility into a single high-performance system.

Overview
TextAPI is designed for plugin developers who want rich in-game text without heavy complexity. It can be used as a dependency in other plugins, or standalone if you want to test and explore its features through the built-in debug command. The focus is on clean DX, strong UX, and predictable rendering behavior.
It supports built-in colors, hex colors, decorations, gradients, pride presets, placeholders, legacy string output, and component output. On top of that, developers can register and unregister custom placeholders, custom tags, and custom gradients at runtime without touching the renderer internals.
What it does
TextAPI parses a compact markup syntax and turns it into either legacy-formatted text or Bungee chat components. It supports:
- Named colors and hex colors
- Decorations like bold, italic, underline, strikethrough, and obfuscated
- Gradients with multiple color stops
- Rainbow text with phase control
- Hover and click actions
- Insertions
- Placeholder expansion
- Runtime custom tags with handler callbacks
- Runtime custom gradients with named presets
The result is a flexible formatting engine that feels like a cleaner, lighter, and more extensible alternative to mixing multiple text systems together.
Performance
Performance is a core design goal. TextAPI uses a single-pass tokenizer, a stack-based renderer, and lightweight context resolution to keep parsing fast and predictable. Gradients and rainbow effects are expanded only when needed, and placeholder lookups are resolved through a normalized registry instead of reflection or heavy dynamic inspection.
The rendering pipeline is built to minimize unnecessary allocations while still preserving nested formatting, event support, and style inheritance. A custom TPS tracker powers live server timing placeholders without relying on external dependencies. The end result is a fast API that stays practical for real-time in-game use.
Developer experience
The API is built to be easy to learn and easy to extend. Developers can:
- Parse strings directly
- Get components for chat output
- Send messages to players
- Inspect tokens for debugging
- Register and unregister placeholders at runtime
- Register and unregister tags at runtime
- Register and unregister gradients at runtime
The command system is intentionally powerful too, so the project can be tested standalone in-game without writing extra integration code. That makes it useful both as a dependency and as a developer tool during experimentation.
Built-in content
TextAPI ships with a broad default feature set:
- Player placeholders
- Server placeholders
- Time placeholders
- TPS placeholders
- 14 pride gradient presets
- Common text decorations
- Hover and click interactions
- Reset and escape handling
- Component and legacy outputs
This gives developers a lot out of the box while still leaving room for custom behavior when needed.
Extensibility model
Custom tags are handler-based, which means a tag can modify style dynamically and can react to arguments. Custom gradients are registered by name with color stop lists, making them easy to define and reuse. Placeholders can also be registered with player-aware resolvers, making the API suitable for dynamic content such as ranks, prefixes, placeholders from other systems, or per-player metadata.
Testing and debugging
For direct testing, TextAPI includes a comprehensive in-game debug command that can:
- Render messages
- Dump components
- Dump tokens
- List placeholders, tags, and gradients
- Register and unregister runtime content
- Preview gradients
- Run a full feature test set in-game
That makes it easy to validate syntax, inspect output, and verify new runtime registrations without leaving the server.
Summary
TextAPI is what you get when you combine MiniMessage-style formatting and PlaceholderAPI-style dynamic content into a Kotlin-based Spigot library, then optimize it for fast parsing, clean extensibility, and developer-friendly runtime control.
评论 0
登录后参与评分
还没有评论,来抢沙发吧