Skip to content

Commit

Permalink
add debug.prefix config option, fixes #2067
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Nov 10, 2019
1 parent 1bdd321 commit 979588b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public static void refillCache() {
cache_canRecordStats = config.getBoolean("Debug.Stats", true);
cache_defaultDebugMode = config.getBoolean("Debug.Container default", true);
cache_debugLimitPerTick = config.getInt("Debug.Limit per tick", 5000);
cache_debugPrefix = config.getString("Debug.Prefix", "");
cache_scriptQueueSpeed = config.getString("Scripts.Queue speed", "instant");
cache_interactQueueSpeed = config.getString("Scripts.Interact.Queue speed", "0.5s");
cache_healthTraitEnabledByDefault = config.getBoolean("Traits.Health.Enabled", false);
Expand Down Expand Up @@ -94,7 +95,8 @@ public static void refillCache() {
private static String cache_getAlternateScriptPath, cache_scriptQueueSpeed, cache_healthTraitRespawnDelay,
cache_engageTimeoutInSeconds, cache_chatMultipleTargetsFormat, cache_chatNoTargetFormat,
cache_chatToTargetFormat, cache_chatWithTargetToBystandersFormat, cache_chatWithTargetsToBystandersFormat,
cache_chatToNpcFormat, cache_chatToNpcOverheardFormat, cache_interactQueueSpeed, cache_limitPath, cache_scriptEncoding;
cache_chatToNpcFormat, cache_chatToNpcOverheardFormat, cache_interactQueueSpeed, cache_limitPath,
cache_scriptEncoding, cache_debugPrefix;

private static int cache_consoleWidth = 128, cache_trimLength = 1024, cache_whileMaxLoops, cache_blockTagsMaxBlocks,
cache_chatHistoryMaxMessages, cache_tagTimeout, cache_debugLimitPerTick;
Expand All @@ -105,10 +107,6 @@ public static void refillCache() {

private static DurationTag cache_worldScriptTimeEventFrequency;

/*
* Scripts location settings
*/

public static boolean useDefaultScriptPath() {
return cache_useDefaultScriptPath;
}
Expand All @@ -121,7 +119,6 @@ public static String scriptEncoding() {
return cache_scriptEncoding;
}


/**
* Whether Denizen should display debug in the console
*/
Expand Down Expand Up @@ -165,6 +162,10 @@ public static int debugLimitPerTick() {
return cache_debugLimitPerTick;
}

public static String debugPrefix() {
return cache_debugPrefix;
}

/**
* Sets the default speed between execution of commands in queues
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,13 +574,6 @@ static void finalOutputDebugText(String message, Debuggable caller, boolean refo
}
}


/**
* ConsoleSender sends dScript debugging information to the logger
* will attempt to intelligently wrap any debug information that is more
* than one line. This is used by the dB static methods which do some
* additional formatting.
*/
private static class ConsoleSender {

// Bukkit CommandSender sends color nicely to the logger, so we'll use that.
Expand Down Expand Up @@ -638,6 +631,8 @@ public static void sendMessage(String string, boolean reformat) {
+ " [INFO] " + string.replace(ChatColor.COLOR_CHAR, (char) 0x01) + "\n"));
}

string = Settings.debugPrefix() + string;

// Send buffer to the player
commandSender.sendMessage(showColor ? string : ChatColor.stripColor(string));
}
Expand Down
2 changes: 2 additions & 0 deletions plugin/src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Debug:
Limit per tick: 5000
# Whether to show extra 'verbose' info output (will FLOOD your console!).
Verbose: false
# Optional text to prefix all debug output.
Prefix: ""

Scripts:
World:
Expand Down

0 comments on commit 979588b

Please sign in to comment.