Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
- name: Set up JDK 25
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 21
java-version: 25
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/modrinth-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

# 2. Set up Java 21 (required by CaveBlock's build)
- name: Set up Java 21
# 2. Set up Java 25 (required by CaveBlock's build)
- name: Set up Java 25
uses: actions/setup-java@v4
with:
java-version: '21'
java-version: '25'
distribution: 'temurin'

# 3. Cache Maven dependencies to speed up builds
Expand Down Expand Up @@ -91,6 +91,7 @@ jobs:
26.1.1
26.1.2
26.2
26.3

# Path to the built JAR — Maven produces CaveBlock-<version>.jar in target/
# Note: glob patterns are not supported; use the release tag directly.
Expand Down
9 changes: 5 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mvn test # Run tests (surefire)
mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=BentoBoxWorld_CaveBlock # CI build with SonarCloud
```

Java 21 is required. The output JAR goes to `target/`.
Java 25 is required (BentoBox 3.23+ and Paper 26.x are Java 25 artifacts). The output JAR goes to `target/`.

## Architecture

Expand All @@ -26,7 +26,7 @@ Java 21 is required. The output JAR goes to `target/`.
- `generators/ChunkGeneratorWorld.java` — Core chunk generator. Fills the world with the dimension's base blocks (stone/netherrack/end stone) and delegates additional material generation to the populator pipeline. `NoiseCaveGenerator` and `Ore` support noise-based cave carving and ore placement.
- `generators/populators/` — `NewMaterialPopulator` (vanilla-like material generation), `CaveDecorationPopulator` (cave decoration), and the biome providers `FlatBiomeProvider` / `NetherBiomeProvider` (biome distribution per dimension).
- `listeners/CustomHeightLimitations.java` — Prevents players from going above the configured world depth. Respects `SKY_WALKER_FLAG` and creative/op bypass.
- `listeners/StructureGenerationListener.java` — Suppresses vanilla structures the admin disabled in `world.structures` from the CaveBlock overworld: cancels their spawn (`AsyncStructureSpawnEvent`) and removes them from structure searches (`StructuresLocateEvent`) so `/locate`, explorer maps, etc. don't scan to the radius cap and freeze the server.
- Structure suppression (`world.structures`) is handled by BentoBox core's `StructureListener` (BentoBox 3.19.1+): `Settings#getStructureSettings()` returns the `world.structures` map, and core cancels disabled structures' spawns and strips them from `StructuresLocateEvent` searches in all three CaveBlock worlds. CaveBlock no longer has its own listener.

**BentoBox framework patterns to follow:**
- Addons use `GameModeAddon` lifecycle, not Bukkit's `JavaPlugin` directly
Expand All @@ -37,8 +37,9 @@ Java 21 is required. The output JAR goes to `target/`.

## Key Dependencies (provided scope — server supplies at runtime)

- `paper-api` 1.21.11 — Paper API
- `bentobox` 3.14.1-SNAPSHOT — BentoBox framework
- `paper-api` 26.3 (`26.3.build.231-stable`) — Paper API
- `bentobox` 3.23.7 — BentoBox framework
- `mockbukkit-v26.3` 4.119.0 — server mock used in tests (its MC line must match the paper-api version or registry validation fails)

## Branches

Expand Down
15 changes: 8 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>21</java.version>
<java.version>25</java.version>
<!-- Non-minecraft related dependencies -->
<junit.version>5.10.2</junit.version>
<mockito.version>5.11.0</mockito.version>
<mock-bukkit.version>4.110.0</mock-bukkit.version>
<mockito.version>5.20.0</mockito.version>
<mock-bukkit.version>4.119.0</mock-bukkit.version>
<!-- More visible way how to change dependency versions -->
<paper.version>1.21.11-R0.1-SNAPSHOT</paper.version>
<bentobox.version>3.14.1-SNAPSHOT</bentobox.version>
<paper.version>26.3.build.231-stable</paper.version>
<bentobox.version>3.23.7</bentobox.version>
<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision>
<!-- This allows to change between versions and snapshots. -->
<build.version>1.23.3</build.version>
<build.version>1.24.0</build.version>
<build.number>-LOCAL</build.number>
<sonar.organization>bentobox-world</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
Expand Down Expand Up @@ -132,7 +132,7 @@
<!-- MockBukkit -->
<dependency>
<groupId>org.mockbukkit.mockbukkit</groupId>
<artifactId>mockbukkit-v1.21</artifactId>
<artifactId>mockbukkit-v26.3</artifactId>
<version>${mock-bukkit.version}</version>
<scope>test</scope>
</dependency>
Expand Down Expand Up @@ -213,6 +213,7 @@
<version>3.13.0</version>
<configuration>
<release>${java.version}</release>
<fork>true</fork>
</configuration>
</plugin>
<plugin>
Expand Down
11 changes: 3 additions & 8 deletions src/main/java/world/bentobox/caveblock/CaveBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import world.bentobox.caveblock.commands.IslandAboutCommand;
import world.bentobox.caveblock.generators.ChunkGeneratorWorld;
import world.bentobox.caveblock.listeners.CustomHeightLimitations;
import world.bentobox.caveblock.listeners.StructureGenerationListener;


public class CaveBlock extends GameModeAddon
Expand Down Expand Up @@ -80,8 +79,6 @@

// Register listeners
this.registerListener(new CustomHeightLimitations(this));
// StructureGenerationListener is registered earlier, in createWorlds(), so it is
// active before the first chunks (including the spawn area) are generated.
}


