Skip to content

Commit a5f3817

Browse files
committed
Parser errors fixed.
Signed-off-by: Pavel Erokhin (MairwunNx) <MairwunNx@gmail.com>
1 parent f66cbc6 commit a5f3817

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/main/kotlin/com/mairwunnx/projectessentials/chat/impl/parsers/DefaultMessageParser.kt

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,24 @@ internal class DefaultMessageParser : IMessageParser {
3636
}
3737
} else if (value in ChatVariableAPI.all().map { "%${it.variable}%" }) {
3838
component.appendSibling(TextComponentUtils.toTextComponent { builder.toString() })
39-
if (value == "%message%") {
40-
component.appendSibling(getMessage(sender, message))
41-
} else {
42-
component.appendSibling(
43-
ChatVariableAPI.all().find {
44-
it.variable == value.drop(1).dropLast(1)
45-
}?.process(sender) ?: TextComponentUtils.toTextComponent { "" }
46-
).also { builder.clear() }
47-
}
39+
component.appendSibling(
40+
ChatVariableAPI.all().find {
41+
it.variable == value.drop(1).dropLast(1)
42+
}?.process(sender) ?: TextComponentUtils.toTextComponent { "" }
43+
).also { builder.clear() }
44+
} else if (value == "%message%") {
45+
component.appendSibling(getMessage(sender, message))
4846
} else builder.append(String.empty)
4947
}.run {
5048
component.appendSibling(
5149
TextComponentUtils.toTextComponent { builder.toString() }
5250
).also { builder.clear() }
51+
println(component.unformattedComponentText)
5352
}
54-
}.let { component }
53+
}.let {
54+
println("Result: ${component.unformattedComponentText}")
55+
component
56+
}
5557
}
5658
}
5759

0 commit comments

Comments
 (0)