Find Player Logs

import org.universaldevelopment.universalChat.API.UniversalChatAPI.findChatLogsAsync

Get specific text in chat logs

  findChatLogsAsync(text)

  input: string
  returns: string 

Example

findChatLogsAsync("i swear i didn't grief") { foundFile ->
    if (foundFile != null) {
        val chatLogFile = File(this.dataFolder, "ChatLogs/$foundFile")
        val fileContent = chatLogFile.readText()

        val foundLine = fileContent.lines().find {
            it.contains("i swear i didn't grief", ignoreCase = true)
        }

        if (foundLine != null) {
            makeTranslationAsync("Original", playerLanguage) { translatedOriginal ->
                sender.sendMessage("$translatedOriginal: $foundLine")
            }
        } else {
            sender.sendMessage("Suspiciously unable to extract the message...")
        }
    } else {
        makeTranslationAsync("No record found. You're clean... for now.", playerLanguage) { translatedNotFound ->
            sender.sendMessage(translatedNotFound)
        }
    }
}

Last updated