Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

InviteCode is a Kotlin invitation and referral rewards plugin for Spigot and Paper, with experimental Folia support. `InviteCodeKt` is the repository name; the plugin and its data directory are named `InviteCode`.

The project is currently `0.1.0-SNAPSHOT`. It builds one Java 8 compatible plugin JAR and keeps newer Minecraft APIs behind isolated adapters. SQLite and MySQL 8.4 are production storage backends; JSON is available for small single-instance installations. Folia 26.1.2 has passed an isolated experimental smoke test; optional integrations and the final player experience still require release-stage acceptance.
The project is currently `0.1.0-SNAPSHOT`. It builds one Java 8 compatible plugin JAR and keeps newer Minecraft APIs behind isolated adapters. SQLite and MySQL 8.4 are production storage backends; JSON is available for small single-instance installations. Cross-version, storage recovery, and optional integration checks are recorded in the [integrated artifact retest](docs/testing/evidence/2026-10-02-issue-12-final-artifact-retest.md). Folia remains experimental; automated checks and player acceptance are tracked separately.

The complete maintainer guide is in [繁體中文](docs/README.zh-TW.md) and is the primary maintained documentation. See also the [product specification](docs/spec/invitecode-1.0.md), [Bukkit operations](docs/operations/bukkit-workflow.md), [JSON setup](docs/operations/json-storage.md), and [MySQL setup](docs/operations/mysql-storage.md). These documents are maintained in Traditional Chinese.

Expand Down
2 changes: 1 addition & 1 deletion docs/README.zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Qualification Reward 與 Inviter Milestone Reward 會先以穩定冪等鍵保存

## 真實伺服器測試

專案的真實 Spigot/Paper/Folia 測試矩陣位於 [`test-servers/matrix.json`](../test-servers/matrix.json),並使用專案外的共用 TestLab 建立隔離實例。操作方式與 EULA 邊界請參閱 [`test-servers.md`](./testing/test-servers.md)。
專案的真實 Spigot/Paper/Folia 測試矩陣位於 [`test-servers/matrix.json`](../test-servers/matrix.json),並使用專案外的共用 TestLab 建立隔離實例。操作方式與 EULA 邊界請參閱 [`test-servers.md`](./testing/test-servers.md);發行前真人測試見[最終驗收清單](./testing/final-human-acceptance.md)。

## 目前狀態

Expand Down
4 changes: 2 additions & 2 deletions docs/operations/bukkit-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Tab 建議會依發送者身分、權限與當前參數位置篩選。已完成
| `/invitecode status` | `invitecode.command.status` | 顯示 Claim Eligibility、Invitation 狀態與待補發 Reward 數。 |
| `/invitecode stats` | `invitecode.command.stats` | 顯示等待資格與已達資格的邀請數。 |

聊天輸入會先取消公開聊天,再送入背景流程;原始訊息不會寫入 log。Dialog 提交後沿用同一組格式、資格與限時確認流程;取消按鈕、`/invitecode cancel`、登出或逾時只會清除短期 Session,不會建立或修改 Invitation。輸入、確認、逾時、成功、取消、登出或停用插件後,短期 Session 都會失效。玩家一旦建立 Invite Code、已有 Invitation,或超過 Claim Window,就不能使用他人的 Invite Code。
聊天輸入會先取消公開聊天,再送入背景流程;原始訊息不會寫入 log。此時輸入 `cancel`(不分大小寫)也會私密取消,不會當作邀請碼解析。邀請碼訊息另外提供可點擊的複製入口:新版聊天 API 直接複製至剪貼簿,Spigot 1.8.8 則把原始碼填入聊天列,玩家可自行選取複製。確認摘要下方有綠色「同意」與紅色「不同意」,分別執行 `/invitecode confirm` 與 `/invitecode cancel`。Dialog 提交後沿用同一組格式、資格與限時確認流程;取消按鈕、`/invitecode cancel`、登出或逾時只會清除短期 Session,不會建立或修改 Invitation。輸入、確認、逾時、成功、取消、登出或停用插件後,短期 Session 都會失效。玩家一旦建立 Invite Code、已有 Invitation,或超過 Claim Window,就不能使用他人的 Invite Code。

