diff options
Diffstat (limited to 'src/main/kotlin/com/dulkirfabric/features')
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/features/RenderBoxTest.kt | 9 | ||||
-rw-r--r-- | src/main/kotlin/com/dulkirfabric/features/chat/AbiPhoneDND.kt | 45 |
2 files changed, 47 insertions, 7 deletions
diff --git a/src/main/kotlin/com/dulkirfabric/features/RenderBoxTest.kt b/src/main/kotlin/com/dulkirfabric/features/RenderBoxTest.kt index 6863479..ab52f81 100644 --- a/src/main/kotlin/com/dulkirfabric/features/RenderBoxTest.kt +++ b/src/main/kotlin/com/dulkirfabric/features/RenderBoxTest.kt @@ -10,15 +10,10 @@ object RenderBoxTest { @EventHandler fun onRender(event: WorldRenderLastEvent) { - WorldRenderUtils.drawBox( - event.context, Box(0.0, 0.0, 0.0, 1.0, 1.0, 1.0), - Color(255, 255, 255, 255), 10f, true - ) WorldRenderUtils.drawBox( - event.context, Box(2.0, 0.0, 0.0, 3.0, 1.0, 1.0), - Color(1, 255, 1, 255), 10f, false + event.context, Box(-183.0, 78.0, -465.0, -182.0, 79.0, -464.0), + Color(255, 100, 150, 255), 10f, false ) - } }
\ No newline at end of file diff --git a/src/main/kotlin/com/dulkirfabric/features/chat/AbiPhoneDND.kt b/src/main/kotlin/com/dulkirfabric/features/chat/AbiPhoneDND.kt new file mode 100644 index 0000000..f3f83e2 --- /dev/null +++ b/src/main/kotlin/com/dulkirfabric/features/chat/AbiPhoneDND.kt @@ -0,0 +1,45 @@ +package com.dulkirfabric.features.chat + +import com.dulkirfabric.config.DulkirConfig +import com.dulkirfabric.events.ChatReceivedEvent +import com.dulkirfabric.events.PlaySoundEvent +import com.dulkirfabric.util.TextUtils +import meteordevelopment.orbit.EventHandler + +object AbiPhoneDND { + + private val abiPhoneFormat = "โ (\\w+) โ ".toRegex() + var lastRing = 0L + + //BLOCK ABIPHONE SOUNDS + @EventHandler + fun onSound(event: PlaySoundEvent) { + if (!DulkirConfig.configOptions.abiPhoneDND) return + if (System.currentTimeMillis() - lastRing < 5000) { + if (event.sound.sound.identifier.path == "note.pling" && event.sound.volume == 0.69f && event.sound.pitch == 1.6666666f) { + event.isCancelled = true + } + } + } + + @EventHandler + fun handle(event: ChatReceivedEvent) { + if (!DulkirConfig.configOptions.abiPhoneDND) return + val unformatted: String = TextUtils.stripColorCodes(event.message) + if (unformatted matches abiPhoneFormat && !unformatted.contains("Elle") && !unformatted.contains("Dean")) { + val matchResult = abiPhoneFormat.find(unformatted) + event.isCancelled = true + lastRing = System.currentTimeMillis() + if (DulkirConfig.configOptions.abiPhoneCallerID) { + val blocked = if (Math.random() < .001) "Breefing" + else matchResult?.groups?.get(1)?.value + TextUtils.info("ยง6Call blocked from $blocked!") + } + } + if (unformatted.startsWith("โ Ring...") && unformatted.endsWith("[PICK UP]") + && System.currentTimeMillis() - lastRing < 5000 + ) { + event.isCancelled + } + } +}
\ No newline at end of file |