fix botvis and command handler + console commands colors

This commit is contained in:
ChomeNS 2023-03-24 09:21:05 +07:00
parent 6e2eb9ec74
commit 1f36cd9959
3 changed files with 5 additions and 2 deletions

View file

@ -15,7 +15,7 @@ public class ConsoleCommandContext extends CommandContext {
@Override @Override
public void sendOutput (Component component) { public void sendOutput (Component component) {
final String message = ComponentUtilities.stringify(component); final String message = ComponentUtilities.stringifyAnsi(component);
bot.logger().log(message); bot.logger().log(message);
} }

View file

@ -41,7 +41,7 @@ public class BotVisibilityCommand implements Command {
public Component execute(CommandContext context, String[] args, String[] fullArgs) { public Component execute(CommandContext context, String[] args, String[] fullArgs) {
final Bot bot = context.bot(); final Bot bot = context.bot();
if (args[0] == null) { if (args.length == 0) {
final boolean visibility = bot.selfCare().visibility(); final boolean visibility = bot.selfCare().visibility();
bot.selfCare().visibility(!visibility); bot.selfCare().visibility(!visibility);
@ -58,6 +58,7 @@ public class BotVisibilityCommand implements Command {
switch (args[0]) { switch (args[0]) {
case "on", "true" -> { case "on", "true" -> {
bot.selfCare().visibility(true); bot.selfCare().visibility(true);
bot.chat().send("/essentials:vanish disable");
context.sendOutput( context.sendOutput(
Component.empty() Component.empty()
.append(Component.text("The bot's visibility is now ")) .append(Component.text("The bot's visibility is now "))
@ -66,6 +67,7 @@ public class BotVisibilityCommand implements Command {
} }
case "off", "false" -> { case "off", "false" -> {
bot.selfCare().visibility(false); bot.selfCare().visibility(false);
bot.chat().send("/essentials:vanish enable");
context.sendOutput( context.sendOutput(
Component.empty() Component.empty()
.append(Component.text("The bot's visibility is now ")) .append(Component.text("The bot's visibility is now "))

View file

@ -112,6 +112,7 @@ public class CommandHandlerPlugin {
count++; count++;
} }
} }
if (usage.contains("<hash>")) count--; // bad fix?
return count; return count;
} }