Skip to content

feat!: public BanManager v8 API (BanManagerAPI module + service layer)#1075

Open
confuser wants to merge 3 commits into
masterfrom
feat/v8-public-api
Open

feat!: public BanManager v8 API (BanManagerAPI module + service layer)#1075
confuser wants to merge 3 commits into
masterfrom
feat/v8-public-api

Conversation

@confuser
Copy link
Copy Markdown
Member

Summary

  • Extracts a stable, platform-agnostic public API into a new BanManagerAPI module: immutable DTOs, mutable request builders, a service-oriented facade (BanManagerService + per-domain services), an event bus, and a typed exception hierarchy — superseding the old per-platform event classes.
  • Implements those services in common on top of the existing storage layer: bridges the shaded vs. unshaded ipaddress types, and exposes async (CompletableFuture) and sync variants with a documented cancellation/sentinel contract (storage veto -> Optional.empty() / false, not a failed future).
  • Sits on the Java 17 baseline from chore: modernise codebase for Java 17 baseline #1070 (Java 21 to build from source).
  • Adds service-layer contract tests so all 11 public services are covered, plus a few residual review follow-ups (Gradle daemon heap, .context/ ignore, IP-overload Javadoc).

Test plan

  • ./gradlew :BanManagerCommon:test — full service-layer suite green (Ban, Player, Report, Mute, Warn, Note, NameBan, IpBan, IpRangeBan, IpMute, History)
  • ./gradlew build on JDK 21 (full multi-platform build)
  • E2E workflow across Bukkit / Bungee / Sponge / Velocity / Fabric
  • Confirm the downstream WebEnhancer PR builds against this API

confuser added 2 commits May 30, 2026 14:50
Introduce a stable, dependency-light `api/` artifact as the public surface
for plugin authors and migrate the core onto it:

- New BanManagerAPI module: BanManagerService plus BanService, MuteService,
  IpBan/IpMute/IpRangeBan/NameBan/Note/Report/Warn/Player/History services,
  EventBus, MigrationService and BanManagerScheduler, with immutable DTOs,
  fluent *Request types and a typed event hierarchy.
- Core refactored to constructor injection against those interfaces; legacy
  per-platform api/events/* classes removed in favour of the shared API.
- Residual review fixes: honest DataSource privilege docs, MigrationService
  semantics + prefix-collision registry (MigrationPrefixRegistry), String
  overloads on IP requests to avoid leaking inet.ipaddr coupling, and an
  explicit EventBus threading contract.
- UPGRADE.md documents the v7 -> v8 migration, Java 17 runtime floor and
  rollback procedure.

Builds green on JDK 21 (Java 17 baseline) across all platforms incl. the
BanManagerCommon test suite.
Covers the eight public services that lacked direct service-layer tests
after the v8 API extraction (Mute, Warn, Note, NameBan, IpBan,
IpRangeBan, IpMute, History), bringing all 11 services under test. Each
asserts the documented async-layer contract:

- create/ban/mute return Optional.empty() on a storage-level veto and
  resolve to a non-exceptional empty future on the async variant
- unban/unmute short-circuit to false without touching storage when no
  active record exists
- null requests fail fast with NullPointerException
- HistoryService validates pagination up front and returns empty results
  for unknown players without hitting the history tables

Also folds in residual review follow-ups:
- bump Gradle daemon heap to 4G to avoid local OOM under parallel builds
- ignore .context/ agent-review artifacts
- document that the String IP request overloads accept CIDR/subnet
  literals, rarely intended for single-host bans/mutes
Table names can't be bound as JDBC parameters, so the sample plugin's
row-count helper concatenated them directly. The values are internal
(BanManager's own resolved table names), but validating against a strict
identifier pattern keeps the query injection-safe and clears the
SonarCloud security hotspot on the v8 PR.
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant