summaryrefslogtreecommitdiff
path: root/src/main/kotlin/ChatStore.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/ChatStore.kt')
-rw-r--r--src/main/kotlin/ChatStore.kt16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/kotlin/ChatStore.kt b/src/main/kotlin/ChatStore.kt
index 2d9ff30..4cc6ee1 100644
--- a/src/main/kotlin/ChatStore.kt
+++ b/src/main/kotlin/ChatStore.kt
@@ -1,9 +1,15 @@
package moe.nea.ultranotifier
+import com.mojang.brigadier.builder.LiteralArgumentBuilder
+import moe.nea.ultranotifier.commands.UltraCommandSource
+import moe.nea.ultranotifier.commands.literalText
import moe.nea.ultranotifier.event.ChatGuiLineEvent
+import moe.nea.ultranotifier.event.CommandRegistrationEvent
import moe.nea.ultranotifier.event.PacketChatLineEvent
import moe.nea.ultranotifier.event.SubscriptionTarget
import moe.nea.ultranotifier.event.UltraSubscribe
+import moe.nea.ultranotifier.gui.MessageUi
+import moe.nea.ultranotifier.gui.ScreenUtil
import moe.nea.ultranotifier.util.IdentityCharacteristics
import net.minecraft.text.Text
@@ -31,6 +37,16 @@ object ChatStore : SubscriptionTarget {
}
@UltraSubscribe
+ fun registerCommands(event: CommandRegistrationEvent) {
+ event.dispatcher.register(LiteralArgumentBuilder.literal<UltraCommandSource?>("ultranotifier")
+ .executes {
+ it.source.sendFeedback(literalText("Opening screen"))
+ ScreenUtil.openScreen = (MessageUi())
+ 0
+ })
+ }
+
+ @UltraSubscribe
fun onMessageReceived(event: PacketChatLineEvent) {
insertChatLine(event.component).fromPacket = true
}