summary refs log tree commit diff homepage
path: root/src/MinecraftHandler.ts
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/MinecraftHandler.ts15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/MinecraftHandler.ts b/src/MinecraftHandler.ts
index 452784a..faf1828 100644
--- a/src/MinecraftHandler.ts
+++ b/src/MinecraftHandler.ts
@@ -113,15 +113,14 @@ class MinecraftHandler {
         return { username: serverUsername, message: `**${username}** ${rest}` }
       }
     } else if (this.config.SHOW_PLAYER_DEATH) {
-      for (let word of this.config.DEATH_KEY_WORDS){
-        if (data.includes(word)){
-          if (this.config.DEBUG) {
-            console.log(
-              `[DEBUG] A player died. Matched key word "${word}"`
-            )
-          }
-          return { username: serverUsername, message: logLine }
+      const death_msg_re = new RegExp(this.config.REGEX_DEATH_MESSAGE)
+      const death_msg_match = logLine.match(death_msg_re)
+
+      if (death_msg_match) {
+        if (this.config.DEBUG) {
+          console.log(`[DEBUG] A player died. Matched on "${death_msg_match[1]}"`)
         }
+        return { username: serverUsername, message: logLine }
       }
     }
 
up style in pbdJune McEnroe 2017-05-01Use EX_OK in pbcopyJune McEnroe 2017-04-30Clean up clockJune McEnroe 2017-04-30Clean up error strings in briJune McEnroe 2017-03-18Add -u option to xxJune McEnroe 2017-03-15Fix non-string-literal-format-string in briJune McEnroe 2017-03-15Fix bri compilationJune McEnroe 2017-03-15Use psvar for title settingJune McEnroe 2017-03-14Add bri brightness control scriptJune McEnroe 2017-03-14Add comment to tmux terminal overrideJune McEnroe 2017-03-13Have tmux set block cursor on linux consoleJune McEnroe 2017-03-13Use inverse for Visual in colorschemeJune McEnroe