玩家登入時,插件會以 SQLite 的 `anti-abuse.key` 或 MySQL 多實例共用的外部密鑰,對正規化網路位址執行 HMAC-SHA-256。資料庫只保存雜湊、密鑰識別碼與觀察/到期時間,絕不保存原始 IP。`anti-abuse.ip-hash-retention` 預設為 30 天;到期資料會在玩家登入時清除。邀請人與受邀人有尚未到期的相同雜湊時,`matching-ip-action` 的行為如下:

Expand Down Expand Up @@ -76,7 +76,7 @@ Invitation、Eligibility、Code Rotation 與 Storage Migration 會留下 actor

玩家登入會補發自己的 `PENDING` Reward。玩家離線或 Vault Economy 不可用時維持 `PENDING`。插件啟動會先把上次中斷於 `PROCESSING` 的 Action 轉成 `UNCERTAIN`;這類外部結果不得自動重試,必須由管理員檢查後決定。

背景 executor 執行 SQLite/MySQL 與 Qualification/Reward orchestration;Bukkit、聊天、指令、訊息與 Vault 操作只在 server main thread 執行。停用時會停止接受新工作並有界等待,不會讓背景執行緒同步等待主執行緒。
背景 executor 執行 SQLite/MySQL 與 Qualification/Reward orchestration。Spigot/Paper 的 Bukkit 工作回到主執行緒;Folia 的全域工作走 global scheduler,玩家互動與資格取值走玩家 entity scheduler。Vault 的 Folia provider 相容性仍須個別驗證。停用時會停止接受新工作並有界等待,不會讓背景執行緒同步等待伺服器工作執行緒。

## 人工驗收

Expand Down
4 changes: 2 additions & 2 deletions docs/spec/invitecode-1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ InviteCode 在一名 Inviter 與一名 Invitee 之間建立一筆持久的 Invit
- 一名 Invitee 最多只能有一名 Inviter;一名 Inviter 可以有多名 Invitee。
- 玩家只有在沒有 Invitation、尚未成為 Inviter,且仍在 Claim Window 內時才可 Claim。
- First Seen At 是 InviteCode 首次觀察到該玩家的時間;Claim Window 預設為 24 小時。
- Claim 必須經過 30 秒內完成的確認,確認畫面顯示目前的 Inviter 名稱與邀請碼。
- Claim 必須經過預設 60 秒內完成的確認,確認畫面顯示目前的 Inviter 名稱與邀請碼;期限可在設定中調整,並由伺服器執行。
- Claimed Invitation 只能成為 Qualified Invitation 一次;Qualification 為永久狀態。
- 一般玩家不能撤銷 Invitation。可稽核的管理操作支援 Unlink、Eligibility Reset、未 qualified Invitation 的 Transfer,以及 Force Qualification。

Expand All @@ -19,7 +19,7 @@ InviteCode 在一名 Inviter 與一名 Invitee 之間建立一筆持久的 Invit
- 預設使用唯一的六字元十六進位 Color Invite Code。
- Minecraft 1.16 以上版本顯示邀請碼實際代表的 RGB 顏色;舊版 client 使用最接近的 legacy color。
- 未來可選擇啟用 Crockford Base32 與經過驗證的 custom code。
- 有對應能力的新版 Paper 與 Spigot 伺服器使用原生 Dialog 文字輸入。
- 有對應能力的新版 Paper 與 Spigot 伺服器使用原生 Dialog 文字輸入,並以第二個 Dialog 顯示邀請摘要與同意/不同意選項。按鈕文字與提示可設色;原生按鈕底色由客戶端決定。確認畫面顯示期限,不逐秒刷新。
- 舊版伺服器使用一次性的私密聊天輸入,timeout 為 60 秒。
- 所有版本都保留 `/invitecode claim <code>`。

