Add default colour for challenge description and reward text#418
Merged
Conversation
Reimplements the useful part of the closed PR #340 in a way that fits the current pipeline. Setting a default colour saves admins from prefixing every challenge's description/reward text with the same colour code. Two new gui-settings, both empty by default (no change): - description-color: colour applied to each line of a challenge's own description text. - reward-text-color: colour applied to each line of a challenge's own first-time and repeat reward text. The colour is applied per line (so multi-line text stays coloured on every lore line) before Util.translateColorCodes, so it uses the same '&' / hex codes as the challenge text itself; a colour written in the text still overrides the default. Only the challenge's own data-field text is affected, not per-challenge locale overrides. The lore-length line-wrapping half of #340 is intentionally left out: it was built on legacy ChatColor wrapping incompatible with MiniMessage, its default reintroduced the space-less-language issues it was removed for, and the panel already wraps reward text via wrapToWidth(). Adds Utils.applyDefaultColor with JUnit coverage (blank/empty handling, single/multi-line, blank-line preservation, hex colours). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NKxodNE4h3TsSHMqDEeC8v
|
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.



Replaces the closed #340 (see the closing note there for why the original couldn't be merged — MiniMessage migration broke its legacy-colour wrapping and
&bprefixing).This keeps the genuinely useful idea from that PR — a default text colour so admins don't have to prefix every challenge's description/reward text with the same colour code — reimplemented to work with the current pipeline.
What it adds
Two new
gui-settings, both empty by default (no behaviour change):description-color— colour applied to each line of a challenge's own description text.reward-text-color— colour applied to each line of a challenge's own first-time and repeat reward text.Utils.applyDefaultColor(text, color)prefixes every line (so multi-line text stays coloured on each lore line) and runs beforeUtil.translateColorCodes, so it uses the same&/ hex codes (e.g.&b,7FFFF) as the challenge text. A colour written in the text itself still overrides the default (a later code wins). Only the challenge's own data-field text is affected — per-challenge locale overrides are left alone (admins colour those directly).Deliberately left out
The
lore-lengthline-wrapping half of #340 is not included:WordUtils.wrap+ChatColor.getLastColors, which miscount/mangle MiniMessage tags.wrapToWidth().Tests
UtilsTestcoversapplyDefaultColor: blank/null colour → unchanged, empty/null text → unchanged, single-line and multi-line prefixing, blank-line preservation, and hex colours. Full suite green (508 tests).Closes the loop on #340.
🤖 Generated with Claude Code