Added commands header

This commit is contained in:
Nan1t 2022-07-01 17:52:04 -05:00
parent c8a3284c04
commit e0e5a4ae56
2 changed files with 5 additions and 9 deletions

View File

@ -2,6 +2,7 @@ package ru.nanit.limbo.server.commands;
import ru.nanit.limbo.server.Command; import ru.nanit.limbo.server.Command;
import ru.nanit.limbo.server.LimboServer; import ru.nanit.limbo.server.LimboServer;
import ru.nanit.limbo.server.Logger;
import java.util.Map; import java.util.Map;
@ -15,19 +16,13 @@ public class CmdHelp implements Command {
@Override @Override
public void execute() { public void execute() {
StringBuilder msg = new StringBuilder();
Map<String, Command> commands = server.getCommandManager().getCommands(); Map<String, Command> commands = server.getCommandManager().getCommands();
Logger.info("Available commands:");
for (Map.Entry<String, Command> entry : commands.entrySet()) { for (Map.Entry<String, Command> entry : commands.entrySet()) {
msg.append("\n"); Logger.info("%s - %s", entry.getKey(), entry.getValue().description());
msg.append(entry.getKey());
msg.append(" - ");
msg.append(entry.getValue().description());
} }
msg.append("\n");
System.out.println(msg);
} }
@Override @Override

View File

@ -14,6 +14,7 @@ public class CmdMem implements Command {
long free = runtime.freeMemory() / mb; long free = runtime.freeMemory() / mb;
long max = runtime.maxMemory() / mb; long max = runtime.maxMemory() / mb;
Logger.info("Memory usage:");
Logger.info("Used: %d MB", used); Logger.info("Used: %d MB", used);
Logger.info("Total: %d MB", total); Logger.info("Total: %d MB", total);
Logger.info("Free: %d MB", free); Logger.info("Free: %d MB", free);