Skip to content

Improve CountdownHelper: optional messages, finishMessage, and boss bar color - #14

Merged
Trilleo merged 2 commits into
masterfrom
copilot/complete-countdown-helper-util
Apr 22, 2026
Merged

Improve CountdownHelper: optional messages, finishMessage, and boss bar color#14
Trilleo merged 2 commits into
masterfrom
copilot/complete-countdown-helper-util

Conversation

Copilot AI commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

CountdownHelper lacked a finish-state message, forced callers to always provide a message string, and hardcoded the boss bar color to blue.

Changes

start() signature

  • message: String? = null — per-tick display is skipped when omitted
  • finishMessage: String? = null — shown via displayLocation at countdown end (replaces the would-be 0s tick); omit to suppress
  • bossBarColor: BossBar.Color = BossBar.Color.BLUE — controls boss bar color when displayLocation == BOSS_BAR
  • sound and finishSound now default to null; no need to pass them explicitly for silence
  • displayLocation moved before the optional parameters for a cleaner call-site read order

Internal

  • Extracted private showMessage() helper — eliminates duplication between the per-tick and finish display paths

Example

CountdownHelper().start(
    plugin          = plugin,
    player          = player,
    seconds         = 10,
    displayLocation = DisplayLocation.BOSS_BAR,
    bossBarColor    = BossBar.Color.RED,
    message         = "<yellow>Starts in {seconds}",
    finishMessage   = "<green>Go!",
    finishSound     = Sound.sound(Key.key("minecraft:entity.player.levelup"), Sound.Source.MASTER, 1f, 1f),
    onFinish        = { p -> startGame(p) }
)

Copilot AI and others added 2 commits April 22, 2026 02:13
@Trilleo
Trilleo marked this pull request as ready for review April 22, 2026 02:31
@Trilleo
Trilleo merged commit eaadfd4 into master Apr 22, 2026
@Trilleo
Trilleo deleted the copilot/complete-countdown-helper-util branch April 22, 2026 02:58
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.

2 participants