#Statistic tracker
1 messages · Page 1 of 1 (latest)
dude there's barely any difference to java in this case
ffs
I guess I'll have like ```kt
public data class StatisticValue<T>(public var value: T)
public interface TrackableStatistic<G : GameInstance<G>, T> {
public val key: Key
public fun getStatisticValue(instance: G, player: UUID): StatisticValue<T>
public operator fun get(instance: G, player: UUID): T = getStatisticValue(instance, player).value
}
public class StatisticTracker {
private val data: MutableMap<UUID, MutableMap<Key, StatisticValue<*>>> = mutableMapOf()
}
Actually the statistic itself shouldn't have a getter thingy
???
@Test
public fun test() {
val ctx = GameContext(UUID.randomUUID(), GameTypes.SIMPLE_TEST, Audience.empty(), List(5) { UUID.randomUUID() })
val instance = SimpleTestGameInstance(GameTypes.SIMPLE_TEST, ctx, 0)
instance.statisticTracker.load(DefaultStatistics)
val players = ctx.playerList
players.forEach { player ->
assertEquals(0, instance.statisticTracker[DefaultStatistics.ELIMINATIONS, player])
instance.statisticTracker.increment(DefaultStatistics.ELIMINATIONS, player)
assertEquals(1, instance.statisticTracker[DefaultStatistics.ELIMINATIONS, player])
}
}

it worky
um akchutually thats not a proper test method name
i'll changei t just for you
is it test_ebic_fuck_off_gamething now