diff --git a/src/main/java/net/aoba/cmd/CommandManager.java b/src/main/java/net/aoba/cmd/CommandManager.java index f81a28a..7bf3f6d 100644 --- a/src/main/java/net/aoba/cmd/CommandManager.java +++ b/src/main/java/net/aoba/cmd/CommandManager.java @@ -22,12 +22,14 @@ package net.aoba.cmd; import java.lang.reflect.Field; +import java.text.Format; import java.util.HashMap; import net.aoba.Aoba; import net.aoba.cmd.commands.*; import net.minecraft.client.MinecraftClient; import net.minecraft.text.Text; +import net.minecraft.util.Formatting; public class CommandManager { private HashMap commands = new HashMap(); @@ -118,7 +120,7 @@ public void command(String[] commandIn) { // If the command does not exist, throw an error. if (command == null) - sendChatMessage("Invalid Command! Type .aoba help for a list of commands."); + sendChatMessage("Invalid Command! Type " + Formatting.LIGHT_PURPLE + ".aoba help" + Formatting.RESET + " for a list of commands."); else { // Otherwise, create a new parameter list. String[] parameterList = new String[commandIn.length - 2]; @@ -132,7 +134,7 @@ public void command(String[] commandIn) { command.runCommand(parameterList); } } catch(ArrayIndexOutOfBoundsException e) { - sendChatMessage("Invalid Command! Type .aoba help for a list of commands."); + sendChatMessage("Invalid Command! Type " + Formatting.LIGHT_PURPLE + ".aoba help" + Formatting.RESET + " for a list of commands."); } catch (InvalidSyntaxException e) { e.PrintToChat(); } @@ -144,6 +146,6 @@ public void command(String[] commandIn) { */ public static void sendChatMessage(String message) { MinecraftClient mc = MinecraftClient.getInstance(); - mc.inGameHud.getChatHud().addMessage(Text.of("§5[Aoba]§f " + message)); + mc.inGameHud.getChatHud().addMessage(Text.of(Formatting.DARK_PURPLE + "[" + Formatting.LIGHT_PURPLE + "Aoba" + Formatting.DARK_PURPLE + "] " + Formatting.RESET + message)); } } diff --git a/src/main/java/net/aoba/cmd/InvalidSyntaxException.java b/src/main/java/net/aoba/cmd/InvalidSyntaxException.java index 2f1e3fd..9b8849c 100644 --- a/src/main/java/net/aoba/cmd/InvalidSyntaxException.java +++ b/src/main/java/net/aoba/cmd/InvalidSyntaxException.java @@ -21,6 +21,8 @@ */ package net.aoba.cmd; +import net.minecraft.util.Formatting; + public class InvalidSyntaxException extends CommandException { private static final long serialVersionUID = 1L; @@ -30,6 +32,6 @@ public InvalidSyntaxException(Command cmd) { @Override public void PrintToChat() { - CommandManager.sendChatMessage("Invalid Usage! Usage: .aoba " + cmd.getName() + " " + cmd.getSyntax()); + CommandManager.sendChatMessage("Invalid Usage! Usage: " + Formatting.LIGHT_PURPLE + ".aoba " + cmd.getName() + " " + cmd.getSyntax() + Formatting.RESET); } } diff --git a/src/main/java/net/aoba/cmd/commands/CmdHelp.java b/src/main/java/net/aoba/cmd/commands/CmdHelp.java index 9531116..1588d2e 100644 --- a/src/main/java/net/aoba/cmd/commands/CmdHelp.java +++ b/src/main/java/net/aoba/cmd/commands/CmdHelp.java @@ -21,6 +21,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Set; + +import net.minecraft.util.Formatting; import org.apache.commons.lang3.StringUtils; import net.aoba.module.Module; import net.aoba.Aoba; @@ -47,18 +49,22 @@ public void runCommand(String[] parameters) { if (module == null) { CommandManager.sendChatMessage("Could not find Module '" + parameters[0] + "'."); } else { - CommandManager.sendChatMessage("------------ " + module.getName() + "Help ------------"); - CommandManager.sendChatMessage("Name: " + module.getName()); - CommandManager.sendChatMessage("Description: " + module.getDescription()); - CommandManager.sendChatMessage("Keybind: " + module.getBind().getTranslationKey()); + String title = "------------ " + Formatting.LIGHT_PURPLE + module.getName() + " Help" + Formatting.RESET + " ------------"; + String unformatted_title = "------------ " + module.getName() + " Help ------------"; + CommandManager.sendChatMessage(title); + CommandManager.sendChatMessage("Name: " + Formatting.LIGHT_PURPLE + module.getName() + Formatting.RESET); + CommandManager.sendChatMessage("Description: " + Formatting.LIGHT_PURPLE + module.getDescription() + Formatting.RESET); + CommandManager.sendChatMessage("Keybind: " + Formatting.LIGHT_PURPLE + module.getBind().getTranslationKey() + Formatting.RESET); + CommandManager.sendChatMessage("-".repeat(unformatted_title.length() - 2)); // mc font characters are not the same width but eh.. } } } private void ShowCommands(int page) { - CommandManager.sendChatMessage("------------ Help [Page " + page + " of 5] ------------"); - CommandManager.sendChatMessage("Use .aoba help [n] to get page n of help."); + String title = "------------ Help [Page " + page + " of 5] ------------"; // TODO: remove hardcoded page length + CommandManager.sendChatMessage(title); + CommandManager.sendChatMessage("Use " + Formatting.LIGHT_PURPLE + ".aoba help [n]" + Formatting.RESET + " to get page n of help."); // Fetch the commands and dislays their syntax on the screen. HashMap commands = Aoba.getInstance().commandManager.getCommands(); @@ -70,6 +76,7 @@ private void ShowCommands(int page) { CommandManager.sendChatMessage(" .aoba " + listOfCommands.get(i)); } } + CommandManager.sendChatMessage("-".repeat(title.length() - 2)); // mc font characters are not the same width but eh.. } @Override