feat: per-gamemode mob spawn replacement rules#19
Merged
Conversation
Closed
2 tasks
- 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.
- 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.
Copilot
AI
changed the title
[WIP] Add configuration file for gamemode versions
feat: per-gamemode mob spawn replacement rules
May 30, 2026
|
❌ The last analysis has failed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ExtraMobs previously applied one set of global spawn chances uniformly across every BentoBox GameMode. This adds a
gamemode-settingsconfig block that lets admins define per-gamemode, per-environment replacement rules that override the global defaults.Changes
config/MobSpawnReplacement.java(new) — POJO for a single replacement rule (old,new,chance); resolves string names toEntityTypeat runtime so the YAML layer staysMap-based.config/Settings.java— addsMap<String, Object> gamemodeSettingsat pathgamemode-settings;getReplacements(gameModeName, environment)parses the raw YAML structure into typedMobSpawnReplacementlists, never returning null.listeners/MobsSpawnListener.java— each environment branch (nether/end/world) callsapplyGameModeReplacements()before the global-chance fallback. When per-gamemode rules match, global defaults are skipped for that event.config.yml— addsgamemode-settings: {}with inline documentation and a worked example.Example config
Fully backward-compatible — omitting
gamemode-settings(or leaving it empty) preserves existing global behaviour unchanged.