diff --git a/.github/workflows/modrinth-publish.yml b/.github/workflows/modrinth-publish.yml index 667c3529..f5e86d4e 100644 --- a/.github/workflows/modrinth-publish.yml +++ b/.github/workflows/modrinth-publish.yml @@ -91,6 +91,8 @@ jobs: 26.1 26.1.1 26.1.2 + 26.2 + 26.3 # Path to the built JAR — Maven produces AOneBlock-.jar in target/ # Note: glob patterns are not supported; use the release tag directly. diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 28ecf83b..870c80f5 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: "AOneBlock" # blank = skip Hangar curseforge_id: "1512493" - 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/pom.xml b/pom.xml index abd56b2d..31ff8436 100644 --- a/pom.xml +++ b/pom.xml @@ -50,13 +50,13 @@ UTF-8 UTF-8 - 21 + 25 5.10.2 - 5.11.0 - 4.110.0 + 5.20.0 + 4.119.0 - 3.22.0 + 3.23.7 4.0.17 1.8.0 0.0.67 @@ -67,7 +67,7 @@ -LOCAL - 1.29.0 + 1.30.0 BentoBoxWorld_AOneBlock bentobox-world @@ -187,14 +187,14 @@ org.mockbukkit.mockbukkit - mockbukkit-v1.21 + mockbukkit-v26.3 ${mock-bukkit.version} test io.papermc.paper paper-api - 1.21.11-R0.1-SNAPSHOT + 26.3.build.231-stable provided @@ -233,7 +233,7 @@ org.mockito mockito-junit-jupiter - 5.11.0 + ${mockito.version} test @@ -352,6 +352,7 @@ 3.13.0 ${java.version} + true diff --git a/src/main/java/world/bentobox/aoneblock/Settings.java b/src/main/java/world/bentobox/aoneblock/Settings.java index 4b943665..bb689892 100644 --- a/src/main/java/world/bentobox/aoneblock/Settings.java +++ b/src/main/java/world/bentobox/aoneblock/Settings.java @@ -382,9 +382,32 @@ public class Settings implements WorldSettings { @ConfigEntry(path = "world.falling-banned-commands") // , since = "1.8.0") 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("AOneBlock's own void generator places no structures, so this only matters if") + @ConfigComment("use-own-generator is true and another generator creates the worlds.") + @ConfigComment("Key is the vanilla structure id (e.g. trial_chambers, ancient-city), value is:") + @ConfigComment(" false - disable the structure in AOneBlock 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 = "1.30.0") + private Map structureSettings = new HashMap<>(); + // --------------------------------------------- /* ISLAND */ + @ConfigComment("Disable the team system in AOneBlock 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 /obadmin team disbandall once to remove existing team members.") + @ConfigComment("Requires BentoBox 3.16.0 or later.") + @ConfigEntry(path = "island.teams-disabled", since = "1.30.0") + private boolean teamsDisabled = false; @ConfigComment("Drop broken blocks on top of magic block") @ConfigComment("If you want Jobs or other plugins to recognize magic block breaking this must be false") @ConfigEntry(path = "island.drop-on-top") // , since = "1.3.0") @@ -2525,4 +2548,34 @@ public Color resolveChestColor(world.bentobox.aoneblock.oneblocks.OneBlockObject }; } + /** + * @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; + } + } \ No newline at end of file diff --git a/src/main/resources/addon.yml b/src/main/resources/addon.yml index dbfb5788..a2f31f46 100755 --- a/src/main/resources/addon.yml +++ b/src/main/resources/addon.yml @@ -1,7 +1,7 @@ name: AOneBlock main: world.bentobox.aoneblock.AOneBlock version: ${version}${build.number} -api-version: 3.22.0 +api-version: 3.23.0 metrics: true icon: "STONE" repository: "BentoBoxWorld/AOneBlock" diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index d3688154..1bf181e0 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -394,7 +394,29 @@ world: falling-banned-commands: - warp - spawn + # Per-world override for vanilla structure generation and structure searches + # (/locate, Eyes of Ender, explorer/treasure maps, dolphins, cartographer trades). + # AOneBlock's own void generator places no structures, so this only matters if + # use-own-generator is true and another generator creates the worlds. + # Key is the vanilla structure id (e.g. trial_chambers, ancient-city), value is: + # false - disable the structure in AOneBlock 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 1.30.0. + structure-settings: {} island: + # Disable the team system in AOneBlock 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 /obadmin team disbandall once to remove existing team members. + # Requires BentoBox 3.16.0 or later. + # Added since 1.30.0. + teams-disabled: false # Drop broken blocks on top of magic block # If you want Jobs or other plugins to recognize magic block breaking this must be false drop-on-top: true diff --git a/src/test/java/world/bentobox/aoneblock/SettingsTest.java b/src/test/java/world/bentobox/aoneblock/SettingsTest.java index 1f94692d..a15f1085 100644 --- a/src/test/java/world/bentobox/aoneblock/SettingsTest.java +++ b/src/test/java/world/bentobox/aoneblock/SettingsTest.java @@ -1761,7 +1761,19 @@ void testGetSaveEveryClampsZeroAndBelow() { s.setSaveEvery(-50); assertEquals(1, s.getSaveEvery()); } - - - -} \ No newline at end of file + + @Test + void testTeamsDisabled() { + assertFalse(s.isTeamsDisabled()); + s.setTeamsDisabled(true); + assertTrue(s.isTeamsDisabled()); + } + + @Test + void testStructureSettings() { + assertTrue(s.getStructureSettings().isEmpty()); + s.setStructureSettings(java.util.Map.of("monument", false, "trial_chambers", true)); + assertFalse(s.getStructureSettings().get("monument")); + assertTrue(s.getStructureSettings().get("trial_chambers")); + } +} diff --git a/src/test/java/world/bentobox/aoneblock/commands/island/IslandSetCountCommandTest.java b/src/test/java/world/bentobox/aoneblock/commands/island/IslandSetCountCommandTest.java index ccc21597..af9885f1 100644 --- a/src/test/java/world/bentobox/aoneblock/commands/island/IslandSetCountCommandTest.java +++ b/src/test/java/world/bentobox/aoneblock/commands/island/IslandSetCountCommandTest.java @@ -67,6 +67,9 @@ public class IslandSetCountCommandTest extends CommonTestSetup { @Override @AfterEach public void tearDown() throws Exception { + // setUp() injects a mock into the static RanksManager singleton; clear it so later + // test classes (e.g. AOneBlockTest) don't reach a mock Mockito has since disabled + WhiteBox.setInternalState(RanksManager.class, "instance", null); super.tearDown(); deleteAll(new File("database")); deleteAll(new File("database_backup")); diff --git a/src/test/java/world/bentobox/aoneblock/oneblocks/OneBlocksManagerTest3.java b/src/test/java/world/bentobox/aoneblock/oneblocks/OneBlocksManagerTest3.java index 54268749..210cf0c2 100644 --- a/src/test/java/world/bentobox/aoneblock/oneblocks/OneBlocksManagerTest3.java +++ b/src/test/java/world/bentobox/aoneblock/oneblocks/OneBlocksManagerTest3.java @@ -715,7 +715,7 @@ void testLoadPhasesChestWithUnknownItemSkipsItem() throws IOException { 0: ==: org.bukkit.inventory.ItemStack DataVersion: 4438 - id: minecraft:sulfur + id: minecraft:not_a_real_item count: 1 schema_version: 1 1: @@ -738,7 +738,7 @@ void testLoadPhasesChestWithUnknownItemSkipsItem() throws IOException { assertNotNull(phase); assertEquals(1, phase.getChests().size()); assertEquals(1, phase.getChests().iterator().next().getChest().size()); - verify(plugin).log(org.mockito.ArgumentMatchers.contains("Skipping item minecraft:sulfur")); + verify(plugin).log(org.mockito.ArgumentMatchers.contains("Skipping item minecraft:not_a_real_item")); verify(plugin, never()).logError(anyString()); }