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
2 changes: 2 additions & 0 deletions .github/workflows/modrinth-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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-<version>.jar in target/
# Note: glob patterns are not supported; use the release tag directly.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
17 changes: 9 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@
<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 -->
<bentobox.version>3.22.0</bentobox.version>
<bentobox.version>3.23.7</bentobox.version>
<items-adder.version>4.0.17</items-adder.version>
<nexo.version>1.8.0</nexo.version>
<craftengine.version>0.0.67</craftengine.version>
Expand All @@ -67,7 +67,7 @@
<!-- 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.29.0</build.version>
<build.version>1.30.0</build.version>
<!-- SonarCloud -->
<sonar.projectKey>BentoBoxWorld_AOneBlock</sonar.projectKey>
<sonar.organization>bentobox-world</sonar.organization>
Expand Down Expand Up @@ -187,14 +187,14 @@
<dependencies>
<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>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.21.11-R0.1-SNAPSHOT</version>
<version>26.3.build.231-stable</version>
<scope>provided</scope>
</dependency>
<!-- Apache Commons Text -->
Expand Down Expand Up @@ -233,7 +233,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>5.11.0</version>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -352,6 +352,7 @@
<version>3.13.0</version>
<configuration>
<release>${java.version}</release>
<fork>true</fork>
</configuration>
</plugin>
<plugin>
Expand Down
53 changes: 53 additions & 0 deletions src/main/java/world/bentobox/aoneblock/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,32 @@
@ConfigEntry(path = "world.falling-banned-commands") // , since = "1.8.0")
private List<String> 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<String, Boolean> 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")
Expand Down Expand Up @@ -2404,7 +2427,7 @@
}
try {
return Particle.valueOf(name.toUpperCase(java.util.Locale.ENGLISH));
} catch (IllegalArgumentException e) {

Check warning on line 2430 in src/main/java/world/bentobox/aoneblock/Settings.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Replace "e" with an unnamed pattern.

See more on https://sonarcloud.io/project/issues?id=BentoBoxWorld_AOneBlock&issues=AaHdDfN29lLbsYsJXo-l&open=AaHdDfN29lLbsYsJXo-l&pullRequest=568
return defaultParticle;
}
}
Expand Down Expand Up @@ -2525,4 +2548,34 @@
};
}

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

/**
* @param structureSettings per-structure generation overrides to set
*/
public void setStructureSettings(Map<String, Boolean> 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;
}

}
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: 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"
Expand Down
22 changes: 22 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 16 additions & 4 deletions src/test/java/world/bentobox/aoneblock/SettingsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1761,7 +1761,19 @@ void testGetSaveEveryClampsZeroAndBelow() {
s.setSaveEvery(-50);
assertEquals(1, s.getSaveEvery());
}



}

@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"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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());
}

Expand Down
Loading