diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0bc21e0..4e114d5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 21 + - 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: diff --git a/.github/workflows/modrinth-publish.yml b/.github/workflows/modrinth-publish.yml index 4b4213c..5feeb27 100644 --- a/.github/workflows/modrinth-publish.yml +++ b/.github/workflows/modrinth-publish.yml @@ -12,10 +12,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - - name: Set up JDK 21 + - name: Set up JDK 25 uses: actions/setup-java@v4 with: - java-version: 21 + java-version: 25 distribution: adopt cache: maven @@ -48,4 +48,6 @@ jobs: 26.1 26.1.1 26.1.2 + 26.2 + 26.3 files: /home/runner/work/Boxed/Boxed/target/Boxed-${{ github.event.release.tag_name }}.jar diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c2c0488..32b3f20 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,7 +23,7 @@ jobs: use_release_asset: "true" # publish the jar attached to the release; do not rebuild hangar_slug: "Boxed" # blank = skip Hangar curseforge_id: "1515492" - game_versions: "26.2,26.1.2,26.1.1,26.1,1.21.11,1.21.10,1.21.9,1.21.8,1.21.7,1.21.6,1.21.5" + game_versions: "26.3,26.2,26.1.2,26.1.1,26.1,1.21.11,1.21.10,1.21.9,1.21.8,1.21.7,1.21.6,1.21.5" version: ${{ inputs.version }} # empty on release events -> falls back to the release tag secrets: HANGAR_API_KEY: ${{ secrets.HANGAR_API_KEY }} diff --git a/CLAUDE.md b/CLAUDE.md index 6991635..1fdaba4 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Project -Boxed is a BentoBox GameModeAddon for Minecraft (Paper) where each player is confined to a small expandable box. Completing Minecraft advancements grows the box. Built against `bentobox` 3.17.0, Paper API 1.21.11, Java 21. +Boxed is a BentoBox GameModeAddon for Minecraft (Paper) where each player is confined to a small expandable box. Completing Minecraft advancements grows the box. Built against `bentobox` 3.23.7, Paper API 26.3, Java 25. ## Build / Test @@ -51,7 +51,7 @@ Because advancements are per-world in vanilla but Boxed runs multiple worlds on ## Testing notes -Tests use JUnit 5 (Jupiter) + Mockito 5 `mockStatic` + MockBukkit (`v1.21-SNAPSHOT` via jitpack.io). There is no PowerMock and no custom `ServerMocks` helper. All test classes extend `CommonTestSetup`, which: +Tests use JUnit 5 (Jupiter) + Mockito 5.20.0 `mockStatic` + MockBukkit (`v26.3` version 4.119.0 via jitpack.io). There is no PowerMock and no custom `ServerMocks` helper. All test classes extend `CommonTestSetup`, which: - Calls `MockBukkit.mock()` and registers `Mockito.mockStatic(Bukkit.class, RETURNS_DEEP_STUBS)` — use the inherited `mockedBukkit` field to stub `Bukkit.*` calls rather than creating your own. - Exposes ready-made `@Mock` fields (`plugin`, `mockPlayer`, `world`, `location`, `iwm`, `im`, `island`, `pim`, `itemFactory`, `inv`, `notifier`, `fm`, `spigot`, `hooksManager`, `bm`, `sch`, `lm`, `phm`) plus the MockBukkit `server` and `mockedUtil` statics. Don't re-declare these in subclasses. diff --git a/pom.xml b/pom.xml index d34bba0..ac3221d 100644 --- a/pom.xml +++ b/pom.xml @@ -50,20 +50,20 @@ UTF-8 UTF-8 - 21 + 25 5.10.2 - 5.11.0 - 4.110.0 + 5.20.0 + 4.119.0 - 1.21.11-R0.1-SNAPSHOT - 3.17.0 + 26.3.build.231-stable + 3.23.7 ${build.version}-SNAPSHOT -LOCAL - 3.4.1 + 3.5.0 BentoBoxWorld_Boxed bentobox-world @@ -165,7 +165,7 @@ org.mockbukkit.mockbukkit - mockbukkit-v1.21 + mockbukkit-v26.3 ${mock-bukkit.version} test @@ -312,7 +312,7 @@ - spigot + mojang @@ -363,7 +363,7 @@ org.jacoco jacoco-maven-plugin - 0.8.10 + 0.8.15 true diff --git a/src/main/java/world/bentobox/boxed/Settings.java b/src/main/java/world/bentobox/boxed/Settings.java index b0f5cd7..2dd7b2f 100644 --- a/src/main/java/world/bentobox/boxed/Settings.java +++ b/src/main/java/world/bentobox/boxed/Settings.java @@ -218,9 +218,31 @@ public class Settings implements WorldSettings { @ConfigEntry(path = "world.falling-banned-commands") private List fallingBannedCommands = new ArrayList<>(); + @ConfigComment("Per-world override for vanilla structure generation and structure searches") + @ConfigComment("(/locate, Eyes of Ender, explorer/treasure maps, dolphins, cartographer trades).") + @ConfigComment("Boxed generates vanilla worlds with structures, so this allows per-structure control.") + @ConfigComment("Key is the vanilla structure id (e.g. trial_chambers, ancient-city), value is:") + @ConfigComment(" false - disable the structure in Boxed worlds") + @ConfigComment(" true - force it on even if BentoBox's global world.disabled-structures disables it") + @ConfigComment("Structures not listed inherit BentoBox's global world.disabled-structures setting.") + @ConfigComment("Example:") + @ConfigComment(" structure-settings:") + @ConfigComment(" monument: false") + @ConfigComment(" trial_chambers: false") + @ConfigComment("Requires BentoBox 3.19.1 or later.") + @ConfigEntry(path = "world.structure-settings", since = "3.5.0") + private Map structureSettings = new HashMap<>(); + // --------------------------------------------- /* ISLAND */ + @ConfigComment("Disable the team system in Boxed worlds.") + @ConfigComment("When true, players cannot invite, accept team invites, kick, leave, promote, demote") + @ConfigComment("or change island owner. Trust and coop still work and are the alternative to teams.") + @ConfigComment("After turning this on, run /boxadmin team disbandall once to remove existing team members.") + @ConfigComment("Requires BentoBox 3.16.0 or later.") + @ConfigEntry(path = "area.teams-disabled", since = "3.5.0") + private boolean teamsDisabled = false; @ConfigComment("Default max team size") @ConfigComment("Permission size cannot be less than the default below. ") @ConfigEntry(path = "area.max-team-size") @@ -1824,4 +1846,34 @@ public void setAllowStructures(boolean allowStructures) { this.allowStructures = allowStructures; } + /** + * @return per-structure generation overrides for this game mode's worlds + */ + @Override + public Map getStructureSettings() { + return structureSettings; + } + + /** + * @param structureSettings per-structure generation overrides to set + */ + public void setStructureSettings(Map structureSettings) { + this.structureSettings = structureSettings; + } + + /** + * @return true if the team subsystem is disabled in this game mode's worlds + */ + @Override + public boolean isTeamsDisabled() { + return teamsDisabled; + } + + /** + * @param teamsDisabled whether to disable the team subsystem + */ + public void setTeamsDisabled(boolean teamsDisabled) { + this.teamsDisabled = teamsDisabled; + } + } diff --git a/src/main/resources/addon.yml b/src/main/resources/addon.yml index 982cc33..76bb86e 100755 --- a/src/main/resources/addon.yml +++ b/src/main/resources/addon.yml @@ -1,7 +1,7 @@ name: Boxed main: world.bentobox.boxed.Boxed version: ${version}${build.number} -api-version: 3.9.0 +api-version: 3.23.0 metrics: true icon: "COMPOSTER" repository: "BentoBoxWorld/Boxed" diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 50f4aa0..bf2a63c 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -304,7 +304,28 @@ world: # Falling banned commands - players cannot use these commands when falling # if the PREVENT_TELEPORT_WHEN_FALLING world setting flag is active falling-banned-commands: [] + # Per-world override for vanilla structure generation and structure searches + # (/locate, Eyes of Ender, explorer/treasure maps, dolphins, cartographer trades). + # Boxed generates vanilla worlds with structures, so this allows per-structure control. + # Key is the vanilla structure id (e.g. trial_chambers, ancient-city), value is: + # false - disable the structure in Boxed worlds + # true - force it on even if BentoBox's global world.disabled-structures disables it + # Structures not listed inherit BentoBox's global world.disabled-structures setting. + # Example: + # structure-settings: + # monument: false + # trial_chambers: false + # Requires BentoBox 3.19.1 or later. + # Added since 3.5.0. + structure-settings: {} area: + # Disable the team system in Boxed worlds. + # When true, players cannot invite, accept team invites, kick, leave, promote, demote + # or change island owner. Trust and coop still work and are the alternative to teams. + # After turning this on, run /boxadmin team disbandall once to remove existing team members. + # Requires BentoBox 3.16.0 or later. + # Added since 3.5.0. + teams-disabled: false # Default max team size # Permission size cannot be less than the default below. max-team-size: 4 diff --git a/src/test/java/world/bentobox/boxed/SettingsTest.java b/src/test/java/world/bentobox/boxed/SettingsTest.java index 200b1b2..51b7e33 100644 --- a/src/test/java/world/bentobox/boxed/SettingsTest.java +++ b/src/test/java/world/bentobox/boxed/SettingsTest.java @@ -401,4 +401,23 @@ void testGetAdminCommand() { assertEquals("admin", s.getAdminCommandAliases()); } + /** + * Test method for {@link world.bentobox.boxed.Settings#setStructureSettings(java.util.Map)}. + */ + @Test + void testSetStructureSettings() { + Map structureSettings = Collections.emptyMap(); + s.setStructureSettings(structureSettings); + assertEquals(structureSettings, s.getStructureSettings()); + } + + /** + * Test method for {@link world.bentobox.boxed.Settings#setTeamsDisabled(boolean)}. + */ + @Test + void testSetTeamsDisabled() { + s.setTeamsDisabled(true); + assertTrue(s.isTeamsDisabled()); + } + }