forked from Kolyah35/minecraft-pe-0.6.1
FEAT: Meet the commands
This commit is contained in:
27
src/commands/CommandHelp.cpp
Normal file
27
src/commands/CommandHelp.cpp
Normal 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) {}
|
||||
Reference in New Issue
Block a user