aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/dulkirfabric/features/chat
diff options
context:
space:
mode:
authorRonald Inglett <71849533+inglettronald@users.noreply.github.com>2023-06-29 17:32:17 -0500
committerGitHub <noreply@github.com>2023-06-29 17:32:17 -0500
commit903bf5ffb8675e9b907b91d1adadb04d68ef40c3 (patch)
treecd3eb0615037b8650f469f194a28fcac88cf6adb /src/main/kotlin/com/dulkirfabric/features/chat
parent1fc9c0f7fe8a998e4cf04c8b498abc643533d6e7 (diff)
parent5f0fd39650659010a23055c11eae66fb3ffb2ad0 (diff)
downloadDulkirMod-Fabric-903bf5ffb8675e9b907b91d1adadb04d68ef40c3.tar.gz
DulkirMod-Fabric-903bf5ffb8675e9b907b91d1adadb04d68ef40c3.tar.bz2
DulkirMod-Fabric-903bf5ffb8675e9b907b91d1adadb04d68ef40c3.zip
Merge pull request #2 from IlmarsXd/master
Fix NPE with PlaySoundEvent
Diffstat (limited to 'src/main/kotlin/com/dulkirfabric/features/chat')
-rw-r--r--src/main/kotlin/com/dulkirfabric/features/chat/AbiPhoneDND.kt12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/main/kotlin/com/dulkirfabric/features/chat/AbiPhoneDND.kt b/src/main/kotlin/com/dulkirfabric/features/chat/AbiPhoneDND.kt
index 2172c4b..52224ff 100644
--- a/src/main/kotlin/com/dulkirfabric/features/chat/AbiPhoneDND.kt
+++ b/src/main/kotlin/com/dulkirfabric/features/chat/AbiPhoneDND.kt
@@ -18,7 +18,7 @@ object AbiPhoneDND {
if (!DulkirConfig.configOptions.abiPhoneDND) return
if (System.currentTimeMillis() - lastRing < 5000) {
if (event.sound.id.path == "block.note_block.pling" && event.sound.volume == 0.69f && event.sound.pitch == 1.6666666f) {
- event.isCancelled = true
+ event.cancel()
}
}
}
@@ -26,11 +26,10 @@ object AbiPhoneDND {
@EventHandler
fun handle(event: ChatReceivedEvent) {
if (!DulkirConfig.configOptions.abiPhoneDND) return
- val unformatted: String = event.message.unformattedString
- println(unformatted)
+ val unformatted = event.message.unformattedString
if (unformatted matches abiPhoneFormat && !unformatted.contains("Elle") && !unformatted.contains("Dean")) {
val matchResult = abiPhoneFormat.find(unformatted)
- event.isCancelled = true
+ event.cancel()
lastRing = System.currentTimeMillis()
if (DulkirConfig.configOptions.abiPhoneCallerID) {
val blocked = if (Math.random() < .001) "Breefing"
@@ -39,8 +38,9 @@ object AbiPhoneDND {
}
}
if (unformatted.startsWith("✆ Ring...") && unformatted.endsWith("[PICK UP]")
- && System.currentTimeMillis() - lastRing < 5000) {
- event.isCancelled = true
+ && System.currentTimeMillis() - lastRing < 5000
+ ) {
+ event.cancel()
}
}
} \ No newline at end of file