This commit is contained in:
xootw authored and GitHub committed 2026-12-01 23:21:40 +08:00
1 parent a8fad81ea0
commit af0b27c807
1 file changed
+50 -50
+50 -50
View File
@@ -1,77 +1,77 @@
# MBedwars (v5.5.9.1 Reconstructed) # MBedwars (v5.5.9.1 Reconstructed)
> 本專案為 Minecraft Spigot / Paper 生態系插件 **MBedwars `5.5.9.1`** 之反混淆與多模組 Maven / IntelliJ IDEA 重建原始碼倉庫(原作者:Marcel Seibel / Marcely1199)。 > This repository contains the deobfuscated and reconstructed source code of **MBedwars `5.5.9.1`**, a plugin for the Minecraft Spigot / Paper ecosystem, organized as a multi-module Maven project with IntelliJ IDEA support (original author: Marcel Seibel / Marcely1199).
--- ---
## 1. 插件簡介 ## 1. Plugin Overview
**MBedwars** 是一款專為 Minecraft 伺服器設計的高可客製化 Bedwars(起床戰爭)小遊戲核心插件: **MBedwars** is a highly customizable Bedwars minigame core plugin designed for Minecraft servers:
- **主入口類別**:`de.marcely.bedwars.MBedwars` - **Main entry point**: `de.marcely.bedwars.MBedwars`
- **版本相容範圍**:透過共用抽象層與多版本 NMS 適配模組,原生支援 **Minecraft 1.8.8 至 1.26.x**(涵蓋 Legacy 1.8–1.16、Modern 1.17–1.26 及 Paper 硬分叉適配)。 - **Version compatibility**: Natively supports **Minecraft 1.8.8 through 1.26.x** via a shared abstraction layer and version-specific NMS adapter modules, covering Legacy (1.8–1.16), Modern (1.17–1.26), and Paper hard-fork compatibility.
- **API 版本宣告**:`api-version: 1.13`(載入期與各版本伺服器相容)。 - **API version declaration**: `api-version: 1.13` (for compatibility with different server versions at plugin load time).
--- ---
## 2. 原始混淆設計、強度與逆向過程 ## 2. Original Obfuscation Design, Strength, and Reverse Engineering Process
### 原始混淆設計與強度評估 ### Original Obfuscation Design and Strength Assessment
- **混淆方式**:原發行 JAR 採用 **ProGuard** 混淆: - **Obfuscation method**: The original distributed JAR was obfuscated using **ProGuard**:
- 將絕大多數內部實作類別扁平化至根套件(`de.marcely.bedwars.*`),並以 1–3 字元無意義名稱重命名類別、方法、欄位與內部類,部分列舉常數與成員名稱甚至與 Java 保留字(如 `do`、`if`)衝突。 - The vast majority of internal implementation classes were flattened into the root package (`de.marcely.bedwars.*`), with classes, methods, fields, and inner classes renamed to meaningless identifiers consisting of 1–3 characters. Some enum constants and member names even conflicted with Java reserved keywords, such as `do` and `if`.
- 公開開發者 API(`de.marcely.bedwars.api.*`)、部分內嵌函式庫(`de.marcely.bedwars.libraries.*`)、部分 `SourceFile` 屬性與全數 128 個原始資源檔則未被加密或破壞。 - The public developer API (`de.marcely.bedwars.api.*`), certain bundled libraries (`de.marcely.bedwars.libraries.*`), some `SourceFile` attributes, and all 128 original resource files were left unencrypted and intact.
- **混淆強度**:**中低至中等**——主要為符號與套件結構扁平化混淆,**未啟用**字串加密、控制流平坦化或 `invokedynamic` 虛擬化。 - **Obfuscation strength**: **Moderately low to moderate** — primarily identifier obfuscation and package flattening, with **no** string encryption, control-flow flattening, or `invokedynamic`-based virtualization.
### 逆向還原與重建過程 ### Reverse Engineering and Reconstruction Process
1. **位元碼雙射重映射與資源保留**:使用 ASM 對 2,334 個原始 `.class` 進行雙射符號與套件重映射、修復與保留字衝突之成員名稱、依 `<clinit>` 順序還原列舉常數名稱,並原封不動保留 128 個原始資源檔與簽章/載入邏輯。 1. **Bijective bytecode remapping and resource preservation**: Used ASM to perform bijective identifier and package remapping across 2,334 original `.class` files, resolve member names conflicting with Java reserved keywords, and restore enum constant names according to their initialization order in `<clinit>`. All 128 original resource files, signatures, and loading logic were preserved without modification.
2. **多模組架構拆分**:依據不同 Minecraft / Spigot / NMS 相依版本拆分出 **25 個 Maven 模組**(`mbedwars-common`、`mbedwars-nms` 及其 21 個版本子模組、`mbedwars-core`),並為各版本補齊編譯期獨立 stub(`deps/*.jar`)。 2. **Multi-module architecture decomposition**: Split the project into **25 Maven modules** (`mbedwars-common`, `mbedwars-nms` and its 21 version-specific submodules, and `mbedwars-core`) according to their Minecraft / Spigot / NMS version dependencies, with independent compile-time stubs (`deps/*.jar`) provided for each version.
3. **兩輪語意套件細分重組**:依功能領域與職責將原先扁平化與混雜的內部類別重新分層組織為語意明確的多層套件(內部實作分組控制在高內聚粒度)。 3. **Two-stage semantic package restructuring**: Reorganized the originally flattened and intermingled internal classes into a meaningful, hierarchical package structure based on functional domains and responsibilities, maintaining high cohesion within internal implementation packages.
4. **AST 全專案符號反混淆**:基於 JDK `JavacTask` 編譯器級 AST 分析對整個專案進行語意重命名,還原 **3,839 個根方法**(連同覆寫與呼叫點共 21,837 處)、**2,097 個欄位**與 **261 個具名內部類**。 4. **Project-wide AST-based identifier deobfuscation**: Performed semantic renaming across the entire project using compiler-level AST analysis based on the JDK's `JavacTask`. Restored **3,839 root method names** (21,837 occurrences, including overrides and call sites), **2,097 fields**, and **261 named inner classes**.
5. **多層等價驗證**:全量以 `javac --release 8` 與 `mvn clean package` 驗證建置通過,並針對公開/內部 ABI、列舉順序、資源 SHA-256 及核心工具執行期行為完成比對驗證。 5. **Multi-layer equivalence verification**: Successfully validated the full build using `javac --release 8` and `mvn clean package`. Additional equivalence checks covered public and internal ABIs, enum ordering, resource SHA-256 hashes, and the runtime behavior of core utilities.
--- ---
## 3. 逆向成果與功能模組概覽 ## 3. Reconstruction Results and Feature Overview
### Maven 多模組結構 ### Maven Multi-Module Structure
| 模組 | 說明 | | Module | Description |
| :--- | :--- | | :--- | :--- |
| **`mbedwars-common`** | 公開開發者 API(`api.*`)、相容性註解(`annotation.*`)、NBT 資料模型(`nbt.*`)、NMS 抽象與跨版本處理器(`nms.*`)、通用工具與內嵌函式庫(`tools.*`、`libraries.*`) | | **`mbedwars-common`** | Public developer API (`api.*`), compatibility annotations (`annotation.*`), NBT data model (`nbt.*`), NMS abstractions and cross-version handlers (`nms.*`), general-purpose utilities, and bundled libraries (`tools.*`, `libraries.*`) |
| **`mbedwars-nms/`** | 21 個 Minecraft 版本適配子模組:`legacy`(1.8–1.16)、`paper-hardfork`、`v1_17_R1`~`v1_21_R7`、`v1_26_R1_3`、`v1_26_R1` | | **`mbedwars-nms/`** | 21 Minecraft version adapter submodules: `legacy` (1.8–1.16), `paper-hardfork`, `v1_17_R1` through `v1_21_R7`, `v1_26_R1_3`, and `v1_26_R1` |
| **`mbedwars-core`** | 核心遊戲邏輯、指令、GUI、全息/NPC、資料儲存、設定檔系統、網路封包與 128 個插件資源檔 | | **`mbedwars-core`** | Core game logic, commands, GUIs, holograms / NPCs, data storage, configuration system, network packets, and all 128 plugin resource files |
### 核心功能清單(`mbedwars-core`) ### Core Features (`mbedwars-core`)
- **競技場與遊戲循環(`arena.*`)**:競技場建立與生命週期管理(`ArenaStartHandler`、`ArenaEndHandler`、`ArenaGameLoop`)、多隊平衡與自動分隊、觀戰者與重生機制、競技場投票/克隆,以及多種地形還原與世界重生引擎(`Region` / `VanillaWorld` / `CustomWorldFormat` / `ClearSafely`)。 - **Arenas and game loop (`arena.*`)**: Arena creation and lifecycle management (`ArenaStartHandler`, `ArenaEndHandler`, `ArenaGameLoop`), multi-team balancing and automatic team assignment, spectator and respawn mechanics, arena voting and cloning, and multiple terrain restoration and world regeneration engines (`Region` / `VanillaWorld` / `CustomWorldFormat` / `ClearSafely`).
- **商店、升級與特殊道具(`shop.*`、`specialitem.*`)**:商品商店與團隊升級系統、Hypixel / Normal 多種佈局與渲染器、陷阱系統(警報/反擊/挖掘疲勞等),以及火球、TNT 羊、救援平台、守護犬、迷你商店、搭橋蛋、傳送器與追蹤器等特殊道具。 - **Shops, upgrades, and special items (`shop.*`, `specialitem.*`)**: Item shops and team upgrade systems, multiple layouts and renderers (Hypixel / Normal), trap systems (alarm, counter-offensive, mining fatigue, etc.), and special items including fireballs, TNT sheep, rescue platforms, guard dogs, mini shops, bridge eggs, teleporters, and trackers.
- **全息顯示、封包 NPC 與視覺 HUD(`hologram.*`、`gui.*`)**:基於封包的 `PacketHologram` 與 `ArmorStand` / `NPC` 管理、排行雕像、動畫計分板/經驗條/LocatorBar(`gui.hud.*`)、競技場選擇器介面(`gui.arenas.*`)以及完整的圖形化遊戲內建設定編輯器與設置工具(`gui.editor.*`、`gui.setup.*`)。 - **Holograms, packet-based NPCs, and visual HUDs (`hologram.*`, `gui.*`)**: Packet-based `PacketHologram` and `ArmorStand` / `NPC` management, leaderboard statues, animated scoreboards / experience bars / LocatorBar (`gui.hud.*`), arena selector interfaces (`gui.arenas.*`), and comprehensive graphical in-game configuration editors and setup tools (`gui.editor.*`, `gui.setup.*`).
- **指令與事件系統(`command.*`、`event.*`)**:完整的管理員(備份/模組/統計/遷移/工具)、競技場設定/生成點/隊伍、大廳生成與玩家指令,以及方塊/實體/背包/玩家/世界事件監聽器。 - **Commands and event systems (`command.*`, `event.*`)**: Comprehensive administrator commands (backups, modules, statistics, migrations, and utilities), arena configuration / spawn point / team commands, lobby spawn and player commands, as well as block, entity, inventory, player, and world event listeners.
- **資料持久化與設定架構(`storage.*`、`config.*`)**:支援 Local(本機檔案)、SQL(MySQL / MariaDB / SQLite / SQL Server via HikariCP)與 MongoDB 後端,含玩家統計/成就/屬性/背包快取與舊版資料遷移。 - **Data persistence and configuration architecture (`storage.*`, `config.*`)**: Supports local file storage, SQL (MySQL / MariaDB / SQLite / SQL Server via HikariCP), and MongoDB backends, including player statistics, achievements, attributes, inventory caching, and legacy data migration.
- **網路通訊與平台相容(`network.*`、`compat.*`)**:Netty 封包注入與監聽讀寫器、BungeeCord 跨服通訊、Web 管理端通訊協定,以及 Spigot / Paper 事件與材質跨版本相容包裝層。 - **Network communication and platform compatibility (`network.*`, `compat.*`)**: Netty packet injection and packet read/write listeners, BungeeCord cross-server communication, web administration communication protocols, and cross-version compatibility wrappers for Spigot / Paper events and materials.
- **廣泛第三方插件掛鉤(`hook.*`)**:支援 **Vault / Coins / DKCoins**、**PlaceholderAPI**(含競技場/玩家/統計佔位符)、**WorldEdit**(v6/v7)、**SlimeWorldManager / AdvancedSlimePaper / ASWM / Polar**、**CloudNet v2–v4 / TimoCloud / CaveCloud / ReformCloud**、**Parties / PartyAndFriends**、**ProtocolLib / ViaVersion / ProtocolSupport**、**Geyser / Floodgate**、**TAB / FeatherBoard / NametagEdit**、**AdvancedReplay / XReplay**、**EssentialsX / CMI / Plan / OldCombatMechanics** 等。 - **Extensive third-party plugin integrations (`hook.*`)**: Supports **Vault / Coins / DKCoins**, **PlaceholderAPI** (including arena, player, and statistics placeholders), **WorldEdit** (v6/v7), **SlimeWorldManager / AdvancedSlimePaper / ASWM / Polar**, **CloudNet v2–v4 / TimoCloud / CaveCloud / ReformCloud**, **Parties / PartyAndFriends**, **ProtocolLib / ViaVersion / ProtocolSupport**, **Geyser / Floodgate**, **TAB / FeatherBoard / NametagEdit**, **AdvancedReplay / XReplay**, **EssentialsX / CMI / Plan / OldCombatMechanics**, and more.
--- ---
## 4. 環境配置、安裝、編譯與使用教學(IDEA Ready) ## 4. Environment Setup, Installation, Build, and Usage Guide (IDEA Ready)
### 系統與開發環境需求 ### System and Development Environment Requirements
- **JDK**:建議安裝 **JDK 17 或以上**(專案透過 `maven-compiler-plugin` 使用 `--release 8` 進行交叉編譯,產出的位元碼完全相容 **Java 8+** 之 Minecraft 伺服器環境)。 - **JDK**: **JDK 17 or later** is recommended. The project uses `maven-compiler-plugin` with `--release 8` for cross-compilation, producing bytecode compatible with **Java 8+** Minecraft server environments.
- **建置工具**:Maven `3.8+`(或直接使用 IntelliJ IDEA 內建捆綁的 Maven)。 - **Build tool**: Maven `3.8+` (or the bundled Maven installation provided by IntelliJ IDEA).
- **離線可用相依**:所有 Bukkit / Spigot / NMS 與第三方編譯期依賴已打包為 stub 置於 `deps/*.jar`,開箱即可直接編譯,無需另外手動 BuildTools 或執行額外腳本。 - **Offline-ready dependencies**: All Bukkit / Spigot / NMS and third-party compile-time dependencies are packaged as stubs in `deps/*.jar`, allowing the project to be compiled out of the box without manually running BuildTools or executing additional scripts.
### IntelliJ IDEA 開箱即用步驟 ### Getting Started with IntelliJ IDEA
1. **開啟專案**:在 IntelliJ IDEA 中選擇 **Open**,直接開啟專案根目錄(含 `pom.xml` 與 `.idea/`)。 1. **Open the project**: Select **Open** in IntelliJ IDEA and open the project root directory containing `pom.xml` and `.idea/`.
2. **載入 Maven 與指定本機 JDK**: 2. **Import the Maven project and configure the local JDK**:
- IDEA 會自動透過 `.idea/misc.xml` 與根目錄 `pom.xml` 匯入全部 25 個 Maven 模組並載入 `-Xpkginfo:always` 編譯設定(`.idea/compiler.xml`)與 UTF-8 編碼設定(`.idea/encodings.xml`)。 - IntelliJ IDEA automatically imports all 25 Maven modules using `.idea/misc.xml` and the root `pom.xml`, and loads the `-Xpkginfo:always` compiler option (`.idea/compiler.xml`) and UTF-8 encoding settings (`.idea/encodings.xml`).
- 開啟 **File → Project Structure → Project**,在 **SDK** 下拉選單選擇你本機已安裝的 **JDK 17+**(`Language level` 可維持預設與 `pom.xml` 同步之 Java 8)。 - Navigate to **File → Project Structure → Project** and select your locally installed **JDK 17+** from the **SDK** dropdown. The `Language level` can remain at the default Java 8 level synchronized with `pom.xml`.
- 若左側 Maven 視窗未自動同步,點擊 Maven 工具窗的 **Reload All Maven Projects**(重新整理圖示)。 - If Maven does not synchronize automatically, open the Maven tool window and click **Reload All Maven Projects** (the refresh icon).
3. **編譯打包**: 3. **Build and package the project**:
- **IDE 操作**:展開右側 Maven 面板中的 `mbedwars-parent` → `Lifecycle` → 雙擊執行 **`package`**(建議先執行 `clean` 再執行 `package`)。 - **Using the IDE**: In the Maven tool window on the right, expand `mbedwars-parent` → `Lifecycle` and double-click **`package`**. Running `clean` before `package` is recommended.
- **終端機指令**:於專案根目錄執行: - **Using the command line**: Run the following command from the project root directory:
```bash ```bash
mvn clean package mvn clean package
``` ```
### 產出檔與伺服器安裝 ### Build Output and Server Installation
- 編譯打包成功後,完整插件 JAR 位於: - After a successful build, the complete plugin JAR is available at:
`mbedwars-core/target/mbedwars-core-5.5.9.1.jar` `mbedwars-core/target/mbedwars-core-5.5.9.1.jar`
- `maven-shade-plugin` 已設定將 `mbedwars-common`、`mbedwars-nms-*` 合併打包,並**自動排除** `deps/*.jar` 編譯期 stub 及多餘的 `META-INF/maven/**` 中繼檔案,同時保留原始 `MANIFEST.MF` 與插件資源檔。 - The `maven-shade-plugin` is configured to merge `mbedwars-common` and `mbedwars-nms-*` into the final JAR, while **automatically excluding** compile-time stubs in `deps/*.jar` and redundant `META-INF/maven/**` metadata, and preserving the original `MANIFEST.MF` and plugin resource files.
- **安裝方式**:將 `mbedwars-core/target/mbedwars-core-5.5.9.1.jar` 複製到 Minecraft(Spigot / Paper)伺服器的 `plugins/` 目錄後重啟伺服器即可使用。 - **Installation**: Copy `mbedwars-core/target/mbedwars-core-5.5.9.1.jar` into the `plugins/` directory of your Minecraft (Spigot / Paper) server, then restart the server to start using the plugin.