Rebuild IDebuggable to be config-agnostic, make output configurable.

This commit is contained in:
Sunstrike committed 2013-12-10 01:35:05 +00:00
1 parent 5b54ac0673
commit caa5f6f3bb
8 files changed
+99 -17

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
package mantle.debug;
import net.minecraft.entity.player.EntityPlayer;
import static mantle.lib.CoreRepo.*;
import static mantle.lib.CoreConfig.*;
/**
* IDebuggable helper
*
* @author Sunstrike <[email protected]>
*/
public class DebugHelper {
private DebugHelper() {} //Singleton
public static void handleDebugData(DebugData data)
{
if (debug_enableChat)
handleChatDebug(data);
if (debug_enableConsole)
handleConsoleDebug(data);
}
private static void handleChatDebug(DebugData data)
{
EntityPlayer player = data.player;
String prefix = "[" + data.cl.getSimpleName() + "] ";
for (String str : data.strings)
{
player.addChatMessage(prefix + str);
}
}
private static void handleConsoleDebug(DebugData data)
{
String player = data.player.username;
String prefix = "[" + player + ":" + data.cl.getSimpleName() + "] ";
for (String str : data.strings)
{
logger.info(prefix + str);
}
}
}