Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6f57d80
Version 1.22.1
tastybento Dec 8, 2025
2a57d47
Fixes hex colors in action bar text. #461
tastybento Dec 8, 2025
64f2121
Merge pull request #469 from BentoBoxWorld/461_No_support_for_HEX_col…
tastybento Dec 8, 2025
a450c6a
Upgrade to BentoBox 3.10.0 and Paper API 1.21.11, fix test NPE
tastybento Mar 8, 2026
7b2843b
Initial plan
Copilot Mar 18, 2026
c79713d
Add Nexo custom block and item support
Copilot Mar 18, 2026
7746c44
Include exception message in NexoCustomBlock error logging
Copilot Mar 18, 2026
932ee9f
Exclude all transitive dependencies from Nexo to fix build
Copilot Mar 18, 2026
52c712c
Merge pull request #474 from BentoBoxWorld/copilot/add-nexo-block-sup…
tastybento Mar 18, 2026
7590f4b
Initial plan
Copilot Apr 5, 2026
779653a
Initial plan
Copilot Apr 5, 2026
b287ccf
Update Russian locale (ru.yml) to MiniMessage format with grammar fixes
Copilot Apr 5, 2026
b1119b9
Merge pull request #479 from BentoBoxWorld/copilot/update-russian-lan…
tastybento Apr 5, 2026
714754f
Fix ONEBLOCK_ACTIONBAR translation indentation in all locale files
Copilot Apr 5, 2026
9bf7bbe
Initial plan
Copilot Apr 5, 2026
9ad36b5
Merge branch 'develop' into copilot/fix-actionbar-translation-issue
tastybento Apr 5, 2026
ade88c5
Merge pull request #480 from BentoBoxWorld/copilot/fix-actionbar-tran…
tastybento Apr 5, 2026
b661f97
Fix wrong locale keys in AdminSanityCheck and add test
Copilot Apr 5, 2026
a92cbe1
Merge pull request #481 from BentoBoxWorld/copilot/fix-localization-i…
tastybento Apr 5, 2026
61cb0cf
Update src/main/java/world/bentobox/aoneblock/listeners/BossBarListen…
tastybento Apr 5, 2026
c53b94b
Update CLAUDE.md
tastybento Apr 5, 2026
cb9507c
Initial plan
Copilot Apr 5, 2026
0a216bf
Fix action bar color: use getTranslation instead of getTranslationNoC…
Copilot Apr 5, 2026
b886085
Complete assertion-less tests in OneBlocksManagerTest3 and fix test d…
tastybento Apr 5, 2026
4e31e73
Add BlockListenerTest2 covering onPlayerInteract and spawnBlock
tastybento Apr 5, 2026
a038d97
Merge pull request #482 from BentoBoxWorld/copilot/sub-pr-470
tastybento Apr 5, 2026
efe905e
Reduce complexity of onPlayerInteract and spawnBlock in BlockListener
tastybento Apr 5, 2026
047e944
Add MakeSpaceTest covering makeSpace and checkBlock logic
tastybento Apr 5, 2026
adc71ab
Refactor MakeSpace.makeSpace to reduce cognitive complexity
tastybento Apr 5, 2026
03124b2
Remove redundant public modifier from @Test methods
tastybento Apr 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Commands

```bash
# Build
mvn clean package

# Run all tests
mvn test

# Run a single test class
mvn test -Dtest=TestClassName

# Run a single test method
mvn test -Dtest=TestClassName#methodName

# Full verify with coverage (JaCoCo)
mvn verify
```

## Project Overview

AOneBlock is a BentoBox GameModeAddon for Minecraft. Players start on a single magic block in the sky; mining that block cycles through 18+ sequential phases (Plains, Underground, Ocean, Jungle, etc.), each with its own blocks, mobs, and chest loot. The plugin extends `GameModeAddon` from BentoBox and hooks into the Bukkit event system.

## Key Architecture

**Entry point:** `AOneBlock.java` — registers listeners, commands, generators, and the `OneBlocksManager`.

