Skip to content

Commit a2e465e

Browse files
authored
Merge pull request #152 from BentoBoxWorld/develop
Release 2.8.0
2 parents 4ea5255 + 7ddc57e commit a2e465e

45 files changed

Lines changed: 22439 additions & 6186 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/pr.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ jobs:
77
name: Build
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v4
1111
with:
1212
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
13-
- name: Set up JDK 11
14-
uses: actions/setup-java@v1
13+
- name: Set up JDK 21
14+
uses: actions/setup-java@v4
1515
with:
16-
java-version: 11
16+
distribution: 'adopt'
17+
java-version: '21'
1718
- name: Cache Maven packages
18-
uses: actions/cache@v1
19+
uses: actions/cache@v4
1920
with:
2021
path: ~/.m2
2122
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}

CLAUDE.md

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Build & Test Commands
6+
7+
```bash
8+
# Build
9+
mvn clean package
10+
11+
# Run all tests
12+
mvn test
13+
14+
# Run a single test class
15+
mvn test -Dtest=StoneGeneratorManagerTest
16+
17+
# Run a single test method
18+
mvn test -Dtest=StoneGeneratorManagerTest#testMethodName
19+
20+
# Full verify (tests + coverage)
21+
mvn verify
22+
```
23+
24+
## Architecture Overview
25+
26+
**MagicCobblestoneGenerator** is a [BentoBox](https://github.com/BentoBoxWorld/BentoBox) addon that replaces vanilla cobblestone/stone/basalt generation with configurable weighted-random block drops, per-island generator tiers, and economy/level-gated unlocking.
27+
28+
### Core Flow
29+
30+
1. `VanillaGeneratorListener` catches `BlockFormEvent` (lava+water → block)
31+
2. Delegates to `MagicGenerator` task, which uses weighted random selection to pick a replacement block from the active generator's block/treasure lists
32+
3. Active generators per island are stored in `GeneratorDataObject` (database-backed)
33+
34+
### Key Classes
35+
36+
- **`StoneGeneratorAddon`** — entry point; registers commands, listeners, flags, placeholders, hooks into GameMode addons
37+
- **`StoneGeneratorManager`** — central singleton; all CRUD for generators/islands, economy integration, activation logic
38+
- **`MagicGenerator`** — performs actual block replacement (weighted random from active tiers)
39+
- **`Settings`** (`config/Settings.java`) — `@ConfigObject`-annotated YAML config
40+
41+
### Data Model (3 database objects)
42+
43+
| Class | Purpose |
44+
|---|---|
45+
| `GeneratorTierObject` | Definition: blocks with chances, treasure, requirements (level/perms/cost) |
46+
| `GeneratorDataObject` | Per-island state: which generators are active/unlocked/purchased |
47+
| `GeneratorBundleObject` | Named collections of generator tiers assigned to islands |
48+
49+
### Package Map
50+
51+
```
52+
commands/admin/ — Admin CLI commands
53+
commands/player/ — Player CLI commands
54+
panels/admin/ — Admin GUI panels (PanelUtils-based)
55+
panels/player/ — Player GUI panels
56+
listeners/ — Event listeners (block form, join/leave, island level)
57+
managers/ — StoneGeneratorManager, StoneGeneratorImportManager
58+
tasks/ — MagicGenerator (block replacement logic)
59+
database/objects/ — GeneratorTierObject, GeneratorDataObject, GeneratorBundleObject
60+
database/adapters/ — Custom DB adapters
61+
events/ — GeneratorActivationEvent, GeneratorUnlockEvent, GeneratorBuyEvent
62+
request/ — API request handlers for cross-addon data queries
63+
web/ — WebManager for online generator library
64+
```
65+
66+
### Optional Integrations
67+
68+
- **Level addon** — island level gates generator unlocking
69+
- **Vault** — economy for purchasing generators
70+
- **Bank addon** — alternative economy backend
71+
72+
### Test Setup
73+
74+
Tests use **JUnit 5 + Mockito 5 + MockBukkit** (`org.mockbukkit.mockbukkit:mockbukkit-v1.21`). There is no PowerMock — static methods are stubbed with Mockito's built-in `mockStatic`, and static singletons (e.g. `BentoBox.instance`, `RanksManager.instance`) are injected via reflection. The Maven Surefire config opens numerous JDK internal modules for the mocking/instrumentation libraries.
75+
76+
Shared scaffolding lives in the addon's test package (`src/test/java/world/bentobox/magiccobblestonegenerator/`):
77+
78+
- **`CommonTestSetup`** — abstract base; subclass it and call `super.setUp()` from a `@BeforeEach`. Spins up a MockBukkit `ServerMock`, mocks `Bukkit`/`Util` statically, injects the `BentoBox` and `RanksManager` singletons, and wires common managers (IWM, islands, players, locales).
79+
- **`TestWorldSettings`** — minimal `WorldSettings` implementation.
80+
- **`WhiteBox`** — reflection helper for setting private static fields.
81+
82+
New tests should follow `StoneGeneratorManagerTest` / `GeneratorAdminCommandTest` (both extend `CommonTestSetup`). A focused test that needs different wiring can manage its own MockBukkit lifecycle instead — see `StoneGeneratorImportManagerTest`.
83+
84+
**Gotchas:**
85+
- `CommonTestSetup` starts the MockBukkit server **before** `MockitoAnnotations.openMocks`, because some database objects (e.g. `GeneratorBundleObject`) build an `ItemStack` in a static initializer that must run against a live server.
86+
- Static `final` fields (e.g. `Registry.BIOME`) can't be overwritten by reflection on Java 21+. Stub the static *method* that reads them instead — the importer test stubs `Utils.getBiomeNameMap()` rather than the field.
87+
88+
## Dependency Source Lookup
89+
90+
When you need to inspect source code for a dependency (e.g., BentoBox, addons):
91+
92+
1. **Check local Maven repo first**: `~/.m2/repository/` — sources jars are named `*-sources.jar`
93+
2. **Check the workspace**: Look for sibling directories or Git submodules that may contain the dependency as a local project (e.g., `../bentoBox`, `../addon-*`)
94+
3. **Check Maven local cache for already-extracted sources** before downloading anything
95+
4. Only download a jar or fetch from the internet if the above steps yield nothing useful
96+
97+
Prefer reading `.java` source files directly from a local Git clone over decompiling or extracting a jar.
98+
99+
In general, the latest version of BentoBox should be targeted.
100+
101+
## Project Layout
102+
103+
Related projects are checked out as siblings under `~/git/`:
104+
105+
**Core:**
106+
- `bentobox/` — core BentoBox framework
107+
108+
**Game modes:**
109+
- `addon-acidisland/` — AcidIsland game mode
110+
- `addon-bskyblock/` — BSkyBlock game mode
111+
- `Boxed/` — Boxed game mode (expandable box area)
112+
- `CaveBlock/` — CaveBlock game mode
113+
- `OneBlock/` — AOneBlock game mode
114+
- `SkyGrid/` — SkyGrid game mode
115+
- `RaftMode/` — Raft survival game mode
116+
- `StrangerRealms/` — StrangerRealms game mode
117+
- `Brix/` — plot game mode
118+
- `parkour/` — Parkour game mode
119+
- `poseidon/` — Poseidon game mode
120+
- `gg/` — gg game mode
121+
122+
**Addons:**
123+
- `addon-level/` — island level calculation
124+
- `addon-challenges/` — challenges system
125+
- `addon-welcomewarpsigns/` — warp signs
126+
- `addon-limits/` — block/entity limits
127+
- `addon-invSwitcher/` / `invSwitcher/` — inventory switcher
128+
- `addon-biomes/` / `Biomes/` — biomes management
129+
- `Bank/` — island bank
130+
- `Border/` — world border for islands
131+
- `Chat/` — island chat
132+
- `CheckMeOut/` — island submission/voting
133+
- `ControlPanel/` — game mode control panel
134+
- `Converter/` — ASkyBlock to BSkyBlock converter
135+
- `DimensionalTrees/` — dimension-specific trees
136+
- `discordwebhook/` — Discord integration
137+
- `Downloads/` — BentoBox downloads site
138+
- `DragonFights/` — per-island ender dragon fights
139+
- `ExtraMobs/` — additional mob spawning rules
140+
- `FarmersDance/` — twerking crop growth
141+
- `GravityFlux/` — gravity addon
142+
- `Greenhouses-addon/` — greenhouse biomes
143+
- `IslandFly/` — island flight permission
144+
- `IslandRankup/` — island rankup system
145+
- `Likes/` — island likes/dislikes
146+
- `Limits/` — block/entity limits
147+
- `lost-sheep/` — lost sheep adventure
148+
- `MagicCobblestoneGenerator/` — custom cobblestone generator
149+
- `PortalStart/` — portal-based island start
150+
- `pp/` — pp addon
151+
- `Regionerator/` — region management
152+
- `Residence/` — residence addon
153+
- `TopBlock/` — top ten for OneBlock
154+
- `TwerkingForTrees/` — twerking tree growth
155+
- `Upgrades/` — island upgrades (Vault)
156+
- `Visit/` — island visiting
157+
- `weblink/` — web link addon
158+
- `CrowdBound/` — CrowdBound addon
159+
160+
**Data packs:**
161+
- `BoxedDataPack/` — advancement datapack for Boxed
162+
163+
**Documentation & tools:**
164+
- `docs/` — main documentation site
165+
- `docs-chinese/` — Chinese documentation
166+
- `docs-french/` — French documentation
167+
- `BentoBoxWorld.github.io/` — GitHub Pages site
168+
- `website/` — website
169+
- `translation-tool/` — translation tool
170+
171+
Check these for source before any network fetch.
172+
173+
## Key Dependencies (source locations)
174+
175+
- `world.bentobox:bentobox``~/git/bentobox/src/`

0 commit comments

Comments
 (0)