Expand Down Expand Up @@ -149,11 +146,9 @@
@Override
public void createWorlds()
{
// Register the structure listener before any world is created. createWorlds() runs
// before onEnable(), and generating a world also generates its spawn-area chunks, so a
// listener registered in onEnable() would miss those first structures (issue #116).
this.registerListener(new StructureGenerationListener(this));

// Structure suppression (world.structures) is handled by BentoBox core's
// StructureListener via Settings#getStructureSettings(). Core registers it before
// createWorlds(), so spawn-area structures are covered too (issue #116).
String worldName = this.settings.getWorldName().toLowerCase();

if (this.getServer().getWorld(worldName) == null)
Expand Down Expand Up @@ -310,7 +305,7 @@
* This addon uses the new chunk generation API for the sea bottom
*/
@Override
public boolean isUsesNewChunkGeneration()

Check warning on line 308 in src/main/java/world/bentobox/caveblock/CaveBlock.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Don't override this deprecated method, it has been marked for removal.

See more on https://sonarcloud.io/project/issues?id=BentoBoxWorld_CaveBlock&issues=AaHdAvzRASsLdyanX8Dp&open=AaHdAvzRASsLdyanX8Dp&pullRequest=123
{
return true;
}
Expand Down
49 changes: 46 additions & 3 deletions src/main/java/world/bentobox/caveblock/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,15 @@

@ConfigComment("")
@ConfigComment("Vanilla structures that may generate in the overworld cave world.")
@ConfigComment("Set a structure to false to stop it generating; structures not listed here")
@ConfigComment("generate as normal. Use the vanilla structure key, for example:")
@ConfigComment("Set a structure to false to stop it generating, or true to force it on even if")
@ConfigComment("BentoBox's global world.disabled-structures list disables it. Structures not listed")
@ConfigComment("here follow that global list. Use the vanilla structure key, for example:")
@ConfigComment(" ancient_city, trial_chambers, mineshaft, mineshaft_mesa, stronghold,")
@ConfigComment(" mansion, monument, pillager_outpost, ruined_portal, trail_ruins,")
@ConfigComment(" village_plains, desert_pyramid, jungle_pyramid, igloo, swamp_hut")
@ConfigComment("Large structures like Ancient Cities and Trial Chambers can fill or unbalance")
@ConfigComment("a cave world, so they are disabled by default. Only affects the overworld.")
@ConfigComment("a cave world, so they are disabled by default. Disabled structures are also skipped")
@ConfigComment("by /locate, Eyes of Ender, explorer maps and dolphins. Handled by BentoBox core.")
@ConfigEntry(path = "world.structures", since = "1.23.0")
private Map<String, Boolean> generateStructures = defaultStructures();

Expand Down Expand Up @@ -321,6 +323,14 @@
// ---------------------------------------------

/* Cave */
@ConfigComment("Disable the team system in CaveBlock worlds.")
@ConfigComment("When true, players cannot invite, accept team invites, kick, leave, promote, demote")
@ConfigComment("or change cave owner. Trust and coop still work and are the alternative to teams.")
@ConfigComment("After turning this on, run /cbadmin team disbandall once to remove existing team members.")
@ConfigComment("Requires BentoBox 3.16.0 or later.")
@ConfigEntry(path = "cave.teams-disabled", since = "1.24.0")
private boolean teamsDisabled = false;

@ConfigComment("Default max team size")
@ConfigComment("Permission size cannot be less than the default below. ")
@ConfigEntry(path = "cave.max-team-size")
Expand Down Expand Up @@ -928,6 +938,15 @@
}


/**
* @return true if the team subsystem is disabled in this game mode's worlds
*/
@Override
public boolean isTeamsDisabled()
{
return teamsDisabled;
}

/**
* This method returns the maxTeamSize object.
* @return the maxTeamSize object.
Expand Down Expand Up @@ -1257,6 +1276,22 @@
this.generateStructures = generateStructures;
}

/**
* @return per-structure generation overrides for this game mode's worlds
*/
@Override
public Map<String, Boolean> getStructureSettings()

Check warning on line 1283 in src/main/java/world/bentobox/caveblock/Settings.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Update this method so that its implementation is not identical to "getGenerateStructures" on line 1264.

See more on https://sonarcloud.io/project/issues?id=BentoBoxWorld_CaveBlock&issues=AaHdAdYnUPDpoJKGSh3K&open=AaHdAdYnUPDpoJKGSh3K&pullRequest=123
{
return generateStructures;
}

/**
* @param structureSettings per-structure generation overrides to set
*/
public void setStructureSettings(Map<String, Boolean> structureSettings)
{
this.generateStructures = structureSettings;
}

/**
* Fraction of overworld vanilla cave air to re-solidify after generation to
Expand Down Expand Up @@ -1806,6 +1841,14 @@
}


/**
* @param teamsDisabled whether to disable the team subsystem
*/
public void setTeamsDisabled(boolean teamsDisabled)
{
this.teamsDisabled = teamsDisabled;
}

/**
* This method sets the maxTeamSize object value.
* @param maxTeamSize the maxTeamSize object new value.
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/resources/addon.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: CaveBlock
main: world.bentobox.caveblock.CaveBlock
version: ${version}${build.number}
api-version: 3.14
api-version: 3.23.0
metrics: true
repository: "BentoBoxWorld/CaveBlock"
icon: "STONE_PICKAXE"
Expand Down
Loading
Loading