/
DebugHelper.java
50 lines (43 loc) · 1.22 KB
/
DebugHelper.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package mantle.debug;
import static mantle.lib.CoreConfig.debug_enableChat;
import static mantle.lib.CoreConfig.debug_enableConsole;
import static mantle.lib.CoreRepo.logger;
import mantle.player.PlayerUtils;
import net.minecraft.entity.player.EntityPlayer;
/**
* IDebuggable helper
*
* @author Sunstrike <sun@sunstrike.io>
*/
public class DebugHelper
{
private DebugHelper()
{
// No instantiation
}
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)
{
PlayerUtils.sendChatMessage(player, prefix + str);
}
}
private static void handleConsoleDebug (DebugData data)
{
String player = data.player.getGameProfile().getName();
String prefix = "[" + player + ":" + data.cl.getSimpleName() + "] ";
for (String str : data.strings)
{
logger.info(prefix + str);
}
}
}