Release 1.15.0#20
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Lets ExtraMobs load as a Paper plugin via the Pladdon entry point in addition to being loaded by BentoBox as an addon. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces Spigot with the Paper API, bumps Java to 21, BentoBox to 3.14.0-SNAPSHOT, and swaps the JUnit 4 + PowerMock + Mockito 3 test stack for JUnit 5 + MockBukkit + Mockito 5. Also updates compiler, surefire, and shade plugins to versions that support Java 21 class files. PowerMock was the previous test framework but it cannot instrument modern class files, so the suite no longer runs without this swap. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Rewrites MobsSpawnListenerTest on JUnit 5 + MockBukkit + Mockito 5 and adds ExtraMobsAddonTest covering the addon lifecycle. Introduces CommonTestSetup, TestWorldSettings, and WhiteBox following the CaveBlock / DimensionalTrees pattern so future tests can extend CommonTestSetup and inherit a real MockBukkit server plus a stubbed BentoBox singleton. 32 tests covering guard clauses, the Nether/End/Overworld replacement branches, and the suitable-block predicates. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Runs mvn verify on every push to develop/master and on PRs, then hands the result to SonarCloud under the bentobox-world organization and the BentoBoxWorld_ExtraMobs project key. SONAR_TOKEN is supplied by the repo secret. JDK 21 to match the new build target. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Initial plan
* feat: add per-gamemode mob spawn replacement config
- New config/MobSpawnReplacement.java: POJO for a single mob
replacement rule (old EntityType name, new EntityType name, chance).
Provides resolveOldEntityType() / resolveNewEntityType() helpers.
- Settings.java: add Map<String, Object> gamemodeSettings field at path
"gamemode-settings" with full @ConfigComment documentation.
Add getGamemodeSettings() / setGamemodeSettings() pair.
Add getReplacements(gameModeName, environment) which parses the raw
YAML map structure into typed MobSpawnReplacement lists; returns
List.of() (never null) when no overrides are configured.
- MobsSpawnListener.java: extract applyGameModeReplacements() helper
that checks per-gamemode rules before each global-fallback branch
(nether, end, world). When per-gamemode rules fire, global settings
are skipped for that event.
- config.yml: document new gamemode-settings section with commented
multi-gamemode example (BSkyBlock, AcidIsland).
- ExtraMobsAddonTest.java: include gamemode-settings: {} in config
constant; add testGamemodeSettingsEmptyByDefault and
testGetReplacementsEmptyWhenNoPerGamemodeConfig tests.
- MobsSpawnListenerTest.java: default-stub getReplacements() to
Collections.emptyList(); add 9 new tests covering per-gamemode
nether/end/world paths, fallback on entity mismatch / chance=0,
invalid mob name skipping, and Settings.getReplacements() unit tests.
* refactor: address code review feedback
- Settings.java: remove redundant field initializer on gamemodeSettings;
setter null-guard and getReplacements() null-check are sufficient.
- MobsSpawnListenerTest.java: add comment explaining why HashMap.put()
is required instead of Map.of() for the raw gamemode-settings test.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Drops the Alpha-stage notice, restructures the page with the same section layout used by the recently-updated DimensionalTrees README, and rewrites the configuration and replacement-rules sections to reflect the current Nether / End / Overworld behaviour. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The merge from master reintroduced ServerMocks.java and added a stale import to MobsSpawnListenerTest. ServerMocks predates the MockBukkit-based test infrastructure and no longer compiles against Paper 1.21.11 (its Registry.get call is ambiguous against the new Registry<TypedKey<T>> overload). MockBukkit covers the same ground via CommonTestSetup, so drop the file and its now-unused import. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
- MobsSpawnListener.onEntitySpawn: split the three world-type branches into handleNetherSpawn / handleEndSpawn / handleOverworldSpawn, and extract resolveActiveGameMode for the GameMode lookup. Drops cognitive complexity from 42 to under the 15-rule limit (S3776). - MobsSpawnListener.isSuitableGuardianLocation: drop the always-true block != null guard inside the WATER walk (S2589). - MobsSpawnListener: in the overworld branch, combine the deep-ocean biome check with the suitable-block check into one guard so there's no nested if (S1066). Move the four block lookup lists to static Set<Material> constants while we're touching them, since the per-call array allocation showed up in the same hotspot. - Settings.getReplacements: extract parseReplacement helper so the loop has zero continue statements (S135). - MobsSpawnListenerTest: replace the Java `assert` keyword in testGetReplacementsNullInputs / testGetReplacementsParsesRawMap with JUnit assertEquals / assertTrue so the tests actually verify state when -ea is not set (S2699). 42/42 tests still green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Surefire's <argLine> was hard-coded with the --add-opens flags only,
which overrode the ${argLine} property that
jacoco-maven-plugin:prepare-agent sets to attach the coverage agent.
As a result no jacoco.exec was ever produced and SonarCloud reported
0% coverage despite the suite running. Prepending @{argLine} lets
Maven late-bind the Jacoco-supplied javaagent flag alongside the
existing --add-opens, so coverage now lands in
target/site/jacoco/jacoco.xml where the Sonar scanner picks it up.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR prepares the ExtraMobs 1.15.0 release by updating the build/runtime stack, adding per-gamemode mob replacement configuration, refreshing documentation, and expanding test coverage around spawn replacement behavior.
Changes:
- Adds configurable per-gamemode spawn replacement rules and supporting parsing/model code.
- Modernizes the Maven build/test setup to Java 21, Paper, JUnit 5, MockBukkit, and GitHub Actions.
- Adds/rewrites tests and documentation for addon lifecycle, listener behavior, and configuration.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/build.yml |
Adds CI build and Sonar analysis workflow. |
CLAUDE.md |
Adds repository guidance for development and testing. |
README.md |
Rewrites user-facing addon usage and configuration documentation. |
pom.xml |
Updates dependency versions, Java level, test stack, and build plugins. |
src/main/java/world/bentobox/extramobs/ExtraMobsPladdon.java |
Adds Bukkit pladdon bridge entry point. |
src/main/java/world/bentobox/extramobs/config/MobSpawnReplacement.java |
Adds model for per-gamemode mob replacement rules. |
src/main/java/world/bentobox/extramobs/config/Settings.java |
Adds raw per-gamemode settings and parsing helpers. |
src/main/java/world/bentobox/extramobs/listeners/MobsSpawnListener.java |
Refactors spawn handling and applies per-gamemode replacement rules. |
src/main/resources/config.yml |
Documents and defaults the new gamemode-settings section. |
src/main/resources/plugin.yml |
Adds Bukkit plugin metadata for the pladdon wrapper. |
src/test/java/world/bentobox/extramobs/CommonTestSetup.java |
Adds shared MockBukkit/Mockito test setup. |
src/test/java/world/bentobox/extramobs/ExtraMobsAddonTest.java |
Adds addon lifecycle and settings tests. |
src/test/java/world/bentobox/extramobs/TestWorldSettings.java |
Adds minimal test implementation of BentoBox world settings. |
src/test/java/world/bentobox/extramobs/WhiteBox.java |
Adds reflection helper for test static state setup. |
src/test/java/world/bentobox/extramobs/listeners/MobsSpawnListenerTest.java |
Rewrites and expands listener tests for global and per-gamemode behavior. |
src/test/java/world/bentobox/extramobs/listeners/mocks/ServerMocks.java |
Removes custom Bukkit server mock helper in favor of shared MockBukkit setup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- MobSpawnReplacement.resolveOldEntityType / resolveNewEntityType: use toUpperCase(Locale.ROOT) so config parsing stays stable across server locales (Turkish 'i' vs 'I' problem). Reviewer comments at MobSpawnReplacement.java:67 and :90. - config.yml + README: rewrite the per-gamemode override note to describe the actual fallback-on-miss semantics. The current listener falls through to global chances when no per-gamemode rule fires (wrong entity / chance roll failed), and that behaviour is enshrined by testPerGameModeNetherChanceZeroFallsBackToGlobal / testPerGameModeNetherReplacementEntityMismatchFallsBackToGlobal — the docs were wrong, not the code. Reviewer comments at config.yml:31 and README.md:78. - CLAUDE.md: refresh stale build/test guidance for the 1.15.0 toolchain (Java 21 / Paper 1.21.11 / BentoBox 3.14.0-SNAPSHOT, MockBukkit + JUnit 5, Pladdon entry point, per-gamemode rule semantics with the test names to look for before changing the listener). Reviewer comment at CLAUDE.md:15. - .github/workflows/build.yml: split mvn verify from the Sonar invocation, gate the Sonar step on the PR coming from the same repo so PRs from forks (where SONAR_TOKEN is not exposed) still get a green Maven build instead of failing during analysis. Reviewer comment at build.yml:38. 42/42 tests still green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|



No description provided.