Search in sources :

Example 1 with PluginDescription

use of com.velocitypowered.api.plugin.PluginDescription in project Chocolate by GiansCode.

the class ChocolateInfoCommand method perform.

@Override
public void perform(CommandSource commandSource, String[] args) {
    StringBuilder commandBuilder = new StringBuilder();
    for (ChocolateCommand chocolateCommand : this.chocolatePlugin.getCommandRegister().getChocolateCommands()) {
        commandBuilder.append(StringUtils.getInstance().replacePlaceholders(Lang.COMMAND$CHOCOLATE$COMMAND_FORMAT.getString(), "%usage%", chocolateCommand.usage, "%description%", chocolateCommand.description)).append("\n");
    }
    Optional<PluginContainer> optional = chocolatePlugin.getServer().getPluginManager().getPlugin("chocolate");
    if (!optional.isPresent())
        return;
    PluginDescription pluginDescription = optional.get().getDescription();
    sendMessage(commandSource, StringUtils.getInstance().replacePlaceholders(Lang.COMMAND$CHOCOLATE$MSG.getString(), "%authors%", String.join(", ", pluginDescription.getAuthors()), "%commands%", commandBuilder.toString()));
}
Also used : PluginContainer(com.velocitypowered.api.plugin.PluginContainer) ChocolateCommand(io.alerium.chocolate.command.constructor.ChocolateCommand) PluginDescription(com.velocitypowered.api.plugin.PluginDescription)

Example 2 with PluginDescription

use of com.velocitypowered.api.plugin.PluginDescription in project LibertyBans by A248.

the class VelocityCulpritFinderTest method setDescription.

private static void setDescription(PluginContainer pluginMock, String id, String version) {
    PluginDescription description = mock(PluginDescription.class);
    when(description.getId()).thenReturn(id);
    when(description.getVersion()).thenAnswer((i) -> Optional.of(version));
    when(pluginMock.getDescription()).thenReturn(description);
}
Also used : PluginDescription(com.velocitypowered.api.plugin.PluginDescription)

Aggregations

PluginDescription (com.velocitypowered.api.plugin.PluginDescription)2 PluginContainer (com.velocitypowered.api.plugin.PluginContainer)1 ChocolateCommand (io.alerium.chocolate.command.constructor.ChocolateCommand)1