**Phase system (`oneblocks/`):**
- `OneBlocksManager` — loads phase YAML files from `src/main/resources/phases/`, tracks per-island block counts, handles phase transitions, and resolves what block/mob/chest appears next.
- `OneBlockPhase` — represents a single phase with its block pool, mob pool, and chest tables.
- `OneBlockObject` — a single block-pool entry (can be a vanilla block, custom block, or mob spawn).
- `customblock/` — adapters for custom block types (ItemsAdder, Mob, raw BlockData).

**Data persistence:** `OneBlockIslands` (in `dataobjects/`) is stored via BentoBox's database abstraction. It tracks block count, phase name, and hologram state per island.

**Listeners (`listeners/`):** Handle the magic block break event (core gameplay loop), boss bar updates, hologram placement, island join/leave hooks, and protection flags.

**Events (`events/`):** `MagicBlockEvent`, `MagicBlockPhaseEvent`, and `BlockClearEvent` are fired during gameplay so other plugins can react.

**Commands:**
- Player: `/ob` (`PlayerCommand`) — sub-commands: count, phases, actionbar, bossbar, respawnblock, setcount
- Admin: `/oba` (`AdminCommand`) — sub-commands: setchest, sanitycheck, setcount

**World generation:** `ChunkGeneratorWorld` generates the empty void world with the single starter block.

**GUI:** `PhasesPanel` provides a clickable phase browser.

## Testing

All tests extend `CommonTestSetup`, which sets up a MockBukkit server, mocks BentoBox and its managers (islands, players, worlds), and tears everything down after each test. Use Mockito and the repository's `world.bentobox.aoneblock.WhiteBox` helper for injecting state into private fields.

