feat!: public BanManager v8 API (BanManagerAPI module + service layer)#1075
Open
confuser wants to merge 3 commits into
Open
feat!: public BanManager v8 API (BanManagerAPI module + service layer)#1075confuser wants to merge 3 commits into
confuser wants to merge 3 commits into
Conversation
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.
|
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.


Summary
BanManagerAPImodule: 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.commonon top of the existing storage layer: bridges the shaded vs. unshadedipaddresstypes, and exposes async (CompletableFuture) and sync variants with a documented cancellation/sentinel contract (storage veto ->Optional.empty()/false, not a failed future)..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 buildon JDK 21 (full multi-platform build)