Merge pull request #14 from SKBotNL/master
onUpdate now gets a PlayerBalanceChangedEvent
This commit was merged in pull request #14.
This commit is contained in:
4 files changed
+11
-3
No files matched your search
@@ -58,6 +58,7 @@ dependencies {
|
||||
implementation("io.lettuce:lettuce-core:6.7.1.RELEASE") // Import the Lettuce API for keydb.
|
||||
implementation("com.github.jasync-sql:jasync-postgresql:2.2.4") // Import the jasync Postgres API.
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib") // Import the Kotlin standard library.
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2")
|
||||
}
|
||||
|
||||
configurations.all { exclude(group = "io.projectreactor") }
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package net.trueog.diamondbankog
|
||||
|
||||
import java.util.UUID
|
||||
|
||||
internal class EventManager {
|
||||
private var listeners = listOf<PlayerBalanceChangedListener>()
|
||||
|
||||
fun sendUpdate(playerShards: PostgreSQL.PlayerShards) {
|
||||
listeners.forEach { it.onUpdate(playerShards) }
|
||||
fun sendUpdate(uuid: UUID, playerShards: PostgreSQL.PlayerShards) {
|
||||
listeners.forEach { it.onUpdate(PlayerBalanceChangedEvent(uuid, playerShards)) }
|
||||
}
|
||||
|
||||
fun register(listener: PlayerBalanceChangedListener) {
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package net.trueog.diamondbankog
|
||||
|
||||
import java.util.UUID
|
||||
|
||||
data class PlayerBalanceChangedEvent(val uuid: UUID, val playerShards: PostgreSQL.PlayerShards)
|
||||
@@ -1,5 +1,5 @@
|
||||
package net.trueog.diamondbankog
|
||||
|
||||
interface PlayerBalanceChangedListener {
|
||||
fun onUpdate(playerShards: PostgreSQL.PlayerShards)
|
||||
fun onUpdate(event: PlayerBalanceChangedEvent)
|
||||
}
|
||||
Reference in new issue
Block a user