aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/events/ModifyChatEvent.kt
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-09-04 20:22:51 +0200
committernea <nea@nea.moe>2023-09-04 20:22:51 +0200
commitd202ef5439a180efecc27ab4695b1a12febb041f (patch)
tree959ac68db802d562dee2d92aecbb3741dbcce3b6 /src/main/kotlin/moe/nea/firmament/events/ModifyChatEvent.kt
parentee5591684dc6bcdea6c44a62806d537bbb7e0cee (diff)
downloadfirmament-d202ef5439a180efecc27ab4695b1a12febb041f.tar.gz
firmament-d202ef5439a180efecc27ab4695b1a12febb041f.tar.bz2
firmament-d202ef5439a180efecc27ab4695b1a12febb041f.zip
Make chat events use fabric events
[no changelog]
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/events/ModifyChatEvent.kt')
-rw-r--r--src/main/kotlin/moe/nea/firmament/events/ModifyChatEvent.kt25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/events/ModifyChatEvent.kt b/src/main/kotlin/moe/nea/firmament/events/ModifyChatEvent.kt
new file mode 100644
index 0000000..b5a53bc
--- /dev/null
+++ b/src/main/kotlin/moe/nea/firmament/events/ModifyChatEvent.kt
@@ -0,0 +1,25 @@
+/*
+ * SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+package moe.nea.firmament.events
+
+import moe.nea.firmament.util.unformattedString
+import net.minecraft.text.Text
+
+/**
+ * Allow modification of a chat message before it is sent off to the user. Intended for display purposes.
+ */
+data class ModifyChatEvent(val originalText: Text) : FirmamentEvent() {
+ var unformattedString = originalText.unformattedString
+ private set
+ var replaceWith: Text = originalText
+ set(value) {
+ field = value
+ unformattedString = value.unformattedString
+ }
+
+ companion object : FirmamentEventBus<ModifyChatEvent>()
+}