Reload drinksByEvent when difficulty changes

This commit is contained in:
2024-10-21 18:08:57 +02:00
parent efa21d08f9
commit 1725f52f43

View File

@@ -18,14 +18,19 @@ data class Serving(
val audience: AudienceType
)
class Barkeeper(
private val logger: Logger
) {
class Barkeeper(private val logger: Logger) {
var debug: Boolean = false
private var enabled: Boolean = false
private var difficulty = Difficulty.Comfy
val drinksByEvent = mapOf(
var drinksByEvent = mapOf<String, Any>()
init {
reloadDrinksByEvent()
}
private fun reloadDrinksByEvent() {
this.drinksByEvent = mapOf(
"EntityDamageEvent" to Serving(amount = 1, audience = AudienceType.SELF),
"PlayerDeathEvent" to Serving(amount = 1, audience = AudienceType.ALL),
"PlayerJoinEvent" to Serving(amount = 1, audience = AudienceType.ALL),
@@ -58,6 +63,7 @@ class Barkeeper(
"EMERALD_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
),
)
}
fun enableDebug(debug: Boolean) {
this.debug = debug;
@@ -77,6 +83,7 @@ class Barkeeper(
fun setDifficulty(difficulty: Difficulty) {
this.difficulty = difficulty;
this.reloadDrinksByEvent();
}
fun order(sourceEvent: Event, sourcePlayer: Player) {