Added counterToZero

This commit is contained in:
bluefireoly
2020-09-13 15:10:51 +02:00
parent fac071228f
commit eb6313b452
2 changed files with 5 additions and 3 deletions

View File

@@ -52,7 +52,7 @@ class GamePhase(
) { ) {
if (counterMessage != null) { if (counterMessage != null) {
val currentCounter = it.counterDown val currentCounter = it.counterDownToOne
if (currentCounter?.isCounterValue == true) if (currentCounter?.isCounterValue == true)
broadcast(counterMessage.invoke(currentCounter)) broadcast(counterMessage.invoke(currentCounter))
} }

View File

@@ -22,7 +22,8 @@ class KRunnableHolder {
abstract class KSpigotRunnable( abstract class KSpigotRunnable(
var counterUp: Long? = null, var counterUp: Long? = null,
var counterDown: Long? = null var counterDownToOne: Long? = null,
var counterDownToZero: Long? = null,
) : BukkitRunnable() ) : BukkitRunnable()
/** /**
@@ -58,7 +59,8 @@ fun KSpigot.task(
var ranOut = false var ranOut = false
if (howOften != null) { if (howOften != null) {
counterDown = howOften - curCounter counterDownToOne = howOften - curCounter
counterDownToZero = counterDownToOne?.minus(1)
curCounter++ curCounter++
if (curCounter >= howOften) if (curCounter >= howOften)