Phase YAML files under `src/main/resources/phases/` are loaded at startup; tests that exercise `OneBlocksManager` need those resources on the classpath (they are by default via Maven's test resource path).
79 changes: 60 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,17 @@
<mockito.version>5.11.0</mockito.version>
<mock-bukkit.version>v1.21-SNAPSHOT</mock-bukkit.version>
<!-- More visible way how to change dependency versions -->
<bentobox.version>2.7.1-SNAPSHOT</bentobox.version>
<bentobox.version>3.10.0</bentobox.version>
<items-adder.version>4.0.10</items-adder.version>
<nexo.version>1.8.0</nexo.version>
<level.version>2.6.2</level.version>
<bank.version>1.3.0</bank.version>
<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision>
<!-- Do not change unless you want different name for local builds. -->
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>1.22.0</build.version>
<build.version>1.22.1</build.version>
<!-- SonarCloud -->
<sonar.projectKey>BentoBoxWorld_AOneBlock</sonar.projectKey>
<sonar.organization>bentobox-world</sonar.organization>
Expand Down Expand Up @@ -123,51 +124,75 @@


<repositories>
<!-- MockBukkit (com.github.*) snapshots live here -->
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<!-- BentoBox, Level, Bank releases -->
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
<id>bentoboxworld</id>
<url>https://repo.codemc.org/repository/bentoboxworld/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<!-- Paper API snapshots -->
<repository>
<id>minecraft-repo</id>
<url>https://libraries.minecraft.net/</url>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<!-- ItemsAdder API -->
<repository>
<id>bentoboxworld</id>
<url>https://repo.codemc.org/repository/bentoboxworld/</url>
</repository>
<id>matteodev</id>
<url>https://maven.devs.beer/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<!-- Nexo API -->
<repository>
<id>codemc</id>
<url>https://repo.codemc.org/repository/maven-snapshots/</url>
<id>nexomc</id>
<url>https://repo.nexomc.com/releases/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<!-- General Maven public mirror -->
<repository>
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<!-- Mojang/Minecraft libraries (releases only) -->
<repository>
<id>jitpack-repo</id>
<url>https://jitpack.io</url>
<id>minecraft-repo</id>
<url>https://libraries.minecraft.net/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>false</enabled></snapshots>
</repository>
<repository>
<id>matteodev</id>
<url>https://maven.devs.beer/</url>
<!-- CodeMC snapshots (BentoBox CI builds if needed) -->
<repository>
<id>codemc</id>
<url>https://repo.codemc.org/repository/maven-snapshots/</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>com.github.MockBukkit</groupId>
<artifactId>MockBukkit</artifactId>
<version>v1.21-SNAPSHOT</version>
<version>${mock-bukkit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.21.10-R0.1-SNAPSHOT</version>
<version>1.21.11-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- Apache Commons Text -->
Expand All @@ -185,7 +210,6 @@
<scope>provided</scope>
</dependency>
<!-- Mockito (Unit testing) -->
<!-- Mockito (Unit testing) This goes at the top to ensure the dependencies are accurate. -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
Expand Down Expand Up @@ -235,6 +259,18 @@
<version>${items-adder.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.nexomc</groupId>
<artifactId>nexo</artifactId>
<version>${nexo.version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -302,6 +338,11 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.4</version>
<configuration>
<includes>
<include>**/*Test.java</include>
<include>**/*Test?.java</include>
<include>**/*Test??.java</include>
</includes>
<argLine>
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.math=ALL-UNNAMED
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/world/bentobox/aoneblock/AOneBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@
import world.bentobox.aoneblock.listeners.InfoListener;
import world.bentobox.aoneblock.listeners.ItemsAdderListener;
import world.bentobox.aoneblock.listeners.JoinLeaveListener;
import world.bentobox.aoneblock.listeners.NexoListener;
import world.bentobox.aoneblock.listeners.NoBlockHandler;
import world.bentobox.aoneblock.listeners.StartSafetyListener;
import world.bentobox.aoneblock.oneblocks.OneBlockCustomBlockCreator;
import world.bentobox.aoneblock.oneblocks.OneBlocksManager;
import world.bentobox.aoneblock.oneblocks.customblock.ItemsAdderCustomBlock;
import world.bentobox.aoneblock.oneblocks.customblock.NexoCustomBlock;
import world.bentobox.aoneblock.requests.IslandStatsHandler;
import world.bentobox.aoneblock.requests.LocationStatsHandler;
import world.bentobox.bentobox.api.addons.GameModeAddon;
Expand All @@ -53,6 +55,8 @@ public class AOneBlock extends GameModeAddon {
private static final String THE_END = "_the_end";
/** Whether ItemsAdder is present on the server */
private boolean hasItemsAdder = false;
/** Whether Nexo is present on the server */
private boolean hasNexo = false;

/** The addon settings */
private Settings settings;
Expand Down Expand Up @@ -116,6 +120,13 @@ public void onLoad() {
OneBlockCustomBlockCreator.register("itemsadder", ItemsAdderCustomBlock::fromMap);
hasItemsAdder = true;
}
// Check if Nexo exists, if yes register listener
if (Bukkit.getPluginManager().getPlugin("Nexo") != null) {
registerListener(new NexoListener(this));
OneBlockCustomBlockCreator.register(NexoCustomBlock::fromId);
OneBlockCustomBlockCreator.register("nexo", NexoCustomBlock::fromMap);
hasNexo = true;
}
// Save the default config from config.yml
saveDefaultConfig();
// Load settings from config.yml. This will check if there are any issues with
Expand Down Expand Up @@ -398,6 +409,13 @@ public boolean hasItemsAdder() {
return hasItemsAdder;
}

/**
* @return true if Nexo is on the server
*/
public boolean hasNexo() {
return hasNexo;
}

/**
* Set the addon's world. Used only for testing.
* @param world world
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public boolean canExecute(User user, String label, List<String> args) {
// Check phase
Optional<OneBlockPhase> opPhase = addon.getOneBlockManager().getPhase(args.getFirst().toUpperCase());
if (opPhase.isEmpty()) {
user.sendMessage("aoneblock.commands.admin.setchest.unknown-phase");
user.sendMessage("aoneblock.commands.admin.sanity.unknown-phase");
Comment thread
tastybento marked this conversation as resolved.
return false;
} else {
phase = opPhase.get();
Expand All @@ -59,7 +59,7 @@ public boolean execute(User user, String label, List<String> args) {
addon.getOneBlockManager().getProbs(phase);
}
if (user.isPlayer()) {
user.sendMessage("aoneblock.commands.admin.setchest.see-console");
user.sendMessage("aoneblock.commands.admin.sanity.see-console");
}
return true;
}
Expand Down
Loading
Loading