|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +AcidIsland is a BentoBox GameModeAddon for Minecraft (Paper). It implements a Skyblock-like game mode where the ocean is acid that damages players, mobs, and items. Requires BentoBox 3.12.0+ as the parent plugin framework. |
| 8 | + |
| 9 | +## Build Commands |
| 10 | + |
| 11 | +```bash |
| 12 | +mvn clean package # Build (default goal) |
| 13 | +mvn clean test # Run all tests |
| 14 | +mvn test -Dtest=AcidEffectTest # Run a single test class |
| 15 | +mvn test -Dtest=AcidEffectTest#testMethod # Run a single test method |
| 16 | +mvn -DskipTests clean package # Build without tests |
| 17 | +``` |
| 18 | + |
| 19 | +Java 21 is required. The project uses Maven with the Shade plugin to produce the final JAR. |
| 20 | + |
| 21 | +## Architecture |
| 22 | + |
| 23 | +### Addon Lifecycle |
| 24 | + |
| 25 | +This is a BentoBox addon, not a standalone plugin. The lifecycle flows through: |
| 26 | +1. **`AcidIslandPladdon`** — Bukkit plugin entry point (Pladdon wrapper), instantiates the addon |
| 27 | +2. **`AcidIsland`** (extends `GameModeAddon`) — Main addon class with `onLoad()` → `createWorlds()` → `onEnable()` → `allLoaded()` lifecycle |
| 28 | +3. **`AISettings`** — Configuration POJO with BentoBox `@ConfigEntry` annotations, implements `WorldSettings` |
| 29 | + |
| 30 | +### Key Packages |
| 31 | + |
| 32 | +- **`listeners/`** — `AcidEffect` is the core gameplay listener handling all acid damage (players, mobs, items, armor protection, potion effects, Essentials integration). `LavaCheck` prevents normal stone generation from lava+acid water. |
| 33 | +- **`world/`** — `ChunkGeneratorWorld` generates ocean floor terrain using Perlin noise. `AcidTask` is a repeating task applying acid damage to entities in water. `AcidBiomeProvider` provides biomes per environment type. |
| 34 | +- **`events/`** — Custom Bukkit events (`AcidEvent`, `AcidRainEvent`, `EntityDamageByAcidEvent`, etc.) that are cancellable, allowing other plugins to modify acid behavior. |
| 35 | + |
| 36 | +### Testing |
| 37 | + |
| 38 | +Tests use **JUnit 5 + MockBukkit + Mockito 5**. The standard pattern for each test class: |
| 39 | + |
| 40 | +```java |
| 41 | +@ExtendWith(MockitoExtension.class) |
| 42 | +@MockitoSettings(strictness = Strictness.LENIENT) |
| 43 | +public class MyTest { |
| 44 | + private ServerMock server; |
| 45 | + private MockedStatic<Bukkit> mockedBukkit; |
| 46 | + |
| 47 | + @BeforeEach |
| 48 | + public void setUp() { |
| 49 | + server = MockBukkit.mock(); // always first |
| 50 | + mockedBukkit = Mockito.mockStatic(Bukkit.class, Mockito.RETURNS_DEEP_STUBS); |
| 51 | + mockedBukkit.when(Bukkit::getMinecraftVersion).thenReturn("1.21.11"); |
| 52 | + mockedBukkit.when(Bukkit::getServer).thenReturn(server); |
| 53 | + // ... |
| 54 | + } |
| 55 | + |
| 56 | + @AfterEach |
| 57 | + public void tearDown() { |
| 58 | + mockedBukkit.closeOnDemand(); |
| 59 | + MockBukkit.unmock(); |
| 60 | + } |
| 61 | +} |
| 62 | +``` |
| 63 | + |
| 64 | +Key rules: |
| 65 | +- **Do NOT call `Mockito.framework().clearInlineMocks()` in `@AfterEach`** — it disables `@BeforeAll` mocks and interferes with MockitoExtension's mock lifecycle for subsequent tests. |
| 66 | +- Always mock `Bukkit::getMinecraftVersion` — BentoBox 3.12.0 calls it in a static initializer and Paper API is required for it to exist on the classpath. |
| 67 | +- `paper-api` is a `provided` dependency (not `spigot-api`) — this is what puts `getMinecraftVersion()` on the compile/test classpath. |
| 68 | +- MockBukkit's JUnit transitive deps are excluded in `pom.xml` to avoid JUnit 6 version conflicts with surefire. |
| 69 | +- Do not use `new ItemStack(Material.AIR)` in tests — use `null` for empty armor slots; Paper 1.21's ItemStack handles AIR differently. |
| 70 | +- Do not reference `world.bentobox.bentobox.lists.Flags` static fields in tests — the class static initializer requires full BentoBox initialization. Use the string flag ID instead (e.g., `"ANIMAL_NATURAL_SPAWN"`). |
| 71 | + |
| 72 | +### Locales |
| 73 | + |
| 74 | +All 24 locale files use **MiniMessage format** (e.g., `<red>`, `<dark_blue>`). Legacy `&` color codes must not be used. BentoBox 3.12.0+ is required for MiniMessage support. |
| 75 | + |
| 76 | +### Configuration |
| 77 | + |
| 78 | +- `src/main/resources/config.yml` — Default config with acid damage values, rain settings, potion effects, world generation params |
| 79 | +- `src/main/resources/addon.yml` — BentoBox addon metadata and permissions (requires `api-version: 3.12.0`) |
| 80 | +- `src/main/resources/locales/` — 24 language translation files (MiniMessage format) |
| 81 | +- `src/main/resources/blueprints/` — Island templates (overworld, nether, end) |
| 82 | + |
| 83 | +## CI |
| 84 | + |
| 85 | +GitHub Actions workflow on `develop` branch and PRs: builds with Java 21, runs JaCoCo coverage, reports to SonarCloud. |
| 86 | + |
| 87 | +## Dependency Source Lookup |
| 88 | + |
| 89 | +When you need to inspect source code for a dependency (e.g., BentoBox, addons): |
| 90 | + |
| 91 | +1. **Check local Maven repo first**: `~/.m2/repository/` — sources jars are named `*-sources.jar` |
| 92 | +2. **Check the workspace**: Look for sibling directories or Git submodules that may contain the dependency as a local project (e.g., `../bentoBox`, `../addon-*`) |
| 93 | +3. **Check Maven local cache for already-extracted sources** before downloading anything |
| 94 | +4. Only download a jar or fetch from the internet if the above steps yield nothing useful |
| 95 | + |
| 96 | +Prefer reading `.java` source files directly from a local Git clone over decompiling or extracting a jar. |
| 97 | + |
| 98 | +In general, the latest version of BentoBox should be targeted. |
| 99 | + |
| 100 | +## Project Layout |
| 101 | + |
| 102 | +Related projects are checked out as siblings under `~/git/`: |
| 103 | + |
| 104 | +**Core:** |
| 105 | +- `bentobox/` — core BentoBox framework |
| 106 | + |
| 107 | +**Game modes:** |
| 108 | +- `addon-acidisland/` — AcidIsland game mode |
| 109 | +- `addon-bskyblock/` — BSkyBlock game mode |
| 110 | +- `Boxed/` — Boxed game mode (expandable box area) |
| 111 | +- `CaveBlock/` — CaveBlock game mode |
| 112 | +- `OneBlock/` — AOneBlock game mode |
| 113 | +- `SkyGrid/` — SkyGrid game mode |
| 114 | +- `RaftMode/` — Raft survival game mode |
| 115 | +- `StrangerRealms/` — StrangerRealms game mode |
| 116 | +- `Brix/` — plot game mode |
| 117 | +- `parkour/` — Parkour game mode |
| 118 | +- `poseidon/` — Poseidon game mode |
| 119 | +- `gg/` — gg game mode |
| 120 | + |
| 121 | +**Addons:** |
| 122 | +- `addon-level/` — island level calculation |
| 123 | +- `addon-challenges/` — challenges system |
| 124 | +- `addon-welcomewarpsigns/` — warp signs |
| 125 | +- `addon-limits/` — block/entity limits |
| 126 | +- `addon-invSwitcher/` / `invSwitcher/` — inventory switcher |
| 127 | +- `addon-biomes/` / `Biomes/` — biomes management |
| 128 | +- `Bank/` — island bank |
| 129 | +- `Border/` — world border for islands |
| 130 | +- `Chat/` — island chat |
| 131 | +- `CheckMeOut/` — island submission/voting |
| 132 | +- `ControlPanel/` — game mode control panel |
| 133 | +- `Converter/` — ASkyBlock to BSkyBlock converter |
| 134 | +- `DimensionalTrees/` — dimension-specific trees |
| 135 | +- `discordwebhook/` — Discord integration |
| 136 | +- `Downloads/` — BentoBox downloads site |
| 137 | +- `DragonFights/` — per-island ender dragon fights |
| 138 | +- `ExtraMobs/` — additional mob spawning rules |
| 139 | +- `FarmersDance/` — twerking crop growth |
| 140 | +- `GravityFlux/` — gravity addon |
| 141 | +- `Greenhouses-addon/` — greenhouse biomes |
| 142 | +- `IslandFly/` — island flight permission |
| 143 | +- `IslandRankup/` — island rankup system |
| 144 | +- `Likes/` — island likes/dislikes |
| 145 | +- `Limits/` — block/entity limits |
| 146 | +- `lost-sheep/` — lost sheep adventure |
| 147 | +- `MagicCobblestoneGenerator/` — custom cobblestone generator |
| 148 | +- `PortalStart/` — portal-based island start |
| 149 | +- `pp/` — pp addon |
| 150 | +- `Regionerator/` — region management |
| 151 | +- `Residence/` — residence addon |
| 152 | +- `TopBlock/` — top ten for OneBlock |
| 153 | +- `TwerkingForTrees/` — twerking tree growth |
| 154 | +- `Upgrades/` — island upgrades (Vault) |
| 155 | +- `Visit/` — island visiting |
| 156 | +- `weblink/` — web link addon |
| 157 | +- `CrowdBound/` — CrowdBound addon |
| 158 | + |
| 159 | +**Data packs:** |
| 160 | +- `BoxedDataPack/` — advancement datapack for Boxed |
| 161 | + |
| 162 | +**Documentation & tools:** |
| 163 | +- `docs/` — main documentation site |
| 164 | +- `docs-chinese/` — Chinese documentation |
| 165 | +- `docs-french/` — French documentation |
| 166 | +- `BentoBoxWorld.github.io/` — GitHub Pages site |
| 167 | +- `website/` — website |
| 168 | +- `translation-tool/` — translation tool |
| 169 | + |
| 170 | +Check these for source before any network fetch. |
| 171 | + |
| 172 | +## Key Dependencies (source locations) |
| 173 | + |
| 174 | +- `world.bentobox:bentobox` → `~/git/bentobox/src/` |
0 commit comments