Skip to content

Commit

Permalink
Add print internal plugins command
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexProgrammerDE committed Oct 15, 2024
1 parent 6db7c7d commit 4ee1605
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import com.soulfiremc.brigadier.CommandHelpWrapper;
import com.soulfiremc.brigadier.PlatformCommandManager;
import com.soulfiremc.brigadier.RedirectHelpWrapper;
import com.soulfiremc.server.api.InternalPlugin;
import com.soulfiremc.server.api.SoulFireAPI;
import com.soulfiremc.server.api.event.EventUtil;
import com.soulfiremc.server.api.event.bot.BotPreTickEvent;
import com.soulfiremc.server.api.event.lifecycle.CommandManagerInitEvent;
Expand Down Expand Up @@ -684,6 +686,24 @@ public void postConstruct() {
}
c.getSource().sendInfo(builder.toString());

return Command.SINGLE_SUCCESS;
})));
dispatcher.register(
literal("print-plugins")
.executes(
privateCommand(
c -> {
var builder = new StringBuilder("\n");
for (var plugin : SoulFireAPI.getServerExtensions()) {
if (!(plugin instanceof InternalPlugin)) {
continue;
}

var pluginInfo = plugin.pluginInfo();
builder.append("| `%s` | `%s` | `%s` | `%s` | `%s` |\n".formatted(pluginInfo.id(), pluginInfo.version(), pluginInfo.author(), pluginInfo.license(), pluginInfo.description()));
}
c.getSource().sendInfo(builder.toString());

return Command.SINGLE_SUCCESS;
})));

Expand Down

0 comments on commit 4ee1605

Please sign in to comment.