# MBedwars (v5.5.9.1 Reconstructed) > 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. Plugin Overview **MBedwars** is a highly customizable Bedwars minigame core plugin designed for Minecraft servers: - **Main entry point**: `de.marcely.bedwars.MBedwars` - **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 version declaration**: `api-version: 1.13` (for compatibility with different server versions at plugin load time). --- ## 2. Original Obfuscation Design, Strength, and Reverse Engineering Process ### Original Obfuscation Design and Strength Assessment - **Obfuscation method**: The original distributed JAR was obfuscated using **ProGuard**: - 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`. - 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. - **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. **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 ``. All 128 original resource files, signatures, and loading logic were preserved without modification. 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. **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. **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. **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. Reconstruction Results and Feature Overview ### Maven Multi-Module Structure | Module | Description | | :--- | :--- | | **`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 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`** | Core game logic, commands, GUIs, holograms / NPCs, data storage, configuration system, network packets, and all 128 plugin resource files | ### Core Features (`mbedwars-core`) - **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`). - **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. - **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.*`). - **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. - **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 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. - **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. Environment Setup, Installation, Build, and Usage Guide (IDEA Ready) ### System and Development Environment Requirements - **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. - **Build tool**: Maven `3.8+` (or the bundled Maven installation provided by IntelliJ IDEA). - **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. ### Getting Started with IntelliJ IDEA 1. **Open the project**: Select **Open** in IntelliJ IDEA and open the project root directory containing `pom.xml` and `.idea/`. 2. **Import the Maven project and configure the local JDK**: - 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`). - 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`. - If Maven does not synchronize automatically, open the Maven tool window and click **Reload All Maven Projects** (the refresh icon). 3. **Build and package the project**: - **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 mvn clean package ``` ### Build Output and Server Installation - After a successful build, the complete plugin JAR is available at: `mbedwars-core/target/mbedwars-core-5.5.9.1.jar` - 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. - **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.