Skip to content
Merged

Dev #49

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
79ab250
refactor: optimize stats hot paths and queries
lwenk Jul 13, 2026
d6226b4
test: centralize and verify stats ranking
lwenk Jul 13, 2026
046b1cc
perf: index custom stat names by enum
lwenk Jul 13, 2026
11ab235
perf: store custom stats in indexed counters
lwenk Jul 13, 2026
ce7ab39
perf: hash online player lookups
lwenk Jul 13, 2026
942c7de
perf: index cached stats with phmap
lwenk Jul 13, 2026
7585934
perf: avoid copying stats maps for forms
lwenk Jul 13, 2026
cdea10e
perf: optimize phmap allocation and player lookups
lwenk Jul 13, 2026
2439c89
fix: refresh cached player metadata on join
lwenk Jul 13, 2026
a01afa8
refactor: extract stats JSON codec
lwenk Jul 13, 2026
a27bc1b
refactor: centralize stats type schema
lwenk Jul 13, 2026
fccbf1f
refactor: drive stats handling from schema
lwenk Jul 13, 2026
7a6cc9b
refactor: extract stats file repository
lwenk Jul 13, 2026
2e4d676
refactor: move persistence out of player sessions
lwenk Jul 13, 2026
61ec0bc
refactor: decouple player sessions from Bedrock
lwenk Jul 13, 2026
0508c47
refactor: improve runtime lifecycle and stats performance
lwenk Jul 13, 2026
3084c28
fix: recover interrupted stats snapshots
lwenk Jul 13, 2026
9da278a
build: prepare 0.8.3 release metadata
lwenk Jul 13, 2026
b3fc366
build: set DLL publisher to LWenK
lwenk Jul 13, 2026
bada682
fix: record successful animal breeding directly
lwenk Jul 13, 2026
b3df613
refactor: organize player stats handlers
lwenk Jul 13, 2026
f693cbf
docs: update 0.8.3 changelog
lwenk Jul 13, 2026
513b6e7
ci: refresh actions and xmake package cache
lwenk Jul 13, 2026
e739e9b
ci: pin Windows builds to Visual Studio 2022
lwenk Jul 13, 2026
8c44587
ci: build with Windows 2022 runners
lwenk Jul 13, 2026
909dde5
ci: clear stale xmake package build cache
lwenk Jul 13, 2026
e48c599
build: align parallel-hashmap with LeviLamina
lwenk Jul 13, 2026
1c1e4cc
ci: build transitive dependencies from source
lwenk Jul 13, 2026
d7ef28a
merge: port 0.8.3 optimizations to 26.20
lwenk Jul 14, 2026
09b0d42
Merge pull request #45 from LeafKnife/refact/26.20
lwenk Jul 14, 2026
dcc2d42
feat: adapt to 26.32
lwenk Sep 12, 2026
8e400d5
ci: llvm 22
lwenk Sep 12, 2026
bb12651
feat: restructure i18n translations
lwenk Sep 12, 2026
4ead11b
Merge pull request #46 from LeafKnife/feat/26.32
lwenk Sep 12, 2026
c3fb121
chore: update CHANGELOG
lwenk Sep 12, 2026
ecd8451
feat: adapt to 26.40
lwenk Sep 12, 2026
f21984a
fix: harden statistics calculations
lwenk Sep 13, 2026
250c042
fix: detect mounted players from vehicle
lwenk Sep 13, 2026
c286b30
chore: prepare 0.10.1
lwenk Sep 13, 2026
bb66595
Merge pull request #47 from LeafKnife/release/0.10.x
lwenk Sep 13, 2026
8b2780b
Merge branch 'dev' into feat/26.40
lwenk Sep 13, 2026
beea236
Merge pull request #48 from LeafKnife/feat/26.40
lwenk Sep 16, 2026
85312af
chore: prepare 0.11.0
lwenk Sep 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,50 @@ on:
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
target_type:
- server
# - client
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- uses: xmake-io/github-action-setup-xmake@v1
# with:
# xmake-version: branch@master
- uses: actions/cache@v4

- uses: actions/cache@v6
with:
path: |
~/AppData/Local/.xmake
key: xmake-${{ hashFiles('xmake.lua') }}
restore-keys: |
xmake-

- name: Setup LLVM
uses: ZhongRuoyu/setup-llvm@v0
with:
llvm-version: 22

- run: |
xmake repo -u

- run: |
xmake f -a x64 -m release -p windows -v -y
xmake f -a x64 -m release -p windows -v --target_type=${{ matrix.target_type }} -y

