Skip to content

Commit 65e38d4

Browse files
tastybentoclaude
andcommitted
Update CLAUDE.md to reflect Paper API + JUnit 5 + MockBukkit migration
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 104380a commit 65e38d4

1 file changed

Lines changed: 41 additions & 5 deletions

File tree

CLAUDE.md

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
44

55
## Project Overview
66

7-
AcidIsland is a BentoBox GameModeAddon for Minecraft (Spigot/Paper). It implements a Skyblock-like game mode where the ocean is acid that damages players, mobs, and items. Requires BentoBox as the parent plugin framework.
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.
88

99
## Build Commands
1010

@@ -30,18 +30,54 @@ This is a BentoBox addon, not a standalone plugin. The lifecycle flows through:
3030
### Key Packages
3131

3232
- **`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 BukkitRunnable applying acid damage to entities in water. `AcidBiomeProvider` provides biomes per environment type.
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.
3434
- **`events/`** — Custom Bukkit events (`AcidEvent`, `AcidRainEvent`, `EntityDamageByAcidEvent`, etc.) that are cancellable, allowing other plugins to modify acid behavior.
3535

3636
### Testing
3737

38-
Tests use **JUnit 5 + Mockito**. For static Bukkit methods, use Mockito static mocking via `Mockito.mockStatic` rather than adding new JUnit 4/PowerMock-based tests. The Surefire plugin is configured with extensive `--add-opens` JVM args for Java 21 compatibility. `ServerMocks` utility class provides reusable mock server setup.
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.
3975

4076
### Configuration
4177

4278
- `src/main/resources/config.yml` — Default config with acid damage values, rain settings, potion effects, world generation params
43-
- `src/main/resources/addon.yml` — BentoBox addon metadata and permissions
44-
- `src/main/resources/locales/` — 24 language translation files
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)
4581
- `src/main/resources/blueprints/` — Island templates (overworld, nether, end)
4682

4783
## CI

0 commit comments

Comments
 (0)