Commit 24d7d49a authored by Him188's avatar Him188

Fix endsWith

parent 02b4f10e
...@@ -305,12 +305,12 @@ class MessageSubscribersBuilder<T : MessagePacket<*, *>>( ...@@ -305,12 +305,12 @@ class MessageSubscribersBuilder<T : MessagePacket<*, *>>(
): Listener<T> { ): Listener<T> {
return if (trim) { return if (trim) {
val toCheck = suffix.trim() val toCheck = suffix.trim()
content({ it.trimStart().startsWith(toCheck) }, { content({ it.trimEnd().endsWith(toCheck) }, {
if (removeSuffix) this.onEvent(this.message.toString().substringBeforeLast(toCheck).trim()) if (removeSuffix) this.onEvent(this.message.toString().removeSuffix(toCheck).trim())
else onEvent(this, this.message.toString().trim()) else onEvent(this, this.message.toString().trim())
}) })
} else { } else {
content({ it.startsWith(suffix) }, { content({ it.endsWith(suffix) }, {
if (removeSuffix) this.onEvent(this.message.toString().removeSuffix(suffix)) if (removeSuffix) this.onEvent(this.message.toString().removeSuffix(suffix))
else onEvent(this, this.message.toString()) else onEvent(this, this.message.toString())
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment