Reload drinksByEvent when difficulty changes
This commit is contained in:
@@ -18,46 +18,52 @@ 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(
|
||||
"EntityDamageEvent" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
"PlayerDeathEvent" to Serving(amount = 1, audience = AudienceType.ALL),
|
||||
"PlayerJoinEvent" to Serving(amount = 1, audience = AudienceType.ALL),
|
||||
"PlayerPortalEvent" to Serving(amount = 1, audience = AudienceType.ALL),
|
||||
"entityOnDeath" to mapOf(
|
||||
"Wither" to Serving(amount = 2, audience = AudienceType.ALL),
|
||||
"EnderDragon" to Serving(amount = 3, audience = AudienceType.ALL)
|
||||
),
|
||||
"blockBreak" to mapOf(
|
||||
"ANCIENT_DEBRIS" to Serving(amount = 2, audience = AudienceType.ALL),
|
||||
var drinksByEvent = mapOf<String, Any>()
|
||||
|
||||
"LEGACY_DIAMOND_ORE" to Serving(amount = 1, audience = AudienceType.ALL),
|
||||
"DEEPSLATE_DIAMOND_ORE" to Serving(amount = 1, audience = AudienceType.ALL),
|
||||
"DIAMOND_ORE" to Serving(amount = 1, audience = AudienceType.ALL),
|
||||
init {
|
||||
reloadDrinksByEvent()
|
||||
}
|
||||
|
||||
"LEGACY_IRON_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
"DEEPSLATE_IRON_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
"IRON_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
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),
|
||||
"PlayerPortalEvent" to Serving(amount = 1, audience = AudienceType.ALL),
|
||||
"entityOnDeath" to mapOf(
|
||||
"Wither" to Serving(amount = 2, audience = AudienceType.ALL),
|
||||
"EnderDragon" to Serving(amount = 3, audience = AudienceType.ALL)
|
||||
),
|
||||
"blockBreak" to mapOf(
|
||||
"ANCIENT_DEBRIS" to Serving(amount = 2, audience = AudienceType.ALL),
|
||||
|
||||
"LEGACY_COAL_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
"DEEPSLATE_COAL_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
"COAL_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
"LEGACY_DIAMOND_ORE" to Serving(amount = 1, audience = AudienceType.ALL),
|
||||
"DEEPSLATE_DIAMOND_ORE" to Serving(amount = 1, audience = AudienceType.ALL),
|
||||
"DIAMOND_ORE" to Serving(amount = 1, audience = AudienceType.ALL),
|
||||
|
||||
"LEGACY_GOLD_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
"DEEPSLATE_GOLD_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
"GOLD_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
"LEGACY_IRON_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
"DEEPSLATE_IRON_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
"IRON_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
|
||||
"LEGACY_EMERALD_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
"DEEPSLATE_EMERALD_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
"EMERALD_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
),
|
||||
)
|
||||
"LEGACY_COAL_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
"DEEPSLATE_COAL_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
"COAL_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
|
||||
"LEGACY_GOLD_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
"DEEPSLATE_GOLD_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
"GOLD_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
|
||||
"LEGACY_EMERALD_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
"DEEPSLATE_EMERALD_ORE" to Serving(amount = 1, audience = AudienceType.SELF),
|
||||
"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) {
|
||||
|
Reference in New Issue
Block a user