blob: 95c77ab21ab2078b23565ed4aec8a7bf4f18daa0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
/*
* SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
package moe.nea.firmament.features.debug
import moe.nea.firmament.events.ModifyChatEvent
import moe.nea.firmament.features.FirmamentFeature
import net.minecraft.text.Text
// In memorian Dulkir
object MinorTrolling : FirmamentFeature {
override val identifier: String
get() = "minor-trolling"
val trollers = listOf("nea89o", "lrg89")
val t = "From(?: \\[[^\\]]+])? ([^:]+): (.*)".toRegex()
override fun onLoad() {
ModifyChatEvent.subscribe {
val m = t.matchEntire(it.unformattedString) ?: return@subscribe
val (_, name, text) = m.groupValues
if (name !in trollers) return@subscribe
if (!text.startsWith("c:")) return@subscribe
it.replaceWith = Text.literal(text.substring(2).replace("&", "§"))
}
}
}
|