Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
f459891c
Commit
f459891c
authored
Sep 24, 2019
by
Him188moe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Kotlin coroutine
parent
2d366d49
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
mirai-core/src/main/java/net/mamoe/mirai/message/Message.kt
mirai-core/src/main/java/net/mamoe/mirai/message/Message.kt
+6
-0
mirai-core/src/main/java/net/mamoe/mirai/message/defaults/MessageChain.kt
...ain/java/net/mamoe/mirai/message/defaults/MessageChain.kt
+7
-0
No files found.
mirai-core/src/main/java/net/mamoe/mirai/message/Message.kt
View file @
f459891c
...
...
@@ -104,6 +104,12 @@ abstract class Message {
* @return message connected
*/
open
fun
concat
(
tail
:
Message
):
MessageChain
{
if
(
tail
is
MessageChain
)
{
return
MessageChain
(
this
).
let
{
tail
.
list
.
forEach
{
child
->
it
.
concat
(
child
)
}
it
}
}
return
MessageChain
(
this
,
Objects
.
requireNonNull
(
tail
))
}
...
...
mirai-core/src/main/java/net/mamoe/mirai/message/defaults/MessageChain.kt
View file @
f459891c
...
...
@@ -11,6 +11,9 @@ import java.util.stream.Stream
class
MessageChain
:
Message
{
override
val
type
:
Int
=
MessageId
.
CHAIN
/**
* Elements will not be instances of [MessageChain]
*/
val
list
:
MutableList
<
Message
>
=
Collections
.
synchronizedList
(
LinkedList
<
Message
>())
constructor
(
head
:
Message
,
tail
:
Message
)
{
...
...
@@ -58,6 +61,10 @@ class MessageChain : Message {
}
override
fun
concat
(
tail
:
Message
):
MessageChain
{
if
(
tail
is
MessageChain
)
{
tail
.
list
.
forEach
{
child
->
this
.
concat
(
child
)
}
return
this
}
this
.
list
.
add
(
tail
)
clearToStringCache
()
return
this
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment