Heimdall: Correct timestamp resolution of all events.

This commit is contained in:
Kenneth Endfinger 2021-12-24 01:41:14 -05:00
parent 9952c4c427
commit fae116a2a5
No known key found for this signature in database
GPG Key ID: C4E68E5647420E10
3 changed files with 10 additions and 7 deletions

View File

@ -15,14 +15,15 @@ import java.util.*
class BlockBreak(
val playerUniqueIdentity: UUID,
val location: Location,
val material: Material
val material: Material,
val timestamp: Instant = Instant.now()
) : HeimdallEvent() {
constructor(event: BlockBreakEvent) : this(event.player.uniqueId, event.block.location, event.block.type)
override fun store(transaction: Transaction) {
transaction.apply {
BlockBreakTable.insert {
it[time] = Instant.now()
it[time] = timestamp
it[player] = playerUniqueIdentity
it[world] = location.world.uid
it[block] = material.storageBlockName

View File

@ -13,14 +13,15 @@ import java.util.*
class BlockPlace(
val playerUniqueIdentity: UUID,
val location: Location,
val material: Material
) : HeimdallEvent() {
val material: Material,
val timestamp: Instant = Instant.now()
) : HeimdallEvent() {
constructor(event: BlockPlaceEvent) : this(event.player.uniqueId, event.block.location, event.block.type)
override fun store(transaction: Transaction) {
transaction.apply {
BlockPlaceTable.insert {
it[time] = Instant.now()
it[time] = timestamp
it[player] = playerUniqueIdentity
it[world] = location.world.uid
it[block] = material.storageBlockName

View File

@ -10,14 +10,15 @@ import java.util.*
class PlayerPosition(
val playerUniqueIdentity: UUID,
val location: Location
val location: Location,
val timestamp: Instant = Instant.now()
) : HeimdallEvent() {
constructor(event: PlayerMoveEvent) : this(event.player.uniqueId, event.to)
override fun store(transaction: Transaction) {
transaction.apply {
PlayerPositionTable.insert {
it[time] = Instant.now()
it[time] = timestamp
it[player] = playerUniqueIdentity
it[world] = location.world.uid
it[x] = location.x