Skip to content

Commit

Permalink
Add /denizen debug -c for toggling color in the debugger.
Browse files Browse the repository at this point in the history
  • Loading branch information
aufdemrand committed May 27, 2013
1 parent 9b8d066 commit f1d593d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/main/java/net/aufdemrand/denizen/CommandHandler.java
Expand Up @@ -681,11 +681,14 @@ public void health(CommandContext args, CommandSender sender, NPC npc) throws Co
@Command(
aliases = { "denizen" }, usage = "debug",
desc = "Toggles debug mode for Denizen.", modifiers = { "debug", "de", "db" },
min = 1, max = 3, permission = "denizen.debug", flags = "s")
min = 1, max = 3, permission = "denizen.debug", flags = "sc")
public void debug(CommandContext args, CommandSender sender, NPC npc) throws CommandException {
if (args.hasFlag('s')) {
if (!dB.debugMode) dB.toggle();
dB.showStackTraces = !dB.showStackTraces;
} else if (args.hasFlag('c')) {
if (!dB.debugMode) dB.toggle();
dB.showColor = !dB.showColor;
} else dB.toggle();

Messaging.send(sender, ChatColor.YELLOW + "Denizen debugger is " + (dB.debugMode ?
Expand Down
Expand Up @@ -57,6 +57,7 @@ public class dB {
public static boolean debugMode = Settings.ShowDebug();
public static boolean showStackTraces = true;
public static boolean showScriptBuilder = false;
public static boolean showColor = true;

/**
* Can be used with echoDebug(...) to output a header, footer,
Expand Down Expand Up @@ -132,7 +133,9 @@ public static void sendMessage(String string) {
} // 16:05:06 [INFO]
}
// Send buffer to the player
commandSender.sendMessage(buffer);
if (showColor)
commandSender.sendMessage(buffer);
else commandSender.sendMessage(ChatColor.stripColor(buffer));
}
}

Expand Down

0 comments on commit f1d593d

Please sign in to comment.