Better file logging options

This commit is contained in:
Adam committed 2012-05-27 18:07:14 -04:00
1 parent de762de1ba
commit 33dfb97a1b
10 files changed
+154 -25

No files matched your search

@@ -81,7 +81,15 @@ public class AnticheatManager
if(getConfiguration().logConsole())
{
LOGGER.log(Level.WARNING,"[AC] ".concat(message));
}
if(getConfiguration().getFileLogLevel() == 3)
{
fileLog(message);
}
}
public void fileLog(String message)
{
FILE_LOGGER.log(Level.WARNING, message);
}
@@ -18,6 +18,10 @@
package net.h31ix.anticheat.manage;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.entity.Player;
/**
* <p>
@@ -50,6 +54,7 @@ public enum CheckType
ITEM_SPAM("anticheat.itemspam");
private final String permission;
private static final Map<String,Integer> level = new HashMap<String,Integer>();
private CheckType(String permission)
{
@@ -60,4 +65,28 @@ public enum CheckType
{
return this.permission;
}
public void logUse(Player player)
{
String name = player.getName();
if(level.get(name) == null)
{
level.put(name, 1);
}
else
{
int amount = level.get(name)+1;
level.put(name, amount);
}
}
public int getUses(Player player)
{
int use = 0;
if(level.get(player.getName()) != null)
{
use = level.get(player.getName());
}
return use;
}
}
@@ -45,11 +45,11 @@ public class PlayerManager
private static void reactMedium(Player player)
{
execute("Medium",player);
String [] alert = new String[2];
alert[0] = ChatColor.YELLOW+"[ALERT] "+ChatColor.WHITE+player.getName()+ChatColor.YELLOW+" has entered the MEDIUM hack level.";
alert[1] = ChatColor.YELLOW+"[ALERT] This means they may be using a hacked client or may have a bad connection!";
Utilities.alert(alert);
execute("Medium",player);
String [] alert = new String[2];
alert[0] = ChatColor.YELLOW+"[ALERT] "+ChatColor.WHITE+player.getName()+ChatColor.YELLOW+" has entered the MEDIUM hack level.";
alert[1] = ChatColor.YELLOW+"[ALERT] This means they may be using a hacked client or may have a bad connection!";
Utilities.alert(alert);
}
private static void reactHigh(Player player)
{
@@ -45,7 +45,7 @@ public final class Utilities
{
for(Player p : Bukkit.getServer().getOnlinePlayers())
{
if(p.hasPermission("anticheat.alert") || p.hasPermission("anticheat.admin") || p.isOp())
if(p.hasPermission("anticheat.alert") || p.hasPermission("anticheat.admin") || p.hasPermission("anticheat.mod") || p.isOp())
{
for(String msg : message)
{
@@ -61,6 +61,13 @@ public final class Utilities
logger.log(Level.INFO,ChatColor.stripColor(msg));
}
}
if(Anticheat.getManager().getConfiguration().getFileLogLevel() > 0)
{
for(String msg : message)
{
Anticheat.getManager().fileLog(ChatColor.stripColor(msg));
}
}
}
public static boolean cantStandAt(Block block)
{