Skip to content

Commit

Permalink
Make DoubleJumpModule utilize ActionBarModule if present
Browse files Browse the repository at this point in the history
  • Loading branch information
ex4dev committed Dec 3, 2023
1 parent 9b6c062 commit 031247c
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,30 @@ class DoubleJumpModule(
if (cooldownMillis > 0)
eventNode.addListener(PlayerTickEvent::class.java) { event ->
val remainingMs = cooldownMillis - getTimeSinceLastJump(event.player)
if (remainingMs >= 0)
event.player.sendActionBar(
if (remainingMs >= 0) {
if (!parent.hasModule<ActionBarModule>()) {
event.player.sendActionBar(
abilityProgressBar(
Component.translatable("global.ability.double_jump", ALT_COLOR_1, TextDecoration.BOLD),
remainingMs.toInt(),
cooldownMillis.toInt()
)
)
}
}
}

eventNode.addListener(ActionBarModule.CollectActionBarEvent::class.java) { event ->
val remainingMs = cooldownMillis - getTimeSinceLastJump(event.player)
if (remainingMs >= 0) {
event.addItem(
abilityProgressBar(
Component.translatable("global.ability.double_jump", ALT_COLOR_1, TextDecoration.BOLD),
remainingMs.toInt(),
cooldownMillis.toInt()
)
)
}
}
}

Expand Down

0 comments on commit 031247c

Please sign in to comment.