|
| 1 | +--- |
| 2 | +title: MatrixLib 开发者 API |
| 3 | +description: MatrixLib 面向开发者的公开 API 范围与 Javadoc 生成方式。 |
| 4 | +--- |
| 5 | + |
| 6 | +# MatrixLib 开发者 API |
| 7 | + |
| 8 | +MatrixLib 当前公开的开发者 API 主要集中在这些包: |
| 9 | + |
| 10 | +- `com.y54895.matrixlib.api.action` |
| 11 | +- `com.y54895.matrixlib.api.brand` |
| 12 | +- `com.y54895.matrixlib.api.compat` |
| 13 | +- `com.y54895.matrixlib.api.console` |
| 14 | +- `com.y54895.matrixlib.api.economy` |
| 15 | +- `com.y54895.matrixlib.api.hologram` |
| 16 | +- `com.y54895.matrixlib.api.menu` |
| 17 | +- `com.y54895.matrixlib.api.metrics` |
| 18 | +- `com.y54895.matrixlib.api.resource` |
| 19 | +- `com.y54895.matrixlib.api.text` |
| 20 | +- `com.y54895.matrixlib.api.update` |
| 21 | + |
| 22 | +## 代码树 |
| 23 | + |
| 24 | +当前 `MatrixLib` 代码树里,面向开发者的入口和内部支撑层大致是这样: |
| 25 | + |
| 26 | +```text |
| 27 | +src/main/kotlin/com/y54895/matrixlib/ |
| 28 | +├─ MatrixLib.kt |
| 29 | +├─ api/ |
| 30 | +│ ├─ action/ |
| 31 | +│ │ └─ ActionApi.kt |
| 32 | +│ ├─ brand/ |
| 33 | +│ │ └─ MatrixBranding.kt |
| 34 | +│ ├─ compat/ |
| 35 | +│ │ └─ CompatApi.kt |
| 36 | +│ ├─ console/ |
| 37 | +│ │ └─ MatrixConsoleVisuals.kt |
| 38 | +│ ├─ economy/ |
| 39 | +│ │ └─ MatrixEconomy.kt |
| 40 | +│ ├─ hologram/ |
| 41 | +│ │ ├─ MatrixHologramRequest.kt |
| 42 | +│ │ ├─ MatrixHolograms.kt |
| 43 | +│ │ └─ internal/ |
| 44 | +│ │ ├─ CMIHologramsAdapter.kt |
| 45 | +│ │ ├─ DecentHologramsAdapter.kt |
| 46 | +│ │ ├─ FancyHologramsAdapter.kt |
| 47 | +│ │ └─ MatrixHologramAdapter.kt |
| 48 | +│ ├─ menu/ |
| 49 | +│ │ └─ MenuApi.kt |
| 50 | +│ ├─ metrics/ |
| 51 | +│ │ └─ MatrixBStats.kt |
| 52 | +│ ├─ resource/ |
| 53 | +│ │ └─ MatrixResourceFiles.kt |
| 54 | +│ ├─ text/ |
| 55 | +│ │ ├─ MatrixText.kt |
| 56 | +│ │ └─ MatrixYamlBundle.kt |
| 57 | +│ └─ update/ |
| 58 | +│ └─ MatrixPluginUpdates.kt |
| 59 | +├─ command/ |
| 60 | +│ └─ MatrixLibCommands.kt |
| 61 | +└─ metrics/ |
| 62 | + └─ BStatsMetrics.kt |
| 63 | +``` |
| 64 | + |
| 65 | +推荐约定: |
| 66 | + |
| 67 | +- 业务插件开发时优先使用 `api/` 下的类型。 |
| 68 | +- `api/hologram/internal/` 视为提供者桥接内部层,不建议下游直接依赖。 |
| 69 | +- `command/` 和 `metrics/` 目录主要是 MatrixLib 自身运行时接入,不作为稳定业务 API。 |
| 70 | + |
| 71 | +## 生成 Javadoc |
| 72 | + |
| 73 | +MatrixLib 使用 `Dokka Javadoc` 生成 Kotlin API 文档。 |
| 74 | + |
| 75 | +本地命令: |
| 76 | + |
| 77 | +```bash |
| 78 | +cd /www/codex-work/MatrixLib |
| 79 | +bash ./gradlew generateJavadoc |
| 80 | +``` |
| 81 | + |
| 82 | +输出目录: |
| 83 | + |
| 84 | +```text |
| 85 | +build/dokka/javadoc/ |
| 86 | +``` |
| 87 | + |
| 88 | +构建产物: |
| 89 | + |
| 90 | +```text |
| 91 | +build/libs/MatrixLib-<version>-javadoc.jar |
| 92 | +``` |
| 93 | + |
| 94 | +## 推荐阅读入口 |
| 95 | + |
| 96 | +- `MatrixBranding` |
| 97 | +- `MatrixText` |
| 98 | +- `MatrixYamlBundle` |
| 99 | +- `MenuLoader` |
| 100 | +- `MenuRenderer` |
| 101 | +- `MatrixEconomy` |
| 102 | +- `MatrixHolograms` |
| 103 | +- `MatrixBStats` |
| 104 | +- `MatrixPluginUpdates` |
0 commit comments