Skip to content

Fix lore command index handling and default-command typo - #9

Merged
dmccoystephenson merged 2 commits into
mainfrom
fix/command-index-and-typo
Aug 2, 2026
Merged

Fix lore command index handling and default-command typo#9
dmccoystephenson merged 2 commits into
mainfrom
fix/command-index-and-typo

Conversation

@dmccoystephenson

@dmccoystephenson dmccoystephenson commented Aug 2, 2026

Copy link
Copy Markdown
Member

Summary

  • /pl edit and /pl remove now treat lineIndex as 1-based, matching COMMANDS.md/USER_GUIDE.md, instead of silently indexing 0-based into the lore list (following the documented example -- add one line, then /pl edit 1 ... -- previously threw an uncaught IndexOutOfBoundsException).
  • Both commands now guard against missing/non-numeric index arguments with a player-facing message instead of throwing ArrayIndexOutOfBoundsException/NumberFormatException.
  • DefaultCommand no longer tells players to type the non-existent /lp help; it now says /pl help, consistent with every other usage string in the plugin and plugin.yml's registered commands (pl, playerlore).
  • Added JUnit 5 + Mockito as the project's first test dependencies (none existed previously) and added tests covering the fixed paths in EditCommand, RemoveCommand, and DefaultCommand.
  • Documented all three fixes in CHANGELOG.md under [Unreleased].

Test plan

  • mvn compile -- clean
  • mvn test -- 11/11 passing
  • Empirical regression check: stashed the fix, re-ran the new tests, confirmed 9 of them fail (ArrayIndexOutOfBounds, NumberFormatException, wrong-index assertions), then restored the fix and confirmed all 11 pass again
  • Docs (COMMANDS.md, USER_GUIDE.md) already described the correct (1-based) behavior -- no doc changes needed, only the code was brought in line with them

Closes #7
Closes #8


This PR description was drafted during a Gardener session (Stephenson-Software/gardener).

- /pl edit and /pl remove now treat lineIndex as 1-based (matching
  COMMANDS.md/USER_GUIDE.md) instead of indexing 0-based, and validate
  missing/non-numeric input instead of throwing
- DefaultCommand now points players at /pl help instead of the
  non-existent /lp help
- Add JUnit 5 + Mockito as the project's first test dependencies and
  cover the fixed command paths

Closes #7, Closes #8

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dmccoystephenson

dmccoystephenson commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

This comment was drafted during a Gardener session (Stephenson-Software/gardener).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dmccoystephenson

dmccoystephenson commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

Self-review rubric:

Repo-specific:

  • Command trio parity: PASS -- EditCommand and RemoveCommand (the two of the trio that take a lineIndex) now use identical guard/try-catch/1-based-bounds logic. AddCommand doesn't take an index argument, so no equivalent change applies there.

No open judgment-call items -- all rubric items pass with direct evidence.


This comment was drafted during a Gardener session (Stephenson-Software/gardener).

@dmccoystephenson

dmccoystephenson commented Aug 2, 2026

Copy link
Copy Markdown
Member Author

Holding this PR for manual merge rather than auto-merging: it modifies `pom.xml` (adding `junit-jupiter`/`mockito-core` as test-scope dependencies, plus an explicit `maven-surefire-plugin` version), which is on this repo's do-not-auto-merge list because pom.xml changes affect the shaded JAR/release artifact. The added dependencies are test-scope only (excluded from the shade plugin) so they should not affect the release artifact, but per this skill's own rule a pom.xml match requires human sign-off rather than autonomous merge, regardless of the broader merge pre-authorization for this run.

CI is green (https://github.com/Dans-Plugins/PlayerLore/actions/runs/30770764974) and the self-review rubric above passed with no open judgment calls. Ready to merge on approval.


This comment was drafted during a Gardener session (Stephenson-Software/gardener).

@dmccoystephenson
dmccoystephenson merged commit 9fed812 into main Aug 2, 2026
1 check 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

1 participant