Implement multiverse generator plugin hook#506
Implement multiverse generator plugin hook#506duplexsystem merged 6 commits intoPolyhedralDev:masterfrom
Conversation
solonovamax
left a comment
There was a problem hiding this comment.
Do we not need to add
softdepend:
- "Multiverse-Core"
loadbefore:
- "Multiverse-Core"to the plugin.yml?
without softdepend afaik the classloaders would be isolated & we wouldn't be able to load any multiverse classes, and without loadbefore afaik we would never receive the PluginEnableEvent (though I could be wrong on that last one)
|
Also, is there any way to customize the way that help menu shows? It would be nice to be able to do that (for example, making the url into an actual link, etc.), though I do also understand wanting to restrict the level of customization that is offered. |
|
Also, interesting idea on the adventure text components. I have been playing around with them tbh. The main issue is multiverse still need to support spigot and other older version, so we can't use the paper built in ones. Maybe we can shade it, but currently not the top priority list. |
thinking about it a bit more: adventure text components are probably overkill.
because 5.0 has already been release and you most likely don't want to break api, these can be added in one of two ways:
I would recommend changing the message format from issuer.sendMessage(ChatColor.RESET + "Generator Plugin: " + generatorPlugin.getPluginName());
issuer.sendMessage(ChatColor.RESET + "Example usages: ");
issuer.sendMessage(ChatColor.RESET + StringFormatter.join(generatorPlugin.getExampleUsages(), "\n"));
issuer.sendMessage(ChatColor.RESET + "Link to more info: " + generatorPlugin.getInfoLink());to TextComponent message = Component.text(builder -> {
builder.append(Component.text("Generator: "))
.append(Component.text(generatorPlugin.getPluginName(), NamedTextColor.DARK_GREEN))
.appendNewline()
.appendNewline();
builder.append(Component.text("Examples: "))
.appendNewline();
Style usageStyle = Style.style()
.color(NamedTextColor.YELLOW)
.hoverEvent(HoverEvent.showText(Component.text("Click to insert")))
.build();
for (String usage : generatorPlugin.getExampleUsages()) {
builder.append(Component.text("- ", NamedTextColor.GRAY))
.append(Component.text(usage, usageStyle).clickEvent(ClickEvent.suggestCommand(usage)))
.appendNewline();
}
builder.appendNewline();
String link = generatorPlugin.getInfoLink();
Style style = Style.style()
.color(NamedTextColor.BLUE)
.decorate(TextDecoration.UNDERLINED)
.clickEvent(ClickEvent.openUrl(link))
.build();
builder.append(Component.text("More info: "))
.append(Component.text(link, style));
});
issuer.sendMessage(message);if you want to play around with the message format in a more visual way, you can use the minimessage web viewer with the following input message: Generator: <dark_green>Terra</dark_green>
Examples:
<gray>- </gray><yellow><click:suggest_command:'/mv create ex NORMAL -g Terra:overworld'><hover:show_text:'Click to insert'>/mv create ex NORMAL -g Terra:overworld</hover></click></yellow>
<gray>- </gray><yellow><click:suggest_command:'/mv create ex NORMAL -g Terra:tartarus'><hover:show_text:'Click to insert'>/mv create ex NORMAL -g Terra:tartarus</hover></click></yellow>
More info: <blue><u><click:open_url:'https://terra.polydev.org'>https://terra.polydev.org</click></u></blue> |
hmmm, I see I noticed you're also using aikar's command framework, which I'm unsure if it supports sending adventure components looking at the api quickly, I think you'd have to do something like however, this would only apply to paper. (if you have any stats & see that only a very tiny % of people are using spigot & whatnot, you could always consider hard depending on paper, as there are several benefits to paper) however if you want to use bukkit, you'd shade the core adventure library + public class MVCommandIssuer extends BukkitCommandIssuer {
private final MVCommandManager commandManager;
private final Audience audience;
MVCommandIssuer(@NotNull MVCommandManager commandManager, @NotNull CommandSender sender) {
super(commandManager, sender);
this.commandManager = commandManager;
this.audience = sender instanceof Audience ? (Audience) sender : commandManager.getBukkitAudiences().sender(sender);
}
@Override
public Audience audience() {
return audience;
}
// ...
}see here for how to get a |
|
Thanks for the ideas, if multiverse didn't need spigot support, using adventure will all be way easier lol. I will think about it, Im very close to just dropping spigot support tbh. that being said - I think this pr is good enough as it is, as the main issue is to solve Terra not appearing at all in our generator list and tab-complete. |

Pull Request
Description
Fixes #46. Hooks into multiverse to provide basic information and tab complete with the correct packs install when using Terra with Multiverse-Core. Terra will always be initialized before multiverse, so I used
PluginEnableEventto hook into Multiverse-Core. I wasn't too sure where to put the event listener, I saw an existing CommonListener class already there, so I just added to that, hope that's fine!Changelog
Checklist
Mandatory checks
ver/prefix)or is a branch that is intended to be merged into a version branch.
CONTRIBUTING.mddocument in the root of the git repository.
Types of changes
Compatibility
Documentation
Testing
Licensing
release it under GPLv3.
released under GPLv3 or a compatible license.