Skip to content

Commit e5c95af

Browse files
committed
Add stable MatrixStorage API namespace and bump 1.1.0
1 parent 01bc0df commit e5c95af

9 files changed

Lines changed: 302 additions & 32 deletions

File tree

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,24 @@ All notable changes to MatrixStorage will be documented in this file.
44

55
The format is based on Keep a Changelog, and this project follows Semantic Versioning for release tags.
66

7+
## [1.1.0] - 2026-04-05
8+
9+
### Added
10+
11+
- Added stable `com.y54895.matrixstorage.api` namespace.
12+
- Added immutable snapshots for status, definitions, mailbox messages, profiles, and block warehouses.
13+
- Added Dokka Javadoc generation.
14+
15+
### Changed
16+
17+
- Updated MatrixStorage to depend on `MatrixLib 1.5.0`.
18+
- Promoted selected storage state queries into a documented stable API surface.
19+
20+
### Validated
21+
22+
- Verified `bash ./gradlew build`.
23+
- Verified `bash ./gradlew generateJavadoc`.
24+
725
## [1.0.2] - 2026-04-05
826

927
### Added

README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
| 文档 | Release Notes | Releases | 依赖 |
66
| --- | --- | --- | --- |
7-
| [Docs](https://54895y.github.io/docs/matrixstorage) | [1.0.2](https://54895y.github.io/docs/matrixstorage/release-notes-1-0-2) | [GitHub Releases](https://github.com/54895y/MatrixStorage/releases) | [MatrixLib 1.4.0](https://github.com/54895y/MatrixLib) |
7+
| [Docs](https://54895y.github.io/docs/matrixstorage) | [1.1.0](https://54895y.github.io/docs/matrixstorage/release-notes-1-1-0) | [GitHub Releases](https://github.com/54895y/MatrixStorage/releases) | [MatrixLib 1.5.0](https://github.com/54895y/MatrixLib) |
88

99
## 当前发布
1010

11-
- 当前版本:`1.0.2`
12-
- 必需前置:`MatrixLib 1.4.0`
11+
- 当前版本:`1.1.0`
12+
- 必需前置:`MatrixLib 1.5.0`
1313
- 后端支持:`sqlite / mysql / redis / yaml`
1414
- 可选集成:`MatrixShop / Vault / CraftEngine / ItemsAdder / Nexo`
1515

@@ -54,9 +54,16 @@ MatrixStorage 当前接入 `MatrixLib` 的共享更新器。
5454
- 审批下载:`/matrixlib update approve MatrixStorage`
5555
- 更新包下载到 `plugins/update/`
5656

57+
## 稳定 API 命名空间
58+
59+
MatrixStorage 当前新增稳定公开层:
60+
61+
- `com.y54895.matrixstorage.api`
62+
- `com.y54895.matrixstorage.api.model`
63+
5764
## 文档入口
5865

5966
- [概览](https://54895y.github.io/docs/matrixstorage)
60-
- [1.0.2 发布说明](https://54895y.github.io/docs/matrixstorage/release-notes-1-0-2)
67+
- [1.1.0 发布说明](https://54895y.github.io/docs/matrixstorage/release-notes-1-1-0)
6168
- [bStats 与遥测](https://54895y.github.io/docs/matrixstorage/bstats-and-telemetry)
6269
- [Matrix 插件总文档入口](https://54895y.github.io/docs/plugins)

RELEASE_POST_BBCODE.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[center][size=6][b]MatrixStorage[/b][/size][/center]
22
[center][size=4]Matrix 系列统一仓储插件 / 储存库插件[/size][/center]
3-
[center][size=3]当前发布版本:1.0.2[/size][/center]
3+
[center][size=3]当前发布版本:1.1.0[/size][/center]
44

55
[hr]
66

@@ -61,10 +61,11 @@ MatrixStorage 是 Matrix 系列的统一仓储插件,围绕玩家邮箱、个
6161
当前代码基线重点如下:
6262

6363
[list]
64-
[*]当前发布版本已升级到 1.0.2
64+
[*]当前发布版本已升级到 1.1.0
6565
[*]共享货币定义已统一来自 MatrixLib
6666
[*]新增通过 MatrixLib 共享 API 注册的 bStats 遥测
6767
[*]新增通过 MatrixLib 共享更新器参与 GitHub Releases 更新检查与审批下载
68+
[*]新增稳定 API 命名空间 com.y54895.matrixstorage.api / api.model
6869
[*]MatrixLib / MatrixShop / MatrixStorage 三端会同步 Economy/currency.yml
6970
[*]仓库与邮箱支持多条件、多价格、多货币解锁格子
7071
[*]玩家总览页可直接执行容量扩容

RELEASE_POST_MINEBBS_BBCODE.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[center][size=7][b]MatrixStorage[/b][/size][/center]
22
[center][size=4][color=#3D8BFF]Matrix 系列统一仓储插件 / 储存库插件[/color][/size][/center]
33
[center][color=#999999]邮箱 / 仓库 / 待收区 / 实体仓库 / MatrixShop 外部投递[/color][/center]
4-
[center][color=#999999]当前发布版本:1.0.2[/color][/center]
4+
[center][color=#999999]当前发布版本:1.1.0[/color][/center]
55

66
[hr]
77

@@ -88,10 +88,11 @@ MatrixStorage 围绕玩家邮箱、个人仓库、待收区、位置型实体仓
8888
[b]当前代码基线重点:[/b]
8989

9090
[list]
91-
[*]当前发布版本已升级到 1.0.2
91+
[*]当前发布版本已升级到 1.1.0
9292
[*]共享货币定义已统一来自 MatrixLib
9393
[*]新增通过 MatrixLib 共享 API 注册的 bStats 遥测
9494
[*]新增通过 MatrixLib 共享更新器参与 GitHub Releases 更新检查与审批下载
95+
[*]新增稳定 API 命名空间 com.y54895.matrixstorage.api / api.model
9596
[*]MatrixLib / MatrixShop / MatrixStorage 三端会同步 Economy/currency.yml
9697
[*]仓库与邮箱支持多条件、多价格、多货币解锁格子
9798
[*]玩家总览页可直接执行容量扩容

docs/api/overview.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
Module MatrixStorage API
22

3-
MatrixStorage 当前没有单独拆分稳定 `api/` 包,开发者文档应优先参考平台入口、模型、服务和 UI 分层。
3+
MatrixStorage 当前稳定公开层:
44

5-
Recommended reference areas:
5+
- `com.y54895.matrixstorage.api`
6+
- `com.y54895.matrixstorage.api.model`
67

7-
- `MatrixStorage`
8-
- `MatrixStoragePlatform`
9-
- `bridge/`
10-
- `integration/`
11-
- `model/`
12-
- `service/`
13-
- `storage/`
14-
- `ui/`
8+
Recommended entry points:
9+
10+
- `MatrixStorageApi`
11+
- `MatrixStorageStatusSnapshot`
12+
- `MatrixStorageDefinitionSnapshot`
13+
- `MatrixStorageMailboxMessageSnapshot`
14+
- `MatrixStorageProfileSnapshot`
15+
- `MatrixStorageBlockWarehouseSnapshot`
1516

1617
Code tree:
1718

1819
```text
1920
src/main/kotlin/com/y54895/matrixstorage/
2021
├─ MatrixStorage.kt
2122
├─ MatrixStoragePlatform.kt
23+
├─ api/
2224
├─ bridge/
2325
├─ command/
2426
├─ integration/

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
group=com.y54895.matrixstorage
2-
version=1.0.2
3-
matrixlibApiVersion=1.4.0
2+
version=1.1.0
3+
matrixlibApiVersion=1.5.0
44
kotlin.incremental=true
55
kotlin.incremental.java=true
66
kotlin.caching.enabled=true
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
package com.y54895.matrixstorage.api
2+
3+
import com.y54895.matrixstorage.api.model.MatrixStorageBlockWarehouseSnapshot
4+
import com.y54895.matrixstorage.api.model.MatrixStorageDefinitionSnapshot
5+
import com.y54895.matrixstorage.api.model.MatrixStorageMailboxMessageSnapshot
6+
import com.y54895.matrixstorage.api.model.MatrixStorageProfileSnapshot
7+
import com.y54895.matrixstorage.api.model.MatrixStorageStatusSnapshot
8+
import com.y54895.matrixstorage.bridge.MatrixShopBridge
9+
import com.y54895.matrixstorage.service.StorageConfig
10+
import com.y54895.matrixstorage.service.StoragePersistenceService
11+
import com.y54895.matrixstorage.service.StorageStateService
12+
import org.bukkit.Bukkit
13+
import org.bukkit.Location
14+
import java.util.UUID
15+
16+
/**
17+
* Stable MatrixStorage facade for other Matrix plugins and third-party integrations.
18+
*/
19+
/**
20+
* Stable MatrixStorage facade for other Matrix plugins and third-party integrations.
21+
*/
22+
object MatrixStorageApi {
23+
24+
/**
25+
* Whether MatrixStorage is currently enabled on this server.
26+
*/
27+
fun isAvailable(): Boolean {
28+
return Bukkit.getPluginManager().getPlugin("MatrixStorage")?.isEnabled == true
29+
}
30+
31+
/**
32+
* Return the current MatrixStorage runtime summary snapshot.
33+
*/
34+
fun status(): MatrixStorageStatusSnapshot {
35+
return MatrixStorageStatusSnapshot(
36+
backendDescription = StoragePersistenceService.backendDescription(),
37+
mailboxCount = StorageStateService.mailboxCount(),
38+
blockWarehouseCount = StorageStateService.blockWarehouseCount(),
39+
definitionCount = StorageConfig.allDefinitions().size,
40+
matrixShopBridge = MatrixShopBridge.statusSummary()
41+
)
42+
}
43+
44+
/**
45+
* Return all configured warehouse definition snapshots.
46+
*/
47+
fun definitions(): List<MatrixStorageDefinitionSnapshot> {
48+
return StorageConfig.allDefinitions().map { definition ->
49+
MatrixStorageDefinitionSnapshot(
50+
key = definition.key,
51+
source = definition.source,
52+
type = definition.type,
53+
mode = definition.mode,
54+
id = definition.id,
55+
displayName = definition.displayName,
56+
inventorySize = definition.inventorySize
57+
)
58+
}
59+
}
60+
61+
/**
62+
* Return current mailbox message snapshots for an owner.
63+
*/
64+
fun mailbox(ownerId: UUID): List<MatrixStorageMailboxMessageSnapshot> {
65+
return StorageStateService.mailbox(ownerId).map { message ->
66+
MatrixStorageMailboxMessageSnapshot(
67+
id = message.id,
68+
ownerId = message.ownerId,
69+
ownerName = message.ownerName,
70+
senderId = message.senderId,
71+
senderName = message.senderName,
72+
sourceModule = message.sourceModule,
73+
sourceId = message.sourceId,
74+
text = message.text,
75+
hasAttachedItem = message.attachedItem != null,
76+
money = message.money,
77+
currencyKey = message.currencyKey,
78+
createdAt = message.createdAt,
79+
claimed = message.claimed,
80+
archived = message.archived
81+
)
82+
}
83+
}
84+
85+
/**
86+
* Return the storage profile snapshot for an owner.
87+
*/
88+
fun profile(ownerId: UUID, ownerName: String = ownerId.toString()): MatrixStorageProfileSnapshot {
89+
val profile = StorageStateService.profile(ownerId, ownerName)
90+
return MatrixStorageProfileSnapshot(
91+
ownerId = profile.ownerId,
92+
ownerName = profile.ownerName,
93+
warehouseSize = profile.warehouseContents.size,
94+
pendingSize = profile.pendingContents.size,
95+
warehouseUsedSlots = profile.warehouseContents.count { it != null && it.type.name != "AIR" },
96+
pendingUsedSlots = profile.pendingContents.count { it != null && it.type.name != "AIR" },
97+
unlockedWarehouseSlots = profile.unlockedWarehouseSlots,
98+
unlockedMailboxSlots = profile.unlockedMailboxSlots
99+
)
100+
}
101+
102+
/**
103+
* Resolve a block warehouse snapshot by id.
104+
*/
105+
fun blockWarehouse(id: String): MatrixStorageBlockWarehouseSnapshot? {
106+
return StorageStateService.blockWarehouse(id)?.let(::snapshot)
107+
}
108+
109+
/**
110+
* Resolve a block warehouse snapshot by location.
111+
*/
112+
fun blockWarehouse(location: Location): MatrixStorageBlockWarehouseSnapshot? {
113+
return StorageStateService.blockWarehouse(location)?.let(::snapshot)
114+
}
115+
116+
/**
117+
* List all block warehouse snapshots owned by a player.
118+
*/
119+
fun ownedBlockWarehouses(ownerId: UUID): List<MatrixStorageBlockWarehouseSnapshot> {
120+
return StorageStateService.ownedBlockWarehouses(ownerId).map(::snapshot)
121+
}
122+
123+
private fun snapshot(record: com.y54895.matrixstorage.model.BlockWarehouseRecord): MatrixStorageBlockWarehouseSnapshot {
124+
return MatrixStorageBlockWarehouseSnapshot(
125+
id = record.id,
126+
definitionKey = record.definitionKey,
127+
ownerId = record.ownerId,
128+
ownerName = record.ownerName,
129+
worldName = record.worldName,
130+
x = record.x,
131+
y = record.y,
132+
z = record.z,
133+
source = record.source,
134+
type = record.type,
135+
displayId = record.displayId,
136+
inventorySize = record.inventorySize,
137+
displayName = record.displayName,
138+
trustedPlayers = record.trust.toSet(),
139+
allowHopperInsert = record.allowHopperInsert,
140+
allowHopperExtract = record.allowHopperExtract,
141+
comparatorEnabled = record.comparatorEnabled,
142+
usesNativeInventory = record.usesNativeInventory
143+
)
144+
}
145+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
package com.y54895.matrixstorage.api.model
2+
3+
import com.y54895.matrixstorage.model.PlacementMode
4+
import com.y54895.matrixstorage.model.PlacementSource
5+
import com.y54895.matrixstorage.model.PlacementType
6+
import java.util.UUID
7+
8+
/**
9+
* Immutable runtime summary snapshot exposed by the stable MatrixStorage API.
10+
*/
11+
data class MatrixStorageStatusSnapshot(
12+
val backendDescription: String,
13+
val mailboxCount: Int,
14+
val blockWarehouseCount: Int,
15+
val definitionCount: Int,
16+
val matrixShopBridge: String
17+
)
18+
19+
/**
20+
* Immutable warehouse-definition snapshot exposed by the stable MatrixStorage API.
21+
*/
22+
data class MatrixStorageDefinitionSnapshot(
23+
val key: String,
24+
val source: PlacementSource,
25+
val type: PlacementType,
26+
val mode: PlacementMode,
27+
val id: String,
28+
val displayName: String,
29+
val inventorySize: Int
30+
)
31+
32+
/**
33+
* Immutable mailbox-message snapshot exposed by the stable MatrixStorage API.
34+
*/
35+
data class MatrixStorageMailboxMessageSnapshot(
36+
val id: String,
37+
val ownerId: UUID,
38+
val ownerName: String,
39+
val senderId: UUID?,
40+
val senderName: String,
41+
val sourceModule: String,
42+
val sourceId: String,
43+
val text: String,
44+
val hasAttachedItem: Boolean,
45+
val money: Double,
46+
val currencyKey: String,
47+
val createdAt: Long,
48+
val claimed: Boolean,
49+
val archived: Boolean
50+
)
51+
52+
/**
53+
* Immutable warehouse-profile snapshot exposed by the stable MatrixStorage API.
54+
*/
55+
data class MatrixStorageProfileSnapshot(
56+
val ownerId: UUID,
57+
val ownerName: String,
58+
val warehouseSize: Int,
59+
val pendingSize: Int,
60+
val warehouseUsedSlots: Int,
61+
val pendingUsedSlots: Int,
62+
val unlockedWarehouseSlots: Int,
63+
val unlockedMailboxSlots: Int
64+
)
65+
66+
/**
67+
* Immutable block-warehouse snapshot exposed by the stable MatrixStorage API.
68+
*/
69+
data class MatrixStorageBlockWarehouseSnapshot(
70+
val id: String,
71+
val definitionKey: String,
72+
val ownerId: UUID,
73+
val ownerName: String,
74+
val worldName: String,
75+
val x: Int,
76+
val y: Int,
77+
val z: Int,
78+
val source: PlacementSource,
79+
val type: PlacementType,
80+
val displayId: String,
81+
val inventorySize: Int,
82+
val displayName: String,
83+
val trustedPlayers: Set<UUID>,
84+
val allowHopperInsert: Boolean,
85+
val allowHopperExtract: Boolean,
86+
val comparatorEnabled: Boolean,
87+
val usesNativeInventory: Boolean
88+
)

0 commit comments

Comments
 (0)