From 5f0fd39650659010a23055c11eae66fb3ffb2ad0 Mon Sep 17 00:00:00 2001 From: IlmarsXd Date: Thu, 29 Jun 2023 18:05:08 +0300 Subject: Fix NPE with PlaySoundEvent --- .../kotlin/com/dulkirfabric/features/chat/AbiPhoneDND.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/main/kotlin/com/dulkirfabric/features') 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 -- cgit