Expand Down
21 changes: 19 additions & 2 deletions docs/testing/evidence/2026-09-24-issue-12-startup-matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,27 @@ UUID 由測試程式透過 Python 標準 `sqlite3` 唯讀查得,斷言仍透
| `issue12-folia-regions-3`、`issue12-folia-chat-1`/`89DE0B80DD950EE2942766F11E1B4EB3B0B6F0FE3EBAF5984BE36BB525BF0BAC` | 兩個獨立實例通過;前者設定 Folia 2 條 region 排程執行緒,將兩名玩家傳送至相距約兩萬格的區域後並行執行 `/ic status`,再完成原本 Claim/Reward 流程;後者使用私密聊天輸入完成同一流程,log 未刊出邀請碼聊天內容 |
| `issue12-folia-final4`/`FF187679BD246A30BC76A573C16179363D3A79909C0595FF97F25A13065661BC` | 最終 JAR 在同一全新實例結合 Folia 2 條 region 執行緒、相距約兩萬格玩家的並行 `/ic status`、私密聊天輸入、Claim/Qualification、重啟後離線 Reward 補發與 Stats;runner 回報 `PASS`,正常停機 |

較早同一個 `89DE0B80...` JAR 在全新的 `issue12-final-spigot-188` 與 `issue12-final-paper-262` 實例通過相同 Code、Claim、Confirmation、Qualification、重啟、離線 Reward 與 Stats 流程。最後的 `FF187679...` JAR 亦在全新 `issue12-spigot-final4` 與 `issue12-paper-final4` 實例完成上述完整流程,兩者 runner 均回報 `PASS`。以上皆使用 loopback、offline、已接受 EULA 的 TestLab 實例及 SQLite。各 runner 正常關閉自己啟動的服務。尚未驗證 Folia 上的原生 Dialog 畫面、Vault/PlaceholderAPI 與第三方 provider 的執行緒相容性,也未涵蓋不同 Folia 版本或長時間負載。這些限制不能由合成玩家 `PASS` 推定通過;發行文件只能稱 **Folia 26.1.2 實驗性 smoke 通過**。
較早同一個 `89DE0B80...` JAR 在全新的 `issue12-final-spigot-188` 與 `issue12-final-paper-262` 實例通過相同 Code、Claim、Confirmation、Qualification、重啟、離線 Reward 與 Stats 流程。最後的 `FF187679...` JAR 亦在全新 `issue12-spigot-final4` 與 `issue12-paper-final4` 實例完成上述完整流程,兩者 runner 均回報 `PASS`。以上皆使用 loopback、offline、已接受 EULA 的 TestLab 實例及 SQLite。各 runner 正常關閉自己啟動的服務。當時尚未驗證 Folia 上的原生 Dialog 畫面、Vault/PlaceholderAPI 與第三方 provider 的執行緒相容性,也未涵蓋不同 Folia 版本或長時間負載;下節補記 PlaceholderAPI 與 Dialog 封包的有限驗證。這些限制不能由合成玩家 `PASS` 推定通過;發行文件只能稱 **Folia 26.1.2 實驗性 smoke 通過**。

Spigot/Paper 26.2 的 log 有 Windows Perflib/OSHI/JNA 讀取系統計數器失敗及衍生的 system-report `NullPointerException`;堆疊未涉及 InviteCode,伺服器與插件仍可啟動、診斷並正常停機。這是測試主機/伺服器層級的已知雜訊,不能用它替代插件無錯誤的判定。

### 最終 Folia Placeholder 與原生 Dialog 封包補驗

受測產品為已合併至 `develop` 的 `57b0f5d`,同一份 JAR SHA-256 `FF187679BD246A30BC76A573C16179363D3A79909C0595FF97F25A13065661BC`。這輪只調整測試 fixture 與驗收文件,沒有修改產品 JAR。各測試使用新的 loopback/offline TestLab 實例,runner 完成後停止自己啟動的伺服器。

| 全新實例 | Profile/情境 | 自動驗證結果 |
| --- | --- | --- |
| `issue12-folia-papi-final1` | Folia 26.1.2、PlaceholderAPI 2.12.3、測試 expansion | `PASS`:未達資格、Console 切換值、重新登入後達資格、重啟後維持資格 |
| `issue12-paper-papi-regression1` | Paper 1.20.6、同一 Placeholder fixture | `PASS`:同上四項;客戶端仍有已知非致命 protodef 解析警告 |
| `issue12-folia-dialog-protocol3` | Folia 26.1.2、`input-mode: DIALOG` | `PASS`:兩次收到原生 `show_dialog` 封包,各次 `/ic cancel` 後 Invitation 仍不存在;接續 command Claim/Confirm、資格、重啟後離線 Reward 與 Stats |
| `issue12-paper-dialog-protocol1` | Paper 26.2、`input-mode: DIALOG` | `PASS`:同上;伺服器另有既知 Windows OSHI/Perflib 雜訊,未見 InviteCode exception |

