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 val audience: AudienceType
) )
class Barkeeper( class Barkeeper(private val logger: Logger) {
private val logger: Logger
) {
var debug: Boolean = false var debug: Boolean = false
private var enabled: Boolean = false private var enabled: Boolean = false
private var difficulty = Difficulty.Comfy 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), "EntityDamageEvent" to Serving(amount = 1, audience = AudienceType.SELF),
"PlayerDeathEvent" to Serving(amount = 1, audience = AudienceType.ALL), "PlayerDeathEvent" to Serving(amount = 1, audience = AudienceType.ALL),
"PlayerJoinEvent" 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), "EMERALD_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
), ),
) )
}
fun enableDebug(debug: Boolean) { fun enableDebug(debug: Boolean) {
this.debug = debug; this.debug = debug;
@@ -77,6 +83,7 @@ class Barkeeper(
fun setDifficulty(difficulty: Difficulty) { fun setDifficulty(difficulty: Difficulty) {
this.difficulty = difficulty; this.difficulty = difficulty;
this.reloadDrinksByEvent();
} }
fun order(sourceEvent: Event, sourcePlayer: Player) { fun order(sourceEvent: Event, sourcePlayer: Player) {