Skip to content

fix: use sender-aware completion for ban commands - #97

Merged
wisdommen merged 2 commits into
masterfrom
feature/sender-aware-ban-completion
Nov 13, 2026
Merged

wisdommen merged 2 commits into
masterfrom
feature/sender-aware-ban-completion

Conversation

@wisdommen

@wisdommen wisdommen commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Replace the player-only completion overrides in BanCommand, TempBanCommand and UnbanCommand with named, sender-aware @CmdParam providers.
  • Share the existing visibility-aware online-player source for /ban and /tempban; provide duration presets to console as well as players. Keep /unban on distinct names from the module's active, unexpired ban records.
  • Let the framework apply silent permission/target filtering and case-insensitive prefix matching before returning completion candidates.
  • Pin the provided UltiTools-API dependency to released 6.4.0, declare api-version: 640, and align the README and metadata regression tests. Update FEATURES.md and UAT-CHECKLIST.md with the completion behavior and acceptance cases.

Closes #96
Refs UltiKits/UltiTools-Reborn#839

Validation

  • RED: against UltiTools-API 6.4.0, the new BanCompletionTest ran 11 cases with 8 failures before the implementation change: console providers were not invoked and unauthorized players received candidates.
  • GREEN: the new 11 cases pass; 34 targeted completion, visibility and ban-command regression cases pass.
  • mvn -B clean verify: 1,454 tests passed, 0 failures, 0 errors, 0 skipped.
  • JaCoCo: 94.78% instruction, 97.34% line, 85.69% branch coverage; existing coverage gates pass without weakening thresholds or adding exclusions.
  • git diff --check passes.

UAT: required — console/player tab-completion behavior is visible to operators; real-server acceptance remains pending.

Threat model

Normal operator completion from player, console and RCON senders, including missing command permissions, vanished targets, partial tokens and active module-ban records. Ban persistence, execution and vanilla ban lists are unchanged.

Known limitations

UltiTools-API 6.4.0 returns null when non-player completion has no candidates, allowing Bukkit's existing default online-name fallback. This module does not change that framework contract or claim to suppress it. The README, inventory and regression test explicitly preserve this case.

Open questions

The minimum framework version rises from 6.3.0 to 6.4.0 so older frameworks reject this build instead of silently missing the sender-aware behavior. This compatibility-floor change must be accounted for when choosing the next module release version; the module's version is not bumped or released by this PR.

The bilingual developer-doc companion requested by UltiTools-Reborn#839 item 2 remains separate: document TabCompletionContext.getSender(), nullable getPlayer() for non-player requests, exact CommandSender provider signatures, silent permission/target filtering, and the non-player empty-candidate fallback.

🤖 Generated with Claude Code

Review fixes

F1–F4, F6: remove duplicate duration candidates; correct RCON and API-version claims; clarify permission-completion observations and command-list refresh; restore English Javadoc.

Route ban targets, active ban names and duration presets through framework providers for console and player completion. Require UltiTools-API 6.4.0 and align metadata, docs and regression tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@wisdommen

Copy link
Copy Markdown
Member Author

Cross-family code review (single review, Claude Opus) — head 5dcff20

Result: no P1 or P2 findings. The 6.4.0 framework resolves all three new CommandSender completion providers; vanished players stay hidden from senders without ultiessentials.hide.see; a sender without the command permission gets no candidates and no provider runs; the /unban list holds only active, unexpired records, deduplicated, IP-only records included; the README names only the framework version.

P3 findings and disposition:

  • F1 TempBanCommand: console completion of the duration argument lists each preset twice (both tempban formats supply durations and 6.4.0 does not deduplicate at that position); players see each once. — Fix in one follow-up commit with a test asserting exact candidates.
  • F2 README / FEATURES promise completion over RCON, which has no completion request. — Fix (doc).
  • F3 FEATURES still states api-version: 630; the module declares 640. — Fix (doc).
  • F4 UAT row ban.neg-completion-permission: Paper hides an unpermitted command from the client, so the "no candidates" clause passes even if framework filtering broke, and the client's own "Unknown or incomplete command" hint is not a module denial message. — Fix the row wording (and note the client command list refresh after a grant).
  • F5 /unban completion includes IP addresses (now also for console), which may point operators away from /unbanip. — Product choice, not a defect; recorded in the follow-up issue.
  • F6 Chinese-only Javadoc on suggestBanPlayers and a mixed-language sentence in PluginMetadataTest. — Fix (comment language).

F1–F4 and F6 go into a single fix commit (RED→GREEN test for F1); no confirmation review round follows.

Keep duration suggestions on one mapping, assert exact candidates for both senders, and correct completion documentation and comments.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@wisdommen

Copy link
Copy Markdown
Member Author

Gate 3 — real-machine UAT (local Codex)

  • Candidate: head 41cc057, UltiEssentials 2.0.0 JAR, 244129 bytes, SHA-256 d96bf82eec1298fff9802218a95294bcec6dd131f49301bac1e1ea1763e0b853 (clean build after the final commit); UltiTools-API 6.4.0 from Maven Central, Paper 1.21.11 build 132, LuckPerms 5.5.85.
  • Executor: Codex gpt-6.1-sol, reasoning xhigh; independent of the code review (it never saw review output).
  • Result: 6 pass / 0 fail / 0 blocked — every changed or added checklist row:
    • ultiessentials.ban.ban.neg-completion-vanished
    • ultiessentials.ban.ban.neg-completion-console
    • ultiessentials.ban.tempban.neg-completion-duration
    • ultiessentials.ban.unban.neg-completion-console
    • ultiessentials.ban.ban.neg-completion-permission
    • ultiessentials.recall.summon.neg-vanish
  • Method: player completion through real protocol completion requests (raw packets kept, with a /tell positive control on the same connection); console completion through a real Tab keystroke in the interactive Paper console, after a tell positive control, without executing any command. banlist was empty before and after every completion row.
  • Console duration completion now lists 1h, 12h, 1d, 1w once each (the duplicate presets reported in review are gone).
  • A first run was blocked before server start by a missing Paper bootstrap input in the test environment (not the candidate); the run above is a full re-run of all six rows.
  • This verdict does not authorise a release.

@wisdommen
wisdommen merged commit e154098 into master Nov 13, 2026
2 checks passed
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.

Ban, TempBan and Unban: use the framework's sender-aware tab completion

1 participant