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
3eed99ce
Commit
3eed99ce
authored
Jan 18, 2020
by
jiahua.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plugin supporting
parent
9975b879
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
16 deletions
+15
-16
mirai-console/src/main/kotlin/net/mamoe/mirai/plugin/PluginBase.kt
...sole/src/main/kotlin/net/mamoe/mirai/plugin/PluginBase.kt
+15
-16
No files found.
mirai-console/src/main/kotlin/net/mamoe/mirai/plugin/PluginBase.kt
View file @
3eed99ce
...
@@ -27,21 +27,19 @@ abstract class PluginBase{
...
@@ -27,21 +27,19 @@ abstract class PluginBase{
}
}
class
PluginDescription
(
class
PluginDescription
(
val
pluginName
:
String
,
val
pluginName
:
String
,
val
pluginAuthor
:
String
,
val
pluginAuthor
:
String
,
val
pluginBasePath
:
String
,
val
pluginBasePath
:
String
,
val
pluginVersion
:
String
,
val
pluginVersion
:
String
,
val
pluginInfo
:
String
,
val
pluginInfo
:
String
,
val
depends
:
List
<
String
>,
//插件的依赖
val
depends
:
List
<
String
>,
//插件的依赖
//internal
//internal
var
loaded
:
Boolean
=
false
,
var
loaded
:
Boolean
=
false
,
var
noCircularDepend
:
Boolean
=
true
var
noCircularDepend
:
Boolean
=
true
)
)
{
{
companion
object
{
fun
readFromContent
(
content_
:
String
):
PluginDescription
{
companion
object
{
fun
readFromContent
(
content_
:
String
):
PluginDescription
{
val
content
=
content_
.
split
(
"\n"
)
val
content
=
content_
.
split
(
"\n"
)
var
name
=
"Plugin"
var
name
=
"Plugin"
...
@@ -125,21 +123,22 @@ object PluginManager{
...
@@ -125,21 +123,22 @@ object PluginManager{
}
}
}
}
fun
checkNoCircularDepends
(
target
:
PluginDescription
,
needDepends
:
List
<
String
>,
existDepends
:
MutableList
<
String
>){
fun
checkNoCircularDepends
(
target
:
PluginDescription
,
needDepends
:
List
<
String
>,
existDepends
:
MutableList
<
String
>)
{
if
(!
target
.
noCircularDepend
)
{
if
(!
target
.
noCircularDepend
)
{
return
return
}
}
if
(
needDepends
.
any
{
existDepends
.
contains
(
it
)
}){
existDepends
.
add
(
target
.
pluginName
)
if
(
needDepends
.
any
{
existDepends
.
contains
(
it
)
})
{
target
.
noCircularDepend
=
false
target
.
noCircularDepend
=
false
}
}
existDepends
.
addAll
(
needDepends
)
existDepends
.
addAll
(
needDepends
)
existDepends
.
add
(
target
.
pluginName
)
needDepends
.
forEach
{
needDepends
.
forEach
{
if
(
pluginsFound
.
containsKey
(
it
))
{
if
(
pluginsFound
.
containsKey
(
it
))
{
checkNoCircularDepends
(
pluginsFound
[
it
]
!!
,
pluginsFound
[
it
]
!!
.
depends
,
existDepends
)
checkNoCircularDepends
(
pluginsFound
[
it
]
!!
,
pluginsFound
[
it
]
!!
.
depends
,
existDepends
)
}
}
}
}
...
...
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