diff --git a/README.md b/README.md index 88efd5d..d4ec7f8 100644 --- a/README.md +++ b/README.md @@ -1,79 +1,77 @@ -# ArcadeGames 2.19f 原始碼重建與架構合併 +# ArcadeGames 2.19f — Reconstructed & Unified Source -## 目前目錄架構 +## Project Layout ```text ArcadeGames/ -├─ common/ 共用引擎、公開 API、十大遊戲主邏輯與版本抽象層(737 份 Java 來源) -├─ latest/ LATEST(1.18–26.2)版本適配、AdvancedSlimePaper 與打包組裝(6 份 Java 來源) -├─ legacy/ LEGACY(1.8.8–1.12.2)版本適配、Legacy 音效/FallingBlock 與打包組裝(5 份 Java 來源) -├─ build-support/ NMS 平台模組、jdk21、編譯依賴、驗證與建置工具(raw JAR 保留於 archive/) +├─ common/ Shared engine, public API, all 10 minigames, and version abstraction layer (737 Java sources) +├─ latest/ LATEST (1.18–26.2) version adapter, AdvancedSlimePaper integration, and shaded plugin assembly (6 Java sources) +├─ legacy/ LEGACY (1.8.8–1.12.2) version adapter, legacy sounds/FallingBlock support, and shaded plugin assembly (5 Java sources) +├─ build-support/ NMS platform modules, jdk21 module, compile-time stubs, and bytecode finalization tool ├─ pom.xml └─ build.ps1 ``` -已完成 **逆混淆** 與 **雙版本共用合併(方案 A:單一 `common` + 雙產物成品 JAR)**: +This repository contains the **deobfuscated** and **unified multi-version architecture** (single `common` module + dual shaded plugin JARs): -- `common/src/variants/` 與重複的 `platform-api-latest`/`platform-api-legacy` 模組已全面移除,所有上層遊戲與引擎邏輯統一在 `common/src/main/java`(737 份 `.java` 編譯為 740 個 `.class`),只在單一處維護並僅編譯一次。 -- `common` 與具體 Spigot/NMS 版本的差異透過 `ro.fr33styler.arcade.platform.compat.VersionAdapter` / `VersionAdapters`、`ArcadeSound`、`ArcadeParticle`、`ArcadeMaterial`、`ArcadeColor`、`ColoredBlockType`、`GameBossBar`、`TeamRule` 等抽象邊界隔離,嚴格維持在 `spigot-api-1.8.8` 與 `spigot-api-1.20.1` 的 API 交集內。 -- 公開 API `ro.fr33styler.arcade.api.engine.*`(56 份來源)、所有 YAML `@Setting` 鍵名、列舉常數與既有資源檔均完整保留;原 `build-support/archive/` 與原始 JAR 未作更動。 +- Duplicated per-version sources (`common/src/variants/`, `platform-api-latest`, `platform-api-legacy`) have been consolidated so all engine and minigame logic lives in `common/src/main/java` (737 `.java` files compiled into 740 `.class` files), maintained in one place and compiled once. +- Remaining obfuscated single-character and decompiler-generated numbered method/field names across `common`, `latest`, and `legacy` have been semantically renamed for readability. +- Spigot/NMS version differences are isolated behind `ro.fr33styler.arcade.platform.compat.VersionAdapter` / `VersionAdapters`, `ArcadeSound`, `ArcadeParticle`, `ArcadeMaterial`, `ArcadeColor`, `ColoredBlockType`, `GameBossBar`, and `TeamRule`, keeping `common` strictly within the `spigot-api-1.8.8` ∩ `spigot-api-1.20.1` API intersection. +- The public API `ro.fr33styler.arcade.api.engine.*` (56 sources), all YAML `@Setting` keys, enum constants, and bundled resources are preserved intact. -## 建置 +## Building -使用 JDK 21 與 Maven 3,在專案根目錄執行: +Requires **JDK 21** and **Maven 3**. From the repository root, run: ```powershell mvn clean verify ``` -也可執行 `./build.ps1 clean verify`(或於離線環境使用 `mvn -o -T 1C clean verify`)。請執行到 `verify`,以確保 `FinalizeClasses` 完成 NMS `do_()` 至 `do()` 的位元組碼重連。 +You can also run `./build.ps1 clean verify` (or `mvn -o -T 1C clean verify` for offline parallel builds). Make sure to run through the `verify` phase so `FinalizeClasses` relinks NMS `do_()` aliases back to `do()F`. -最終成品位於: +Output plugin JARs: - `latest/target/ArcadeGames-2.19f-LATEST-reconstructed.jar` - `legacy/target/ArcadeGames-2.19f-LEGACY-reconstructed.jar` -## 模組說明 +## Modules -| 模組 | 來源數 | 內容 | +| Module | Sources | Description | | --- | --- | --- | -| `common` | 737 `.java` | `api.engine.*`(56)、統一 `platform.api` 與 `compat`、核心引擎與全 10 款遊戲主邏輯 | -| `jdk21` | 1 `.java` | Java 21 virtual-thread 實作(由 `DefaultEngine` 於 JDK 21+ 動態載入) | -| `platforms/latest-*` | 6 組模組 | 1.18.2 / 1.19.4 / 1.20.6 / 1.21.11 / 26.1 / 26.2 的 NMS adapter | -| `platforms/legacy-*` | 2 組模組 | 1.8.8 / 1.12.2 的 NMS adapter 與 1.12.2 副手監聽 | -| `latest` | 6 `.java` | `Arcade`、`LatestVersionAdapter`、`SoundTypeToken`、`AdvancedSlimePaper*`(3)與 `plugin.yml`/資源 | -| `legacy` | 5 `.java` | `Arcade`、`LegacyVersionAdapter`、`LegacySounds`、`PartyGamesV1_8_8/1_12_2FallingBlockFactorySelector` 與 `plugin.yml`/資源 | +| `common` | 737 `.java` | `api.engine.*` (56), unified `platform.api` & `compat`, core engine, and all 10 minigames | +| `jdk21` | 1 `.java` | Java 21 virtual-thread executor (dynamically loaded by `DefaultEngine` on JDK 21+) | +| `platforms/latest-*` | 6 modules | NMS adapters for Minecraft 1.18.2 / 1.19.4 / 1.20.6 / 1.21.11 / 26.1 / 26.2 | +| `platforms/legacy-*` | 2 modules | NMS adapters for Minecraft 1.8.8 / 1.12.2 and 1.12.2 off-hand listener | +| `latest` | 6 `.java` | `Arcade`, `LatestVersionAdapter`, `SoundTypeToken`, `AdvancedSlimePaper*` (3), and `plugin.yml`/resources | +| `legacy` | 5 `.java` | `Arcade`, `LegacyVersionAdapter`, `LegacySounds`, `PartyGamesV1_8_8/1_12_2FallingBlockFactorySelector`, and `plugin.yml`/resources | -除 `jdk21` 以 Java 21 編譯外,其餘模組皆以 Java 17 為編譯目標。 +All modules target Java 17 except `jdk21`, which targets Java 21. -## Java 套件 +## Package Overview ```text ro.fr33styler.arcade -├─ api.engine.* 公開引擎 API(保留原名稱與介面) -├─ engine 設定、指令、玩家、session、文字、顯示、記分板、儲存與網路 -├─ game 十大遊戲(BlockParty、BombLobbers、MiniWalls、PartyGames、PropHunt、Quake、Splegg、TempleRun、TNTRun、TNTTag) -├─ platform 統一平台契約、VersionAdapter / Bukkit / JDK 適配與 NMS 模組 -├─ integration 第三方整合(PlaceholderAPI、NoteBlockAPI、Vault 等;AdvancedSlimePaper 僅於 latest) -├─ support IO、反射、文字、亂數與壓縮工具 +├─ api.engine.* Public engine API (original signatures preserved) +├─ engine Config, commands, players, sessions, text, display, scoreboards, storage, and networking +├─ game 10 minigames (BlockParty, BombLobbers, MiniWalls, PartyGames, PropHunt, Quake, Splegg, TempleRun, TNTRun, TNTTag) +├─ platform Unified platform contracts, VersionAdapter / Bukkit / JDK adapters, and NMS modules +├─ integration Third-party integrations (PlaceholderAPI, NoteBlockAPI, Vault, etc.; AdvancedSlimePaper in latest only) +├─ support IO, reflection, text, random, and compression utilities ├─ internal.compatibility └─ vendor.bstats ``` -## 來源與編譯相容處理 +## Build & Compatibility Notes -- `build-support/deps/provided-api-stubs.jar` 僅供編譯期提供 Spigot 與第三方外掛簽章,不封入最終成品 JAR。 -- Java 無法直接命名的 NMS `do()` 方法仍透過 `do_()` 別名編譯,並由 `build-support/tools/build/FinalizeClasses.java` 依據 `build-support/tools/dependencies/external-reserved-names.tsv` 於 `verify` 階段精確重連為 `do()F`。 -- 資源檔案均直接隨 `latest`/`legacy` 打包進成品 JAR,包含 `plugin.yml`、`template.dat`、`games/block-party/songs.zip` 等。 +- `build-support/deps/provided-api-stubs.jar` and per-version `stubs-*.jar` files supply compile-time Spigot, NMS, and third-party plugin signatures only and are not shaded into the final plugin JARs. +- NMS methods whose obfuscated names collide with Java keywords (such as `do()`) are compiled via `do_()` aliases and relinked to `do()F` during the `verify` phase by `build-support/tools/build/FinalizeClasses.java` using `build-support/tools/dependencies/external-reserved-names.tsv`. +- Runtime resources (`plugin.yml`, `template.dat`, `games/block-party/songs.zip`, etc.) are packaged directly into the `latest` and `legacy` shaded JARs. -## 驗證結果 +## Verification -以下檢查均已於最後一次修改後執行並全數通過: +- **Full multi-module build (`mvn -o -T 1C clean verify`)**: All 13 Maven reactor modules compile, shade, and pass `FinalizeClasses` verification. +- **Spigot API intersection check**: Bytecode scanning of all 740 compiled `common` classes confirmed 0 API intersection violations across `spigot-api-1.8.8` and `spigot-api-1.20.1`. +- **NMS `do()` relinking check (`javap -p -c`)**: Confirmed packaged NMS entities (`MiniWallsV1_18_2Arrow`, `PropHuntV1_18_2PropEntity`) invoke `Method do:()F` with no leftover `do_()` calls. +- **Offline smoke tests**: Verified GZIP compression round-trips, `Text`/`Contexts` placeholder interpolation, and resolution of all 25 `ArcadeSound`, 45 `ArcadeMaterial`, and 144 `ColoredBlockType × ArcadeColor` entries against real `spigot-api-1.20.1` (`latest`) and `spigot-api-1.8.8` (`legacy`) enums. -1. **完整建置與打包(`mvn -o -T 1C clean verify`)**:13 個 reactor 模組全部編譯與打包成功。 -2. **`common` Spigot API 交集驗證(`build-support/tools/verification/CheckCommonApiIntersection.java`)**:使用 ASM 9.9.1 掃描 `build-support/target/common/classes` 共 740 個 `.class`,檢查所有 `org/bukkit/**` 與 `org/spigotmc/**` 型別、欄位與方法參照皆同時存在於 `spigot-api-1.8.8` 與 `spigot-api-1.20.1`,結果為 **0 項違規(PASS)**。 -3. **NMS `do()` 位元組碼重連驗證(`javap -p -c`)**:檢查 `latest/target/ArcadeGames-2.19f-LATEST-reconstructed.jar` 內的 `MiniWallsV1_18_2Arrow` 與 `PropHuntV1_18_2PropEntity`,確認均已重連為 `Method do:()F`,無殘留 `do_()`。 -4. **成品結構與資源檢查**:確認 `common/src/variants` 已不存在、`latest` 僅 6 檔、`legacy` 僅 5 檔,且兩份成品 JAR 均含 `plugin.yml`、`template.dat`、`games/block-party/songs.zip` 與 `ro/fr33styler/arcade/Arcade.class`。 -5. **離線 Smoke 測試(`build-support/tools/verification/SmokeCheck.java`)**:分別搭配真實 `spigot-api-1.20.1`(`latest`)與 `spigot-api-1.8.8`(`legacy`)驗證字串 GZIP 壓縮往返、`Text`/`Contexts` 插值,以及全部 25 個 `ArcadeSound`、45 個 `ArcadeMaterial` 與 144 組 `ColoredBlockType × ArcadeColor` 解析均正常通過。 - -> 註:以上屬於編譯期、位元組碼與離線列舉/單元驗證;完整遊戲流程、NMS 封包與第三方外掛(如 AdvancedSlimePaper、PlaceholderAPI、NoteBlockAPI)互動仍建議搭配實際 Paper/Spigot 伺服器進行實機測試。 +> Note: These checks cover compilation, bytecode integrity, and offline unit/enum verification. End-to-end gameplay, NMS packet handling, and third-party plugin integrations (AdvancedSlimePaper, PlaceholderAPI, NoteBlockAPI) should still be tested on a live Paper/Spigot server.