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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
package com.earth2me.essentials.anticheat.actions.types;
import com.earth2me.essentials.anticheat.NoCheatPlayer;
import com.earth2me.essentials.anticheat.checks.Check;
/**
* Print a log message to various locations
*
*/
public class LogAction extends ActionWithParameters
{
// Some flags to decide where the log message should show up, based on
// the config file
private final boolean toChat;
private final boolean toConsole;
private final boolean toFile;
public LogAction(String name, int delay, int repeat, boolean toChat, boolean toConsole, boolean toFile, String message)
{
super(name, delay, repeat, message);
this.toChat = toChat;
this.toConsole = toConsole;
this.toFile = toFile;
}
/**
* Parse the final log message out of various data from the player and check that triggered the action.
*
* @param player The player that is used as a source for the log message
* @param check The check that is used as a source for the log message
* @return
*/
public String getLogMessage(NoCheatPlayer player, Check check)
{
return super.getMessage(player, check);
}
/**
* Should the message be shown in chat?
*
* @return true, if yes
*/
public boolean toChat()
{
return toChat;
}
/**
* Should the message be shown in the console?
*
* @return true, if yes
*/
public boolean toConsole()
{
return toConsole;
}
/**
* Should the message be written to the logfile?
*
* @return true, if yes
*/
public boolean toFile()
{
return toFile;
}
/**
* Create the string that's used to define the action in the logfile
*/
public String toString()
{
return "log:" + name + ":" + delay + ":" + repeat + ":" + (toConsole ? "c" : "") + (toChat ? "i" : "") + (toFile ? "f" : "");
}
}
|