Skip to content

feat: per-world max claims and World Settings API - #108

Merged
derrickmehaffy merged 3 commits into
releases/0.12.0from
feat/per-world-max-claims
Mar 18, 2026
Merged

feat: per-world max claims and World Settings API#108
derrickmehaffy merged 3 commits into
releases/0.12.0from
feat/per-world-max-claims

Conversation

@derrickmehaffy

Copy link
Copy Markdown
Contributor

Description

Add per-world max claims setting and a thread-safe World Settings API for external plugin integration.

Per-World Max Claims: New maxClaims field in worlds.json limits how many claims a single faction can hold in a specific world (e.g., 5 claims max in an "events" world). null/0 = use global limit. Enforced in both /f claim and /f overclaim. Admin-manageable via /f admin world set <world> maxclaims <n>.

World Settings API: 4 new HyperFactionsAPI methods (registerWorldSettings, getWorldSettings, getConfiguredWorldSettings, removeWorldSettings) for external plugins (like HyperVerse) to programmatically inject per-world settings with upsert semantics, immediate persistence, and thread safety.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test coverage

Related Issues

N/A — planned feature for 0.12.0

Testing

  • Tested on local development server
  • Added/updated unit tests
  • Verified no regressions in existing functionality

Manual testing plan:

  • Set per-world max claims: /f admin world set survival maxclaims 3
  • Verify: /f admin world info survival shows maxClaims=3
  • Claim 3 chunks in survival → succeeds
  • Claim 4th chunk → gets localized "world max claims" error
  • Verify claiming in other worlds still works (no per-world limit)
  • Set claiming: false for a world → verify it still blocks entirely
  • Test overclaim path with world limits
  • Test API: another mod calls HyperFactionsAPI.registerWorldSettings(...)
  • Verify upsert: calling same registration again does NOT trigger a save
  • Verify persistence: restart server, check worlds.json contains the API-injected settings
  • Test removal: HyperFactionsAPI.removeWorldSettings(...) removes and persists
  • /f admin world list shows all settings including API-injected ones

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my own code
  • I have commented my code where necessary
  • I have updated the documentation (if applicable)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix/feature works
  • New and existing tests pass locally with my changes

Files changed (38):

  • Config: WorldsConfig.java, WorldSettingsResolver.java, ConfigManager.java
  • Logic: ClaimManager.java (WORLD_MAX_CLAIMS_REACHED + per-world check)
  • API: HyperFactionsAPI.java (4 new world settings methods)
  • Commands: AdminWorldHandler.java, ClaimSubCommand.java, OverclaimSubCommand.java
  • GUI: ChunkMapPage.java, FactionDashboardPage.java, AdminConfigPage.java
  • Keys: CommandKeys.java, GuiKeys.java
  • Locale: 20 .lang files (10 locales × 2 files each)
  • Docs: config.md, api.md, commands.md, managers.md, CHANGELOG.md

Add maxClaims per-world setting to limit how many claims a faction can
hold in a specific world. Null/0 = use global limit, >0 = hard cap.
Enforced in both claim and overclaim flows.

Add thread-safe World Settings API for external plugins to register,
query, and remove per-world settings programmatically with upsert
semantics and immediate persistence.

- WorldSettings record: 5th param maxClaims (Integer, nullable)
- WorldSettingsResolver: volatile + copy-on-write for thread safety
- ConfigManager: registerWorldSettings/removeExternalWorldSettings
- ClaimManager: WORLD_MAX_CLAIMS_REACHED + per-world check
- HyperFactionsAPI: 4 new world settings methods
- Admin commands: maxclaims support in set/info/list
- Localized messages in all 10 locales (20 .lang files)
- Documentation: config, api, commands, managers
@derrickmehaffy derrickmehaffy added the enhancement New feature or request label Mar 18, 2026
Add integer stepper for maxClaims in the world override expanded
settings panel. Supports increment/decrement buttons and direct
numeric input. Value of 0 = use global limit (stored as null).
Fix {0} placeholder not being filled in world_max_claims messages across
all 5 call sites (claim command, overclaim command, dashboard, chunk map).

Add login warning for officers/leaders when their faction exceeds any
per-world claim limit — existing claims are preserved (soft cap) but
officers are notified to voluntarily unclaim excess territory.

- Make ClaimManager.countFactionClaimsInWorld() public
- Add ConfigManager.getWorldsConfig() getter
- Add world_overclaimed locale key (all 10 languages)
@derrickmehaffy
derrickmehaffy merged commit 41ae9f6 into releases/0.12.0 Mar 18, 2026
2 checks passed
@derrickmehaffy
derrickmehaffy deleted the feat/per-world-max-claims branch March 18, 2026 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant