mirror of
				https://github.com/GayPizzaSpecifications/foundation.git
				synced 2025-11-04 03:39:37 +00:00 
			
		
		
		
	Heimdall: Correct timestamp resolution of all events.
This commit is contained in:
		@ -15,14 +15,15 @@ import java.util.*
 | 
				
			|||||||
class BlockBreak(
 | 
					class BlockBreak(
 | 
				
			||||||
  val playerUniqueIdentity: UUID,
 | 
					  val playerUniqueIdentity: UUID,
 | 
				
			||||||
  val location: Location,
 | 
					  val location: Location,
 | 
				
			||||||
  val material: Material
 | 
					  val material: Material,
 | 
				
			||||||
 | 
					  val timestamp: Instant = Instant.now()
 | 
				
			||||||
) : HeimdallEvent() {
 | 
					) : HeimdallEvent() {
 | 
				
			||||||
  constructor(event: BlockBreakEvent) : this(event.player.uniqueId, event.block.location, event.block.type)
 | 
					  constructor(event: BlockBreakEvent) : this(event.player.uniqueId, event.block.location, event.block.type)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  override fun store(transaction: Transaction) {
 | 
					  override fun store(transaction: Transaction) {
 | 
				
			||||||
    transaction.apply {
 | 
					    transaction.apply {
 | 
				
			||||||
      BlockBreakTable.insert {
 | 
					      BlockBreakTable.insert {
 | 
				
			||||||
        it[time] = Instant.now()
 | 
					        it[time] = timestamp
 | 
				
			||||||
        it[player] = playerUniqueIdentity
 | 
					        it[player] = playerUniqueIdentity
 | 
				
			||||||
        it[world] = location.world.uid
 | 
					        it[world] = location.world.uid
 | 
				
			||||||
        it[block] = material.storageBlockName
 | 
					        it[block] = material.storageBlockName
 | 
				
			||||||
 | 
				
			|||||||
@ -13,14 +13,15 @@ import java.util.*
 | 
				
			|||||||
class BlockPlace(
 | 
					class BlockPlace(
 | 
				
			||||||
  val playerUniqueIdentity: UUID,
 | 
					  val playerUniqueIdentity: UUID,
 | 
				
			||||||
  val location: Location,
 | 
					  val location: Location,
 | 
				
			||||||
  val material: Material
 | 
					  val material: Material,
 | 
				
			||||||
 | 
					  val timestamp: Instant = Instant.now()
 | 
				
			||||||
  ) : HeimdallEvent() {
 | 
					  ) : HeimdallEvent() {
 | 
				
			||||||
  constructor(event: BlockPlaceEvent) : this(event.player.uniqueId, event.block.location, event.block.type)
 | 
					  constructor(event: BlockPlaceEvent) : this(event.player.uniqueId, event.block.location, event.block.type)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  override fun store(transaction: Transaction) {
 | 
					  override fun store(transaction: Transaction) {
 | 
				
			||||||
    transaction.apply {
 | 
					    transaction.apply {
 | 
				
			||||||
      BlockPlaceTable.insert {
 | 
					      BlockPlaceTable.insert {
 | 
				
			||||||
        it[time] = Instant.now()
 | 
					        it[time] = timestamp
 | 
				
			||||||
        it[player] = playerUniqueIdentity
 | 
					        it[player] = playerUniqueIdentity
 | 
				
			||||||
        it[world] = location.world.uid
 | 
					        it[world] = location.world.uid
 | 
				
			||||||
        it[block] = material.storageBlockName
 | 
					        it[block] = material.storageBlockName
 | 
				
			||||||
 | 
				
			|||||||
@ -10,14 +10,15 @@ import java.util.*
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class PlayerPosition(
 | 
					class PlayerPosition(
 | 
				
			||||||
  val playerUniqueIdentity: UUID,
 | 
					  val playerUniqueIdentity: UUID,
 | 
				
			||||||
  val location: Location
 | 
					  val location: Location,
 | 
				
			||||||
 | 
					  val timestamp: Instant = Instant.now()
 | 
				
			||||||
) : HeimdallEvent() {
 | 
					) : HeimdallEvent() {
 | 
				
			||||||
  constructor(event: PlayerMoveEvent) : this(event.player.uniqueId, event.to)
 | 
					  constructor(event: PlayerMoveEvent) : this(event.player.uniqueId, event.to)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  override fun store(transaction: Transaction) {
 | 
					  override fun store(transaction: Transaction) {
 | 
				
			||||||
    transaction.apply {
 | 
					    transaction.apply {
 | 
				
			||||||
      PlayerPositionTable.insert {
 | 
					      PlayerPositionTable.insert {
 | 
				
			||||||
        it[time] = Instant.now()
 | 
					        it[time] = timestamp
 | 
				
			||||||
        it[player] = playerUniqueIdentity
 | 
					        it[player] = playerUniqueIdentity
 | 
				
			||||||
        it[world] = location.world.uid
 | 
					        it[world] = location.world.uid
 | 
				
			||||||
        it[x] = location.x
 | 
					        it[x] = location.x
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user