FEAT: Meet the commands

This commit is contained in:
Kolyah35
2026-03-30 14:04:16 +03:00
parent 3cfa2d9ee7
commit 5194575092
12 changed files with 230 additions and 119 deletions

View File

@@ -0,0 +1,27 @@
#include "CommandHelp.hpp"
#include "commands/Command.hpp"
#include "CommandManager.hpp"
#include <client/Minecraft.h>
CommandHelp::CommandHelp() : Command("help") {}
void CommandHelp::execute(Minecraft& mc, const std::vector<std::string>& args) {
if (args.empty()) {
auto cmds = mc.commandManager().getListAllCommands();
mc.addMessage("Usage: /help <command>");
mc.addMessage("List of all commands:");
for (auto& cmd : cmds) {
mc.addMessage(" - " + cmd);
}
} else {
Command* cmd = mc.commandManager().getCommand(args[0]);
if (cmd != nullptr) {
cmd->printHelp(mc);
}
}
}
void CommandHelp::printHelp(Minecraft& mc) {}