Folia 的 Placeholder 測試 probe 將玩家名稱與 UUID 於登入事件快取,Console 只切換 thread-safe 測試值;實際 Placeholder 展開由 InviteCode 在玩家 entity scheduler 觸發。這支持上述特定組合,不能推定任意 Placeholder expansion 都具 Folia 相容性。現有 Vault 1.7.3-b131 與 EssentialsX 2.21.2 JAR 未宣告 Folia 支援,[EssentialsX 官方發行說明](https://github.com/EssentialsX/Essentials/releases)亦明示不支援 Folia,因此沒有在 Folia 強行執行 Vault 存款測試。

曾嘗試由合成客戶端送出自造的 Dialog submit 封包,Folia 因封包格式不合法踢出客戶端。這只能歸類為測試客戶端限制,不能當成 InviteCode 缺陷或原生提交成功的證據;最終 runner 改為只驗證伺服器送出的 Dialog 封包和 command 取消後的狀態,並在伺服器停止後才輸出 `PASS`。原生按鈕、Esc、輸入與視覺呈現仍列入[最終真人驗收](../final-human-acceptance.md)。

已準備 `issue12-human-paper-262`、`issue12-human-spigot-188`、`issue12-human-folia-2612` 三個獨立實例。它們的 JAR 雜湊均與上述基線相符,`AUTO` 輸入模式、繁體中文、同 IP 測試例外與登入一天資格設定已核對;三者未啟動、未建立玩家 DB,62620/51888/63620 埠均未在監聽。這只是待測環境準備完成,不能計入真人驗收通過。

## SQLite 遷移故障與復原(伺服器層級)

新增 `migration-recovery.cjs`,在全新 `issue12-migration-rollback1-188` 實例使用 Spigot 1.8.8、`local-8` 與同一份產品 JAR(SHA-256 `99CE69BE0A38679EDD914AC608C0B0ACC85FE5BCD6A88D80B44FCEF3238BDADA`)。初始化到 SQLite v8 並正常停機後,測試程式只在此隔離資料庫建立合成 v7 fixture:保留舊資料、加入 `MigrationSentinel` 玩家,並於既有 `invitecode_players` 表先建立 `invitecode_network_hash_expiry` 索引。這是為了讓插件 v8 遷移先成功 `CREATE TABLE`,再於 `CREATE INDEX` 發生名稱衝突。fixture 由測試程式建造,**不是**舊版外掛實際產生的資料庫,也不代表曾有正式使用者需要遷移。
Expand All @@ -126,4 +143,4 @@ Spigot/Paper 26.2 的 log 有 Windows Perflib/OSHI/JNA 讀取系統計數

這是**合成的已提交 DDL 中斷狀態**,不是在 MySQL 實際執行 DDL 時殺掉 JVM;它證明產品在該持久化邊界的安全拒絕、續建與重啟持久性,不證明任意時間點的 crash 都能復原。測試採本機 `tls-mode: REQUIRED`,仍未驗證 `VERIFY_IDENTITY`。兩次 Paper 及隔離 MySQL 服務均已正常關閉,62060/63384 埠已釋放;專用 database 保留作為測試證據。

目前 Spigot/Paper 的啟動、SQLite/JSON/MySQL 代表性初始化、重啟一致性、Console 指令、外部服務偵測,以及 Spigot 1.8.8、Paper 1.20.6/1.21.8/26.2 的合成玩家 Claim/離線 `MESSAGE` Reward 已有證據。Spigot 1.8.8 通過 Reward 中斷後的 `UNCERTAIN` 復原與兩種管理員決定;Paper 1.20.6/1.21.8 分別通過 Placeholder 資格與 Vault 實際存款;SQLite 與 MySQL 也完成上述伺服器層級遷移復原測試。Folia 26.1.2 的實驗性啟動、玩家 Claim/Chat、跨 region 狀態查詢及三種 Reward Action smoke 已通過;原生 Dialog 視覺、Folia 第三方整合及最終人工觀感仍未驗證,不得據此宣布 1.0 發行 gate 通過。
目前 Spigot/Paper 的啟動、SQLite/JSON/MySQL 代表性初始化、重啟一致性、Console 指令、外部服務偵測,以及 Spigot 1.8.8、Paper 1.20.6/1.21.8/26.2 的合成玩家 Claim/離線 `MESSAGE` Reward 已有證據。Spigot 1.8.8 通過 Reward 中斷後的 `UNCERTAIN` 復原與兩種管理員決定;Paper 1.20.6/1.21.8 分別通過 Placeholder 資格與 Vault 實際存款;SQLite 與 MySQL 也完成上述伺服器層級遷移復原測試。Folia 26.1.2 的實驗性啟動、玩家 Claim/Chat、跨 region 狀態查詢、三種 Reward Action smoke、特定 PlaceholderAPI expansion,以及原生 Dialog 開啟封包均已通過;原生 Dialog 畫面與按鈕、Folia Vault provider 及最終人工觀感仍未驗證,不得據此宣布 1.0 發行 gate 通過。
15 changes: 15 additions & 0 deletions docs/testing/evidence/2026-09-25-issue-12-ux-retest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Issue #12:聊天室互動 UX 修正與回歸

使用者完成 Paper 26.2、Spigot 1.8.8、Folia 26.1.2 第一輪真人功能測試後,回報主要流程大致正常,但需要可複製的邀請碼、可點擊的確認/取消選項,以及聊天輸入時的 `cancel`。排版與美術列為後續討論。本輪沿用 `codex/test/final-release-acceptance`,沒有修改既有三個真人測試實例或其資料。

受測產品 JAR:`InviteCode-0.1.0-SNAPSHOT.jar`,SHA-256 `B586955C62FAE5F09F284D94203D674D84E90E8BF8F6E7B6230C496466689813`。測試以 mise 選擇 Java 11 建置,再以各實例指定的 Java 8 或 25 執行伺服器。

`ClaimInteractionSessionsTest` 與 `PlayerChatActionsTest` 先於未實作時呈紅燈,實作後通過;`mise exec -- .\gradlew.bat check shadowJar --console=plain` 通過,包含 Java 8 bytecode 與插件 JAR 結構檢查。互動選項以 Spigot 1.8.8 的 Bungee 聊天 API 編譯:舊版 `SUGGEST_COMMAND` 把原始碼填入聊天列;有 `COPY_TO_CLIPBOARD` 的新版 runtime 則選用直接複製。單元測試確認舊版動作及紅綠按鈕的 `RUN_COMMAND` 目標,真人剪貼簿與點擊仍需驗收。

| 隔離實例 | 合成玩家結果 |
| --- | --- |
| `issue12-ux-spigot-188` | `PASS`:複製入口文字、聊天 `CaNcEl` 私密取消後 Invitation 為 none、再次 Claim、確認選項文字、資格、重啟及離線 Reward |
| `issue12-ux-paper-262` | `PASS`:複製入口與確認選項文字、Claim、資格、重啟及離線 Reward;有先前已知的 Windows OSHI/Perflib 雜訊,未見 InviteCode exception |
| `issue12-ux-folia-2612` | `PASS`:複製入口文字、聊天 `CaNcEl` 私密取消後 Invitation 為 none、再次 Claim、確認選項文字、資格、重啟及離線 Reward |

三個合成實例使用新建 loopback/offline TestLab、同一 JAR 雜湊;runner 已停止啟動的伺服器。另建立三個空白的第二輪真人驗收實例 `issue12-ux-human-paper-262`、`issue12-ux-human-spigot-188`、`issue12-ux-human-folia-2612`,JAR 雜湊相同,尚未啟動。操作與待驗收項目見[最終真人驗收](../final-human-acceptance.md)。合成玩家只驗證元件文字已到達,沒有實際點擊剪貼簿或按鈕,故 Issue #12 的 UX 驗收仍未完成。
Loading
Loading