- run: |
xmake -v -y

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v7
with:
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
name: ${{ github.event.repository.name }}-${{ github.sha }}-${{ matrix.target_type }}-windows-x64
path: |
bin/

# clang-format:
# runs-on: windows-latest
# runs-on: windows-2022
# steps:
# - uses: actions/checkout@v4
# - uses: actions/checkout@v7

# - run: |
# choco install llvm -y --version=17.0.6
Expand Down
48 changes: 32 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,51 @@ on:
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
target_type:
- server
# - client
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- uses: xmake-io/github-action-setup-xmake@v1
# with:
# xmake-version: branch@master
- uses: matbour/setup-sentry-cli@v1

- uses: matbour/setup-sentry-cli@v2
with:
token: ${{ SECRETS.SENTRY_TOKEN }}
organization: ${{ SECRETS.SENTRY_ORG }}
project: ${{ SECRETS.SENTRY_PROJECT }}
- uses: actions/cache@v4

- uses: actions/cache@v6
with:
path: |
~/AppData/Local/.xmake
key: xmake-${{ hashFiles('xmake.lua') }}
restore-keys: |
xmake-

- name: Setup LLVM
uses: ZhongRuoyu/setup-llvm@v0
with:
llvm-version: 22

- run: |
xmake repo -u

- run: |
xmake f -a x64 -m release -p windows -y --publish=y
xmake f -a x64 -m release -p windows --target_type=${{ matrix.target_type }} -y --publish=y

- run: |
xmake -w -y
- run: |
sentry-cli debug-files upload --include-sources bin/LK-Stats

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v7
with:
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
name: ${{ github.event.repository.name }}-${{ github.sha }}-${{ matrix.target_type }}-windows-x64
path: |
bin/

Expand All @@ -48,12 +59,12 @@ jobs:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- id: extract-release-notes
uses: ffurrer2/extract-release-notes@v2
uses: ffurrer2/extract-release-notes@v3

- uses: softprops/action-gh-release@v1
- uses: softprops/action-gh-release@v3
with:
body: |
${{ steps.extract-release-notes.outputs.release_notes }}
Expand All @@ -64,23 +75,28 @@ jobs:
- update-release-notes
permissions:
contents: write
strategy:
matrix:
target_type:
- server
# - client
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- uses: actions/download-artifact@v4
- uses: actions/download-artifact@v8
with:
name: ${{ github.event.repository.name }}-windows-x64-${{ github.sha }}
name: ${{ github.event.repository.name }}-${{ github.sha }}-${{ matrix.target_type }}-windows-x64
path: artifact

- run: |
cp CHANGELOG.md LICENSE README.md artifact/

- run: |
zip -r ../${{ github.event.repository.name }}-windows-x64.zip *
zip -r ../${{ github.event.repository.name }}-${{ matrix.target_type }}-windows-x64.zip *
working-directory: artifact

- uses: softprops/action-gh-release@v1
- uses: softprops/action-gh-release@v3
with:
files: |
${{ github.event.repository.name }}-windows-x64.zip
${{ github.event.repository.name }}-${{ matrix.target_type }}-windows-x64.zip
60 changes: 58 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,64 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [未发布]

## [0.11.0] - 2026-09-16

## 新增

- 适配LeviLamina 26.40

## [0.10.1] - 2026-09-13

### 修复

- 修复骑乘状态判断在 LeviLamina 26.32 中失效,导致载具移动距离无法统计的问题。
- 修复异常伤害值、无效客户端移动数据或计数溢出可能导致统计数值异常增大的问题。
- 修复抗性、吸收和盾牌伤害统计的边界计算。
- 修复花盆交互统计组件获取失败,以及村民交易统计中的空指针问题。

## [0.10.0] - 2026-09-12

## 新增

- 适配LeviLamina 26.32

### 更改

- 重构语言文件结构:界面、命令、日志、统计分类与通用统计分别使用嵌套键;Minecraft 名称按 `block`、`item`、`entity` 分类。
- 更新简体中文、繁体中文(香港)与繁体中文(台湾)的 Minecraft 官方译名数据。

### 修复

- 修复物品/方块混合统计在缺少物品译名时显示 `item.minecraft:<id>`,而不回退到方块译名的问题。

## [0.9.0] - 2026-07-05

### 新增

- 适配LeviLamina 26.20

## [0.8.3] - 2026-07-14

### 新增

- GUI 与 RemoteCall 统计查询分页。
- 在线玩家每 5 分钟异步保存,并支持中断快照恢复。

### 优化

- 优化玩家统计索引、表单查询与内存占用。
- 增加排行榜缓存和分页排序,降低大数据量查询开销。
- 优化玩家移动统计热路径。

