This is my code.
PluginContainer pl = bla bla my plugin;
List contributors = pl.metadata().contributors();
// Log to check contributor
logger.info("contributors = " + contributors);
Then In console It show.
contributors = [StandardPluginContributor[name=unknown, description=null]]
Why PluginContributor is always show unknown contributor name ?
How can I get Contributor name ?
Please help me.
Mind showing your sponge_plugins.json?
Its likely that the info hasnt been filled in correctly
1 Like
sure
{
“loader”: {
“name”: “java_plain”,
“version”: “1.0”
},
“license”: “All Rights Reserved”,
“plugins”: [
{
“id”: “myplugin”,
“entrypoint”: “me.venusdev.myplugin.Main”,
“name”: “MyPlugin”,
“description”: “MyPlugin”,
“version”: “1.0”,
“branding”: {},
“links”: {},
“contributors”: [
{
“name”: “VenusDev”,
“description”: “Author”
}
],
“dependencies”: [
{
“id”: “spongeapi”,
“version”: “8.1.0”,
“load-order”: “after”,
“optional”: false
}
]
}
]
}
Ill have a play around. It looks fine from that
Finally got round to this.
After testing it myself with the following sponge_plugins.json (Yours kept saying json parse exception for some reason)
{
"loader": {
"name": "java_plain",
"version": "1.0"
},
"license": "All Rights Reserved",
"plugins": [
{
"id": "banuseitem",
"name": "MyPlugin",
"version": "1.0",
"entrypoint": "org.test.SpongeTest",
"description": "My plugin description",
"contributors": [
{
"name": "Mosemister",
"description": "Test"
}
],
"dependencies": [
{
"id": "spongeapi",
"version": "8.1.0",
"load-order": "after",
"optional": false
}
]
}
]
}
and the following code
private void show(String event) {
this.logger.info(event + ": " + container.metadata()
.contributors()
.stream()
.map(con -> "Name: " + con.name() + " Description: " + con.description().orElse("NA"))
.collect(Collectors.joining("\n")));
}
I find that it does indeed print the name and description. So it must be either that json parse exception issue? or maybe your sponge version had a break in it
This is the earliest print message btw
OnConstruct: Name: Mosemister Description: Test
I would recommend taking my sponge_plugins and modifiing it to you
1 Like
Thank for you care! I’ll test it!