aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/ledger/utils/BorderedTextTracker.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/moe/nea/ledger/utils/BorderedTextTracker.kt')
-rw-r--r--src/main/kotlin/moe/nea/ledger/utils/BorderedTextTracker.kt41
1 files changed, 0 insertions, 41 deletions
diff --git a/src/main/kotlin/moe/nea/ledger/utils/BorderedTextTracker.kt b/src/main/kotlin/moe/nea/ledger/utils/BorderedTextTracker.kt
deleted file mode 100644
index 9e621e8..0000000
--- a/src/main/kotlin/moe/nea/ledger/utils/BorderedTextTracker.kt
+++ /dev/null
@@ -1,41 +0,0 @@
-package moe.nea.ledger.utils
-
-import moe.nea.ledger.events.ChatReceived
-import moe.nea.ledger.utils.di.Inject
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
-
-abstract class BorderedTextTracker {
-
- val genericBorderExit = "▬{10,}".toPattern()
-
- @Inject
- lateinit var errorUtil: ErrorUtil
- var stack: MutableList<ChatReceived>? = null
-
-
- @SubscribeEvent
- fun receiveText(event: ChatReceived) {
- if (stack != null && shouldExit(event)) {
- exit()
- return
- }
- if (shouldEnter(event)) {
- if (stack != null) {
- errorUtil.reportAdHoc("Double entered a bordered message")
- exit()
- }
- stack = mutableListOf()
- }
- stack?.add(event)
- }
-
- private fun exit() {
- onBorderedTextFinished(stack!!)
- stack = null
- }
-
- abstract fun shouldEnter(event: ChatReceived): Boolean
- abstract fun shouldExit(event: ChatReceived): Boolean
- abstract fun onBorderedTextFinished(enclosed: List<ChatReceived>)
-
-} \ No newline at end of file