### 修复

- 修复异常崩溃时在线玩家统计可能长期未保存的问题。
- 修复统计文件写入中断时可能忽略有效临时快照的问题。
- 修复玩家重新加入后名称等缓存信息未刷新的问题。
- 修复部分动物繁殖统计错误及潜在崩溃问题。
- 修复物品转移统计读取错误来源槽位的问题。
- 修复排行榜类型无效时错误提示不明确的问题。

## [0.8.0] - 2026-04-14

### 新增
Expand Down Expand Up @@ -215,8 +267,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- 统计玩家与床交互次数
- 统计玩家与部分方块交互次数

[未发布]: https://github.com/LeafKnife/Stats/compare/v0.9.0...dev
[0.9.0]: https://github.com/LeafKnife/Stats/compare/v0.8.0...0.9.0
[未发布]: https://github.com/LeafKnife/Stats/compare/v0.11.0...dev
[0.11.0]: https://github.com/LeafKnife/Stats/compare/v0.10.1...v0.11.0
[0.10.1]: https://github.com/LeafKnife/Stats/compare/v0.10.0...v0.10.1
[0.10.0]: https://github.com/LeafKnife/Stats/compare/v0.9.0...v0.10.0
[0.9.0]: https://github.com/LeafKnife/Stats/compare/v0.8.3...v0.9.0
[0.8.3]: https://github.com/LeafKnife/Stats/compare/v0.8.0...v0.8.3
[0.8.0]: https://github.com/LeafKnife/Stats/compare/v0.7.1...v0.8.0
[0.7.1]: https://github.com/LeafKnife/Stats/compare/v0.7.0...v0.7.1
[0.7.0]: https://github.com/LeafKnife/Stats/compare/v0.6.0...v0.7.0
Expand Down
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,26 @@ const getStats = ll.import("LK-Stats", "getPlayerStats");
const stats = getStats(uuid, 1);
```

### Paginated RemoteCall API

The existing `getPlayerStats` and `getRankStats` exports remain available. For large datasets, use the paginated exports below. Both return a JSON string; `page` starts at `1`, and `pageSize` is limited to `1`-`100` (values less than `1` use `20`). Ranking results may be cached for up to 30 seconds.

```javascript
const getPlayerStatsPage = ll.import("LK-Stats", "getPlayerStatsPage");
const statsPage = JSON.parse(getPlayerStatsPage(uuid, 1, 1, 20));

// { page, pageSize, total, totalPages, items: [{ key, value }] }
logger.info(JSON.stringify(statsPage));
```

```javascript
const getRankStatsPage = ll.import("LK-Stats", "getRankStatsPage");
const rankPage = JSON.parse(getRankStatsPage(1, "minecraft:play_time", 1, 20));

// { page, pageSize, total, totalPages, items: [{ player, value }] }
logger.info(JSON.stringify(rankPage));
```

获取排行榜信息

- 参数:
Expand Down Expand Up @@ -79,6 +99,34 @@ const rank3 = getRankData(2,""); // 挖掘排行榜
| ENTITY_KILLED | 与玩家杀死的实体数量相关的统计信息 | minecraft:killed |
| ENTITY_KILLED_BY | 与玩家被实体杀死相关的统计信息 | minecraft:killed_by |

### 语言文件对象键

统计数据和 RemoteCall API 中的对象键仍为原始命名空间 ID,例如 `minecraft:arrow`。语言文件会按用途及来源嵌套:界面为 `gui`,命令为 `command`,日志为 `log`;统计分类标题为 `stats.category`,通用统计项为 `stats.custom`。方块和物品有时使用相同的 ID,有时不同,因此按来源分为 `block`、`item`、`entity` 三组,避免同一 ID 时互相覆盖:

```json
{
"stats": {
"category": {
"used": "物品使用"
},
"custom": {
"minecraft:jump": "跳跃次数"
}
},
"block": {
"minecraft:stone": "石头"
},
"item": {
"minecraft:arrow": "箭"
},
"entity": {
"minecraft:arrow": "射出的箭"
}
}
```

加载时会将嵌套对象展开为内部翻译键。统计存档和 RemoteCall API 的字段不变:`mined` 使用 `block`,`broken` 使用 `item`,`killed` 与 `killed_by` 使用 `entity`;`crafted`、`used`、`picked_up`、`dropped` 会依次查询 `item` 与 `block`;通用统计使用 `stats.custom`。为兼容旧语言文件,未找到新键时仍会回退到原本的裸 `minecraft:<id>` 键。

### 统计信息列表

| 统计名称 | 描述 | 命名空间 |
Expand Down
Loading
Loading