diff options
author | md_5 <md_5@bigpond.com> | 2012-03-12 10:39:36 +1100 |
---|---|---|
committer | md_5 <md_5@bigpond.com> | 2012-03-12 10:39:36 +1100 |
commit | 78f4820876f42f7b50bf88f64afd45bee939e4e4 (patch) | |
tree | 317cd3bcc63fc9e86a6efbcb5e13a50ed9efbaaf /EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/LogAction.java | |
parent | 26409058467e9f34aa65a08df3c68a58129d22ba (diff) | |
download | Essentials-78f4820876f42f7b50bf88f64afd45bee939e4e4.tar Essentials-78f4820876f42f7b50bf88f64afd45bee939e4e4.tar.gz Essentials-78f4820876f42f7b50bf88f64afd45bee939e4e4.tar.lz Essentials-78f4820876f42f7b50bf88f64afd45bee939e4e4.tar.xz Essentials-78f4820876f42f7b50bf88f64afd45bee939e4e4.zip |
Initial formatted and slightly tweaked version of @evenprime 's NoCheat. Will be intergrated into the main Essentials as soon as possible
Diffstat (limited to 'EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/LogAction.java')
-rw-r--r-- | EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/LogAction.java | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/LogAction.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/LogAction.java new file mode 100644 index 000000000..16830b8d7 --- /dev/null +++ b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/LogAction.java @@ -0,0 +1,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" : ""); + } +} |