add damage type emoji to death message
modify gradle build to inlcude changelogs
This commit is contained in:
parent
6a117af7ca
commit
bcc53a090e
|
@ -96,4 +96,5 @@ gradle-app.setting
|
|||
|
||||
### MatterLink ###
|
||||
|
||||
run/
|
||||
run/
|
||||
*.tmp
|
||||
|
|
|
@ -69,7 +69,8 @@ object EventWrapper {
|
|||
if (e.entityLiving is EntityPlayer) {
|
||||
DeathHandler.handleDeath(
|
||||
e.entityLiving.name,
|
||||
e.entityLiving.combatTracker.deathMessage.unformattedText
|
||||
e.entityLiving.combatTracker.deathMessage.unformattedText,
|
||||
damageType = e.source.damageType
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ class MatterLinkConfig(file: File) : BaseConfig() {
|
|||
getBoolean = config::getBoolean,
|
||||
getString = config::getString,
|
||||
getStringValidated = config::getString,
|
||||
getStringList = config::getStringList,
|
||||
addCustomCategoryComment = config::addCustomCategoryComment
|
||||
)
|
||||
|
||||
|
|
|
@ -69,7 +69,8 @@ object EventWrapper {
|
|||
if (e.entityLiving is EntityPlayer) {
|
||||
DeathHandler.handleDeath(
|
||||
e.entityLiving.name,
|
||||
e.entityLiving.combatTracker.deathMessage.unformattedText
|
||||
e.entityLiving.combatTracker.deathMessage.unformattedText,
|
||||
damageType = e.source.damageType
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ class MatterLinkConfig(file: File) : BaseConfig() {
|
|||
getBoolean = config::getBoolean,
|
||||
getString = config::getString,
|
||||
getStringValidated = config::getString,
|
||||
getStringList = config::getStringList,
|
||||
addCustomCategoryComment = config::addCustomCategoryComment
|
||||
)
|
||||
|
||||
|
|
|
@ -70,7 +70,8 @@ object EventWrapper {
|
|||
if (e.entityLiving is EntityPlayer) {
|
||||
DeathHandler.handleDeath(
|
||||
e.entityLiving.name,
|
||||
e.entityLiving.combatTracker.deathMessage.unformattedText
|
||||
e.entityLiving.combatTracker.deathMessage.unformattedText,
|
||||
damageType = e.source.damageType
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,11 +14,11 @@ class MatterLinkConfig(file: File) : BaseConfig() {
|
|||
getBoolean = config::getBoolean,
|
||||
getString = config::getString,
|
||||
getStringValidated = config::getString,
|
||||
getStringList = config::getStringList,
|
||||
addCustomCategoryComment = config::addCustomCategoryComment
|
||||
)
|
||||
|
||||
if (config.hasChanged()) config.save()
|
||||
|
||||
cfg = this
|
||||
}
|
||||
}
|
|
@ -42,9 +42,16 @@ subprojects {
|
|||
project {
|
||||
id = '287323'
|
||||
releaseType = 'beta'
|
||||
if(project.hasProperty('changelog')) {
|
||||
changelogType = "markdown"
|
||||
changelog = File(changelog)
|
||||
}
|
||||
relations {
|
||||
requiredLibrary 'shadowfacts-forgelin'
|
||||
}
|
||||
mainArtifact(jar) {
|
||||
displayName = "MatterLink $project.version"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ abstract class BaseConfig {
|
|||
private val CATEGORY_FORMATTING_JOIN_LEAVE = "formatting_join_leave"
|
||||
private val CATEGORY_CONNECTION = "connection"
|
||||
private val CATEGORY_COMMAND = "command"
|
||||
private val CATEGORY_DEATH = "death"
|
||||
}
|
||||
|
||||
var relay: RelayOptions = RelayOptions()
|
||||
|
@ -21,6 +22,7 @@ abstract class BaseConfig {
|
|||
var formatting: FormattingOptions = FormattingOptions()
|
||||
var formattingJoinLeave: FormattingJoinLeave = FormattingJoinLeave()
|
||||
var command: CommandOptions = CommandOptions()
|
||||
var death: DeathOptions = DeathOptions()
|
||||
|
||||
data class RelayOptions(
|
||||
var systemUser: String = "Server",
|
||||
|
@ -51,11 +53,50 @@ abstract class BaseConfig {
|
|||
var enable: Boolean = true
|
||||
)
|
||||
|
||||
data class DeathOptions(
|
||||
var showDamageType: Boolean = true,
|
||||
var damageTypeMapping: Map<String, String> = mapOf(
|
||||
"inFire" to "\uD83D\uDD25", //🔥
|
||||
"lightningBolt" to "\uD83C\uDF29", //🌩
|
||||
"onFire" to "\uD83D\uDD25", //🔥
|
||||
"lava" to "\uD83D\uDD25", //🔥
|
||||
"hotFloor" to "♨️",
|
||||
"inWall" to "",
|
||||
"cramming" to "",
|
||||
"drown" to "\uD83C\uDF0A", //🌊
|
||||
"starve" to "\uD83D\uDC80", //💀
|
||||
"cactus" to "\uD83C\uDF35", //🌵
|
||||
"fall" to "\u2BEF️", //⯯️
|
||||
"flyIntoWall" to "\uD83D\uDCA8", //💨
|
||||
"outOfWorld" to "\u2734", //✴
|
||||
"generic" to "\uD83D\uDC7B", //👻
|
||||
"magic" to "✨ ⚚",
|
||||
"indirectMagic" to "✨ ⚚",
|
||||
"wither" to "\uD83D\uDD71", //🕱
|
||||
"anvil" to "",
|
||||
"fallingBlock" to "",
|
||||
"dragonBreath" to "\uD83D\uDC32", //🐲
|
||||
"fireworks" to "\uD83C\uDF86", //🎆
|
||||
|
||||
"mob" to "\uD83D\uDC80", //💀
|
||||
"player" to "\uD83D\uDDE1", //🗡
|
||||
"arrow" to "\uD83C\uDFF9", //🏹
|
||||
"thrown" to "彡°",
|
||||
"thorns" to "\uD83C\uDF39", //🌹
|
||||
"explosion" to "\uD83D\uDCA3 \uD83D\uDCA5", //💣 💥
|
||||
"explosion.player" to "\uD83D\uDCA3 \uD83D\uDCA5", //💣 💥
|
||||
|
||||
"electrocut" to "⚡",
|
||||
"radiation" to "☢"
|
||||
)
|
||||
)
|
||||
|
||||
protected fun load(
|
||||
getBoolean: (key: String, category: String, default: Boolean, comment: String) -> Boolean,
|
||||
getString: (key: String, category: String, default: String, comment: String) -> String,
|
||||
getStringValidated: (key: String, category: String, default: String, comment: String, pattern: Pattern) -> String,
|
||||
addCustomCategoryComment: (key: String, comment: String) -> Unit
|
||||
addCustomCategoryComment: (key: String, comment: String) -> Unit,
|
||||
getStringList: (name: String, category: String, defaultValues: Array<String>, comment: String) -> Array<String>
|
||||
) {
|
||||
var category = CATEGORY_RELAY_OPTIONS
|
||||
addCustomCategoryComment(CATEGORY_RELAY_OPTIONS, "Relay options")
|
||||
|
@ -170,5 +211,29 @@ abstract class BaseConfig {
|
|||
"MatterBridge gateway"
|
||||
)
|
||||
)
|
||||
category = CATEGORY_DEATH
|
||||
addCustomCategoryComment(category, "Death message settings")
|
||||
death = DeathOptions(
|
||||
showDamageType = getBoolean(
|
||||
"showDamageType",
|
||||
category,
|
||||
death.showDamageType,
|
||||
"Enable Damage type symbols on death messages"
|
||||
),
|
||||
damageTypeMapping = getStringList(
|
||||
"damageTypeMapping",
|
||||
category,
|
||||
death.damageTypeMapping.map { entry ->
|
||||
"${entry.key}=${entry.value}" }
|
||||
.toTypedArray(),
|
||||
"Damage type mapping for everything else, " +
|
||||
"\nseperate value and key with '=', " +
|
||||
"\nseperate multiple values with spaces"
|
||||
).associate {
|
||||
val key = it.substringBefore('=')
|
||||
val value = it.substringAfter('=')
|
||||
Pair(key, value)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
|
@ -4,11 +4,23 @@ import matterlink.antiping
|
|||
import matterlink.bridge.ApiMessage
|
||||
import matterlink.bridge.MessageHandler
|
||||
import matterlink.config.cfg
|
||||
import java.util.*
|
||||
|
||||
object DeathHandler {
|
||||
fun handleDeath(player: String, deathMessage: String) {
|
||||
private val random = Random()
|
||||
|
||||
fun handleDeath(
|
||||
player: String,
|
||||
deathMessage: String,
|
||||
damageType: String
|
||||
) {
|
||||
if (cfg!!.relay.deathEvents) {
|
||||
val msg = deathMessage.replace(player, player.antiping())
|
||||
var msg = deathMessage.replace(player, player.antiping())
|
||||
if(cfg!!.death.showDamageType) {
|
||||
val emojis = cfg!!.death.damageTypeMapping[damageType]?.split(' ') ?: listOf("\uD83D\uDC7B unknown type '$damageType'")
|
||||
val damageEmoji = emojis[random.nextInt(emojis.size)]
|
||||
msg += " " + damageEmoji
|
||||
}
|
||||
MessageHandler.transmit(ApiMessage(
|
||||
username = cfg!!.relay.systemUser,
|
||||
text = msg
|
||||
|
|
|
@ -1 +1 @@
|
|||
mod_version = 1.2.3
|
||||
mod_version = 1.2.4
|
||||
|
|
Loading…
Reference in New Issue