Various java compliance & rule fixes. More of this and optimization tomorrow.

This commit is contained in:
h31ix committed 2012-11-01 23:00:48 -04:00
1 parent 6b2835b018
commit 39db8afe81
10 files changed
+92 -141

No files matched your search

@@ -109,7 +109,7 @@ public class Anticheat extends JavaPlugin
} }
catch (Exception e) catch (Exception e)
{ {
e.printStackTrace(); getLogger().severe("Unable to save files. Is the directory writeable?");
} }
if (verbose) if (verbose)
{ {
@@ -37,9 +37,9 @@ import org.bukkit.metadata.FixedMetadataValue;
public class CommandHandler implements CommandExecutor public class CommandHandler implements CommandExecutor
{ {
private static final Configuration config = Anticheat.getManager().getConfiguration(); private static final Configuration CONFIG = Anticheat.getManager().getConfiguration();
private static final UserManager userManager = Anticheat.getManager().getUserManager(); private static final UserManager USER_MANAGER = Anticheat.getManager().getUserManager();
private static final XRayTracker xtracker = Anticheat.getManager().getXRayTracker(); private static final XRayTracker XRAY_TRACKER = Anticheat.getManager().getXRayTracker();
private static final ChatColor RED = ChatColor.RED; private static final ChatColor RED = ChatColor.RED;
private static final ChatColor YELLOW = ChatColor.YELLOW; private static final ChatColor YELLOW = ChatColor.YELLOW;
private static final ChatColor GREEN = ChatColor.GREEN; private static final ChatColor GREEN = ChatColor.GREEN;
@@ -52,6 +52,7 @@ public class CommandHandler implements CommandExecutor
private static final int MED_THRESHOLD = 20; private static final int MED_THRESHOLD = 20;
private static final int HIGH_THRESHOLD = 50; private static final int HIGH_THRESHOLD = 50;
private static final String PERMISSIONS_ERROR = RED + "Insufficient Permissions."; private static final String PERMISSIONS_ERROR = RED + "Insufficient Permissions.";
private static final String MENU_END = "-----------------------------------------------------";
public void handleLog(CommandSender cs, String[] args) public void handleLog(CommandSender cs, String[] args)
{ {
@@ -59,9 +60,9 @@ public class CommandHandler implements CommandExecutor
{ {
if (args[1].equalsIgnoreCase("enable")) if (args[1].equalsIgnoreCase("enable"))
{ {
if (!config.logConsole()) if (!CONFIG.logConsole())
{ {
config.setLog(true); CONFIG.setLog(true);
cs.sendMessage(GREEN + "Console logging enabled."); cs.sendMessage(GREEN + "Console logging enabled.");
} }
else else
@@ -71,9 +72,9 @@ public class CommandHandler implements CommandExecutor
} }
else if (args[1].equalsIgnoreCase("disable")) else if (args[1].equalsIgnoreCase("disable"))
{ {
if (config.logConsole()) if (CONFIG.logConsole())
{ {
config.setLog(false); CONFIG.setLog(false);
cs.sendMessage(GREEN + "Console logging disabled."); cs.sendMessage(GREEN + "Console logging disabled.");
} }
else else
@@ -110,15 +111,15 @@ public class CommandHandler implements CommandExecutor
{ {
if (Permission.SYSTEM_XRAY.get(cs)) if (Permission.SYSTEM_XRAY.get(cs))
{ {
if (config.logXRay()) if (CONFIG.logXRay())
{ {
List<Player> list = SERVER.matchPlayer(args[1]); List<Player> list = SERVER.matchPlayer(args[1]);
if (list.size() == 1) if (list.size() == 1)
{ {
Player player = list.get(0); Player player = list.get(0);
if (xtracker.sufficientData(player.getName())) if (XRAY_TRACKER.sufficientData(player.getName()))
{ {
xtracker.sendStats(cs, player.getName()); XRAY_TRACKER.sendStats(cs, player.getName());
} }
else else
{ {
@@ -130,9 +131,9 @@ public class CommandHandler implements CommandExecutor
{ {
cs.sendMessage(RED + "Multiple players found by name: " + WHITE + args[1] + RED + "."); cs.sendMessage(RED + "Multiple players found by name: " + WHITE + args[1] + RED + ".");
} }
else if (xtracker.sufficientData(args[1])) else if (XRAY_TRACKER.sufficientData(args[1]))
{ {
xtracker.sendStats(cs, args[1]); XRAY_TRACKER.sendStats(cs, args[1]);
} }
else else
{ {
@@ -159,16 +160,16 @@ public class CommandHandler implements CommandExecutor
if (list.size() == 1) if (list.size() == 1)
{ {
Player player = list.get(0); Player player = list.get(0);
if (userManager.safeGetLevel(player.getName()) == 0) if (USER_MANAGER.safeGetLevel(player.getName()) == 0)
{ {
cs.sendMessage(player.getName() + RED + " is already in Low Level!"); cs.sendMessage(player.getName() + RED + " is already in Low Level!");
} }
else else
{ {
userManager.safeReset(player.getName()); USER_MANAGER.safeReset(player.getName());
cs.sendMessage(player.getName() + GREEN + " has been reset to Low Level."); cs.sendMessage(player.getName() + GREEN + " has been reset to Low Level.");
} }
xtracker.reset(player.getName()); XRAY_TRACKER.reset(player.getName());
cs.sendMessage(player.getName() + GREEN + "'s XRay stats have been reset."); cs.sendMessage(player.getName() + GREEN + "'s XRay stats have been reset.");
} }
else if (list.size() > 1) else if (list.size() > 1)
@@ -274,7 +275,7 @@ public class CommandHandler implements CommandExecutor
cs.sendMessage(base + GREEN + "help" + WHITE + " - access this page"); cs.sendMessage(base + GREEN + "help" + WHITE + " - access this page");
cs.sendMessage(base + GREEN + "debug" + WHITE + " - post debug information"); cs.sendMessage(base + GREEN + "debug" + WHITE + " - post debug information");
cs.sendMessage(base + GREEN + "update" + WHITE + " - check update status"); cs.sendMessage(base + GREEN + "update" + WHITE + " - check update status");
cs.sendMessage("-----------------------------------------------------"); cs.sendMessage(MENU_END);
} }
else else
{ {
@@ -287,11 +288,11 @@ public class CommandHandler implements CommandExecutor
if (Permission.SYSTEM_UPDATE.get(cs)) if (Permission.SYSTEM_UPDATE.get(cs))
{ {
cs.sendMessage("Running " + GREEN + "AntiCheat " + WHITE + "v" + GREEN + Anticheat.getVersion()); cs.sendMessage("Running " + GREEN + "AntiCheat " + WHITE + "v" + GREEN + Anticheat.getVersion());
cs.sendMessage("-----------------------------------------------------"); cs.sendMessage(MENU_END);
if (!Anticheat.isUpdated()) if (!Anticheat.isUpdated())
{ {
cs.sendMessage(GRAY + "There " + GREEN + "IS" + GRAY + " a newer version avaliable."); cs.sendMessage(GRAY + "There " + GREEN + "IS" + GRAY + " a newer version avaliable.");
if (config.autoUpdate()) if (CONFIG.autoUpdate())
{ {
cs.sendMessage(GRAY + "It will be installed automatically for you on next launch."); cs.sendMessage(GRAY + "It will be installed automatically for you on next launch.");
} }
@@ -417,7 +418,7 @@ public class CommandHandler implements CommandExecutor
cs.sendMessage(GRAY + player); cs.sendMessage(GRAY + player);
} }
} }
cs.sendMessage("-----------------------------------------------------"); cs.sendMessage(MENU_END);
} }
else else
{ {
@@ -426,7 +427,7 @@ public class CommandHandler implements CommandExecutor
cs.sendMessage("--------------------[" + GREEN + "REPORT[1/1]" + WHITE + "]---------------------"); cs.sendMessage("--------------------[" + GREEN + "REPORT[1/1]" + WHITE + "]---------------------");
cs.sendMessage(GRAY + "Group: " + color + group); cs.sendMessage(GRAY + "Group: " + color + group);
cs.sendMessage(GRAY + "There are no users in this group."); cs.sendMessage(GRAY + "There are no users in this group.");
cs.sendMessage("-----------------------------------------------------"); cs.sendMessage(MENU_END);
} }
else else
{ {
@@ -493,11 +494,11 @@ public class CommandHandler implements CommandExecutor
int pages = (int)Math.ceil(((float)types.size())/6); int pages = (int)Math.ceil(((float)types.size())/6);
int level = user.getLevel(); int level = user.getLevel();
String levelString = GREEN + "Low"; String levelString = GREEN + "Low";
if (level >= config.highThreshold()) if (level >= CONFIG.highThreshold())
{ {
levelString = RED + "High"; levelString = RED + "High";
} }
else if (level >= config.medThreshold()) else if (level >= CONFIG.medThreshold())
{ {
levelString = YELLOW + "Medium"; levelString = YELLOW + "Medium";
} }
@@ -524,7 +525,7 @@ public class CommandHandler implements CommandExecutor
cs.sendMessage(GRAY + CheckType.getName(types.get(index)) + ": " + color + use); cs.sendMessage(GRAY + CheckType.getName(types.get(index)) + ": " + color + use);
} }
} }
cs.sendMessage("-----------------------------------------------------"); cs.sendMessage(MENU_END);
} }
else else
{ {
@@ -534,7 +535,7 @@ public class CommandHandler implements CommandExecutor
cs.sendMessage(GRAY + "Player: " + WHITE + name); cs.sendMessage(GRAY + "Player: " + WHITE + name);
cs.sendMessage(GRAY + "Level: " + levelString); cs.sendMessage(GRAY + "Level: " + levelString);
cs.sendMessage(GRAY + "This user has not failed any checks."); cs.sendMessage(GRAY + "This user has not failed any checks.");
cs.sendMessage("-----------------------------------------------------"); cs.sendMessage(MENU_END);
} }
else else
{ {
@@ -547,7 +548,7 @@ public class CommandHandler implements CommandExecutor
{ {
if (Permission.SYSTEM_RELOAD.get(cs)) if (Permission.SYSTEM_RELOAD.get(cs))
{ {
config.load(); CONFIG.load();
cs.sendMessage(GREEN + "AntiCheat configuration reloaded."); cs.sendMessage(GREEN + "AntiCheat configuration reloaded.");
} }
else else
@@ -657,7 +658,7 @@ public class CommandHandler implements CommandExecutor
low.clear(); low.clear();
for (Player player : SERVER.getOnlinePlayers()) for (Player player : SERVER.getOnlinePlayers())
{ {
int level = userManager.safeGetLevel(player.getName()); int level = USER_MANAGER.safeGetLevel(player.getName());
if (level <= MED_THRESHOLD) if (level <= MED_THRESHOLD)
{ {
low.add(player.getName()); low.add(player.getName());
@@ -75,14 +75,11 @@ public class BlockListener extends EventListener
boolean noHack = true; boolean noHack = true;
if (player != null) if (player != null)
{ {
if (checkManager.willCheck(player, CheckType.NO_SWING)) if (checkManager.willCheck(player, CheckType.NO_SWING) && backend.checkSwing(player, block))
{ {
if (backend.checkSwing(player, block)) event.setCancelled(!config.silentMode());
{ log("tried to break a block of " + block.getType().name() + " without swinging their arm.", player, CheckType.NO_SWING);
event.setCancelled(!config.silentMode()); noHack = false;
log("tried to break a block of " + block.getType().name() + " without swinging their arm.", player, CheckType.NO_SWING);
noHack = false;
}
} }
if (checkManager.willCheck(player, CheckType.LONG_REACH)) if (checkManager.willCheck(player, CheckType.LONG_REACH))
{ {
@@ -94,14 +91,11 @@ public class BlockListener extends EventListener
noHack = false; noHack = false;
} }
} }
if (checkManager.willCheck(player, CheckType.FAST_BREAK) && !backend.isInstantBreakExempt(player)) if (checkManager.willCheck(player, CheckType.FAST_BREAK) && !backend.isInstantBreakExempt(player) && backend.checkFastBreak(player, block))
{ {
if (backend.checkFastBreak(player, block)) event.setCancelled(!config.silentMode());
{ log("tried to break a block of " + block.getType().name() + " too fast.", player, CheckType.FAST_BREAK);
event.setCancelled(!config.silentMode()); noHack = false;
log("tried to break a block of " + block.getType().name() + " too fast.", player, CheckType.FAST_BREAK);
noHack = false;
}
} }
} }
if (noHack) if (noHack)
@@ -88,19 +88,16 @@ public class EntityListener extends EventListener
if (event.getEntity() instanceof Player) if (event.getEntity() instanceof Player)
{ {
Player player = (Player) event.getEntity(); Player player = (Player) event.getEntity();
if(player.getFoodLevel() < event.getFoodLevel()) // Make sure it's them actually gaining a food level if(player.getFoodLevel() < event.getFoodLevel() && checkManager.willCheck(player, CheckType.FAST_EAT)) // Make sure it's them actually gaining a food level
{ {
if (checkManager.willCheck(player, CheckType.FAST_EAT)) if (backend.justStartedEating(player))
{ {
if (backend.justStartedEating(player)) event.setCancelled(!config.silentMode());
{ log("tried to eat too fast.", player, CheckType.FAST_EAT);
event.setCancelled(!config.silentMode()); }
log("tried to eat too fast.", player, CheckType.FAST_EAT); else
} {
else decrease(player);
{
decrease(player);
}
} }
} }
} }
@@ -157,32 +154,23 @@ public class EntityListener extends EventListener
if (e.getDamager() instanceof Player) if (e.getDamager() instanceof Player)
{ {
Player player = (Player) e.getDamager(); Player player = (Player) e.getDamager();
if (checkManager.willCheck(player, CheckType.FORCEFIELD)) if (checkManager.willCheck(player, CheckType.FORCEFIELD) && backend.justSprinted(player))
{ {
if (backend.justSprinted(player)) event.setCancelled(!config.silentMode());
{ log("tried to sprint & damage too fast.", player, CheckType.FORCEFIELD);
event.setCancelled(!config.silentMode()); noHack = false;
log("tried to sprint & damage too fast.", player, CheckType.FORCEFIELD);
noHack = false;
}
} }
if (checkManager.willCheck(player, CheckType.NO_SWING)) if (checkManager.willCheck(player, CheckType.NO_SWING) && !backend.justAnimated(player))
{ {
if (!backend.justAnimated(player)) event.setCancelled(!config.silentMode());
{ log("tried to damage an entity without swinging their arm.", player, CheckType.NO_SWING);
event.setCancelled(!config.silentMode()); noHack = false;
log("tried to damage an entity without swinging their arm.", player, CheckType.NO_SWING);
noHack = false;
}
} }
if (checkManager.willCheck(player, CheckType.FORCEFIELD)) if (checkManager.willCheck(player, CheckType.FORCEFIELD))
{ {
if(!backend.checkSight(player, e.getEntity())) event.setCancelled(!config.silentMode());
{ log("tried to damage an entity that they couldn't see.", player, CheckType.FORCEFIELD);
event.setCancelled(!config.silentMode()); noHack = false;
log("tried to damage an entity that they couldn't see.", player, CheckType.FORCEFIELD);
noHack = false;
}
} }
if (noHack) if (noHack)
{ {
@@ -93,13 +93,10 @@ public class PlayerListener extends EventListener
return; return;
} }
if (checkManager.willCheck(player, CheckType.FAST_PROJECTILE)) if (checkManager.willCheck(player, CheckType.FAST_PROJECTILE) && backend.checkProjectile(player))
{ {
if (backend.checkProjectile(player)) event.setCancelled(!config.silentMode());
{ log("tried to fire projectiles too fast.", player, CheckType.FAST_PROJECTILE);
event.setCancelled(!config.silentMode());
log("tried to fire projectiles too fast.", player, CheckType.FAST_PROJECTILE);
}
} }
} }
} }
@@ -134,13 +131,10 @@ public class PlayerListener extends EventListener
Player player = event.getPlayer(); Player player = event.getPlayer();
if (checkManager.willCheck(player, CheckType.FLY) && checkManager.willCheck(player, CheckType.ZOMBE_FLY)) //@h31ix: Change if necessary. I'm not sure what perms should go here :3 if (checkManager.willCheck(player, CheckType.FLY) && checkManager.willCheck(player, CheckType.ZOMBE_FLY)) //@h31ix: Change if necessary. I'm not sure what perms should go here :3
{ {
if (backend.justVelocity(player)) if (backend.justVelocity(player) && backend.extendVelocityTime(player))
{ {
if (backend.extendVelocityTime(player)) event.setCancelled(!config.silentMode());
{ return; // don't log it lol.
event.setCancelled(!config.silentMode());
return; // don't log it lol.
}
} }
backend.logVelocity(player); backend.logVelocity(player);
} }
@@ -200,7 +194,6 @@ public class PlayerListener extends EventListener
public void onPlayerInteract(PlayerInteractEvent event) public void onPlayerInteract(PlayerInteractEvent event)
{ {
Player player = event.getPlayer(); Player player = event.getPlayer();
//Block playerClick = player.getTargetBlock(Utilities.getNonSolid(), 5);
PlayerInventory inv = player.getInventory(); PlayerInventory inv = player.getInventory();
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)
{ {
@@ -315,30 +308,27 @@ public class PlayerListener extends EventListener
} }
log("tried to fly on y-axis", player, CheckType.FLY); log("tried to fly on y-axis", player, CheckType.FLY);
} }
if (checkManager.willCheck(player, CheckType.VCLIP) && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && checkManager.willCheck(player, CheckType.FLY)) if (checkManager.willCheck(player, CheckType.VCLIP) && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && checkManager.willCheck(player, CheckType.FLY) && event.getFrom().getY() > event.getTo().getY())
{ {
if (event.getFrom().getY() > event.getTo().getY()) int result = backend.checkVClip(player, new Distance(event.getFrom(), event.getTo()));
{
int result = backend.checkVClip(player, new Distance(event.getFrom(), event.getTo()));
if (result > 0) if (result > 0)
{
if (!config.silentMode())
{ {
if (!config.silentMode()) // You come back up, and you suddenly feel sick from trying to stick yourself through the blocks..
Location newloc = new Location(player.getWorld(), event.getFrom().getX(), event.getFrom().getY() + result, event.getFrom().getZ());
if (newloc.getBlock().getTypeId() == 0)
{ {
// You come back up, and you suddenly feel sick from trying to stick yourself through the blocks.. event.setTo(newloc);
Location newloc = new Location(player.getWorld(), event.getFrom().getX(), event.getFrom().getY() + result, event.getFrom().getZ());
if (newloc.getBlock().getTypeId() == 0)
{
event.setTo(newloc);
}
else
{
event.setTo(event.getFrom());
}
player.damage(3);
} }
log("tried to move down through a block.", player, CheckType.VCLIP); else
{
event.setTo(event.getFrom());
}
player.damage(3);
} }
log("tried to move down through a block.", player, CheckType.VCLIP);
} }
} }
if (checkManager.willCheck(player, CheckType.NOFALL) && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && checkManager.willCheck(player, CheckType.FLY) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && event.getFrom().getY() > event.getTo().getY() && backend.checkNoFall(player, y)) if (checkManager.willCheck(player, CheckType.NOFALL) && checkManager.willCheck(player, CheckType.ZOMBE_FLY) && checkManager.willCheck(player, CheckType.FLY) && !Utilities.isClimbableBlock(player.getLocation().getBlock()) && event.getFrom().getY() > event.getTo().getY() && backend.checkNoFall(player, y))
@@ -382,16 +372,13 @@ public class PlayerListener extends EventListener
} }
log("tried to move too fast.", player, CheckType.SPEED); log("tried to move too fast.", player, CheckType.SPEED);
} }
if(event.getFrom().getX() != event.getTo().getX() || event.getFrom().getZ() != event.getTo().getZ()) if((event.getFrom().getX() != event.getTo().getX() || event.getFrom().getZ() != event.getTo().getZ()) && backend.checkTimer(player))
{ {
if (backend.checkTimer(player)) if (!config.silentMode())
{ {
if (!config.silentMode()) event.setTo(from);
{
event.setTo(from);
}
log("tried to move too fast.", player, CheckType.SPEED);
} }
log("tried to move too fast.", player, CheckType.SPEED);
} }
} }
if (checkManager.willCheck(player, CheckType.WATER_WALK) && backend.checkWaterWalk(player, x, z)) if (checkManager.willCheck(player, CheckType.WATER_WALK) && backend.checkWaterWalk(player, x, z))
@@ -147,6 +147,7 @@ public class Backend
public boolean checkFastBow(Player player, float force) public boolean checkFastBow(Player player, float force)
{ {
// Ignore magic numbers here, they are minecrafty vanilla stuff.
int ticks = (int)((((System.currentTimeMillis()-bowWindUp.get(player.getName()))*20)/1000)+3); int ticks = (int)((((System.currentTimeMillis()-bowWindUp.get(player.getName()))*20)/1000)+3);
bowWindUp.remove(player.getName()); bowWindUp.remove(player.getName());
float f = (float) ticks / 20.0F; float f = (float) ticks / 20.0F;
@@ -285,14 +286,7 @@ public class Backend
if(speed) if(speed)
{ {
int num = this.increment(player, speedViolation, magic.SPEED_MAX); int num = this.increment(player, speedViolation, magic.SPEED_MAX);
if(num >= magic.SPEED_MAX) return num >= magic.SPEED_MAX;
{
return true;
}
else
{
return false;
}
} }
else else
{ {
@@ -611,14 +605,7 @@ public class Backend
} }
int violation = flightViolation.containsKey(name) ? flightViolation.get(name)+1 : 1; int violation = flightViolation.containsKey(name) ? flightViolation.get(name)+1 : 1;
increment(player, flightViolation, violation); increment(player, flightViolation, violation);
if(violation > magic.FLIGHT_LIMIT) return violation > magic.FLIGHT_LIMIT;
{
return true;
}
else
{
return false;
}
} }
} }
flightViolation.put(name, 0); flightViolation.put(name, 0);
@@ -868,7 +855,6 @@ public class Backend
if (lastMessage.get(name) == null) if (lastMessage.get(name) == null)
{ {
logEvent(lastMessage, player, msg, magic.CHAT_REPEAT_MIN); logEvent(lastMessage, player, msg, magic.CHAT_REPEAT_MIN);
//lastMessage.put(name, msg);
} }
else else
{ {
@@ -33,14 +33,13 @@ import org.bukkit.configuration.file.YamlConfiguration;
public class Configuration public class Configuration
{ {
private AnticheatManager micromanage = null; //like a boss! private AnticheatManager micromanage = null;
private File configFile = null; private File configFile = null;
private File levelFile = null; private File levelFile = null;
private File langFile = null; private File langFile = null;
private File magicFile = null; private File magicFile = null;
private CommentedConfiguration config; private CommentedConfiguration config;
private FileConfiguration level; private FileConfiguration level;
private FileConfiguration lang;
private FileConfiguration magic; private FileConfiguration magic;
private boolean logConsole; private boolean logConsole;
private boolean logXRay; private boolean logXRay;
@@ -185,9 +184,8 @@ public class Configuration
micromanage.getPlugin().checkConfigs(); micromanage.getPlugin().checkConfigs();
config = CommentedConfiguration.loadConfig(configFile); config = CommentedConfiguration.loadConfig(configFile);
level = YamlConfiguration.loadConfiguration(levelFile); level = YamlConfiguration.loadConfiguration(levelFile);
lang = YamlConfiguration.loadConfiguration(langFile);
magic = YamlConfiguration.loadConfiguration(magicFile); magic = YamlConfiguration.loadConfiguration(magicFile);
language = new Language(lang, langFile); language = new Language(YamlConfiguration.loadConfiguration(langFile), langFile);
updateFolder = Bukkit.getUpdateFolder(); updateFolder = Bukkit.getUpdateFolder();
// Begin pulling values from config. // Begin pulling values from config.
@@ -26,13 +26,13 @@ import java.util.logging.LogRecord;
public class FileFormatter extends Formatter public class FileFormatter extends Formatter
{ {
private static final DateFormat format = new SimpleDateFormat("h:mm:ss"); private static final DateFormat FORMAT = new SimpleDateFormat("h:mm:ss");
private static final String lineSep = System.getProperty("line.separator"); private static final String LINE_SEP = System.getProperty("line.separator");
@Override @Override
public String format(LogRecord record) public String format(LogRecord record)
{ {
StringBuilder output = new StringBuilder().append("[").append(record.getLevel()).append('|').append(format.format(new Date(record.getMillis()))).append("]: ").append(record.getMessage()).append(' ').append(lineSep); StringBuilder output = new StringBuilder().append("[").append(record.getLevel()).append('|').append(FORMAT.format(new Date(record.getMillis()))).append("]: ").append(record.getMessage()).append(' ').append(LINE_SEP);
return output.toString(); return output.toString();
} }
} }
@@ -56,8 +56,6 @@ public class PastebinReport
} }
catch (IOException e) catch (IOException e)
{ {
// TODO Auto-generated catch block
//e.printStackTrace();
} }
postReport(); postReport();
} }
@@ -70,7 +68,9 @@ public class PastebinReport
private void appendPermissionsTester(Player player) private void appendPermissionsTester(Player player)
{ {
if (player == null) if (player == null)
{
return; return;
}
// alrighty then noobs. // alrighty then noobs.
for(Permission node : Permission.values()) for(Permission node : Permission.values())
@@ -41,12 +41,9 @@ public class XRayListener implements Listener
if (config.logXRay()) if (config.logXRay())
{ {
Player p = event.getPlayer(); Player p = event.getPlayer();
if(p.getGameMode() == GameMode.CREATIVE) if(p.getGameMode() == GameMode.CREATIVE && !config.trackCreativeXRay())
{ {
if(!config.trackCreativeXRay()) return;
{
return;
}
} }
String player = p.getName(); String player = p.getName();
if (checkManager.willCheck(p, CheckType.XRAY)) if (checkManager.willCheck(p, CheckType.XRAY))