Follow java rules more closely

This commit is contained in:
Adam committed 2012-05-28 21:27:53 -04:00
1 parent fd93bc8ef2
commit 12ac4a8ebc
9 files changed
+147 -151

No files matched your search

@@ -52,10 +52,13 @@ public class CommandHandler implements CommandExecutor
private static final Server SERVER = Bukkit.getServer();
private static final int MED_THRESHOLD = 20;
private static final int HIGH_THRESHOLD = 50;
private static final String ADMIN_PERM = "anticheat.admin";
private static final String MOD_PERM = "anticheat.mod";
private static final String PERMISSIONS_ERROR = RED+"Insufficient Permissions.";
public void handleLog(CommandSender cs, String [] args)
{
if(hasPermission(cs,"system.log") || hasPermission(cs,"admin"))
if(hasPermission(cs,"system.log") || hasPermission(cs,ADMIN_PERM))
{
if(args[1].equalsIgnoreCase("enable"))
{
@@ -88,13 +91,13 @@ public class CommandHandler implements CommandExecutor
}
else
{
cs.sendMessage(RED+"Insufficient permissions.");
cs.sendMessage(PERMISSIONS_ERROR);
}
}
public void handleXRay(CommandSender cs, String [] args)
{
if(hasPermission(cs,"system.xray") || hasPermission(cs,"admin") || hasPermission(cs,"mod"))
if(hasPermission(cs,"system.xray") || hasPermission(cs,ADMIN_PERM) || hasPermission(cs,MOD_PERM))
{
if(config.logXRay())
{
@@ -133,13 +136,13 @@ public class CommandHandler implements CommandExecutor
}
else
{
cs.sendMessage(RED+"Insufficient permissions.");
cs.sendMessage(PERMISSIONS_ERROR);
}
}
public void handleReset(CommandSender cs, String [] args)
{
if(hasPermission(cs,"system.reset") || hasPermission(cs,"admin"))
if(hasPermission(cs,"system.reset") || hasPermission(cs,ADMIN_PERM))
{
List<Player> list = SERVER.matchPlayer(args[1]);
if(list.size() == 1)
@@ -168,7 +171,7 @@ public class CommandHandler implements CommandExecutor
}
else
{
cs.sendMessage(RED+"Insufficient permissions.");
cs.sendMessage(PERMISSIONS_ERROR);
}
}
@@ -177,7 +180,7 @@ public class CommandHandler implements CommandExecutor
if(cs instanceof Player)
{
Player sender = (Player)cs;
if(hasPermission(cs,"system.spy") || hasPermission(cs,"mod"))
if(hasPermission(cs,"system.spy") || hasPermission(cs,MOD_PERM))
{
if(!args[1].equalsIgnoreCase("off"))
{
@@ -222,7 +225,7 @@ public class CommandHandler implements CommandExecutor
}
else
{
cs.sendMessage(RED+"Insufficient permissions.");
cs.sendMessage(PERMISSIONS_ERROR);
}
}
else
@@ -233,7 +236,7 @@ public class CommandHandler implements CommandExecutor
public void handleHelp(CommandSender cs)
{
if(hasPermission(cs,"system.help") || hasPermission(cs,"admin") || hasPermission(cs,"mod"))
if(hasPermission(cs,"system.help") || hasPermission(cs,ADMIN_PERM) || hasPermission(cs,MOD_PERM))
{
String base = "/AntiCheat ";
cs.sendMessage("----------------------["+GREEN+"AntiCheat"+WHITE+"]----------------------");
@@ -250,13 +253,13 @@ public class CommandHandler implements CommandExecutor
}
else
{
cs.sendMessage(RED+"Insufficient permissions.");
cs.sendMessage(PERMISSIONS_ERROR);
}
}
public void handleUpdate(CommandSender cs)
{
if(hasPermission(cs,"system.update") || hasPermission(cs,"admin"))
if(hasPermission(cs,"system.update") || hasPermission(cs,ADMIN_PERM))
{
cs.sendMessage("Running "+GREEN+"AntiCheat "+WHITE+"v"+GREEN+Anticheat.getVersion());
cs.sendMessage("-----------------------------------------------------");
@@ -280,13 +283,13 @@ public class CommandHandler implements CommandExecutor
}
else
{
cs.sendMessage(RED+"Insufficient permissions.");
cs.sendMessage(PERMISSIONS_ERROR);
}
}
public void handleReport(CommandSender cs)
{
if(hasPermission(cs,"system.report") || hasPermission(cs,"admin") || hasPermission(cs,"mod"))
if(hasPermission(cs,"system.report") || hasPermission(cs,ADMIN_PERM) || hasPermission(cs,MOD_PERM))
{
getPlayers();
if(!low.isEmpty())
@@ -316,13 +319,13 @@ public class CommandHandler implements CommandExecutor
}
else
{
cs.sendMessage(RED+"Insufficient permissions.");
cs.sendMessage(PERMISSIONS_ERROR);
}
}
public void handlePlayerReport(CommandSender cs,String [] args)
{
if(hasPermission(cs,"system.report") || hasPermission(cs,"admin") || hasPermission(cs,"mod"))
if(hasPermission(cs,"system.report") || hasPermission(cs,ADMIN_PERM) || hasPermission(cs,MOD_PERM))
{
List<Player> list = SERVER.matchPlayer(args[1]);
if(list.size() == 1)
@@ -360,7 +363,7 @@ public class CommandHandler implements CommandExecutor
}
else
{
cs.sendMessage(RED+"Insufficient permissions.");
cs.sendMessage(PERMISSIONS_ERROR);
}
}
@@ -436,14 +439,14 @@ public class CommandHandler implements CommandExecutor
public void handleReload(CommandSender cs)
{
if(hasPermission(cs,"system.reload") || hasPermission(cs,"admin"))
if(hasPermission(cs,"system.reload") || hasPermission(cs,ADMIN_PERM))
{
config.load();
cs.sendMessage(GREEN+"AntiCheat configuration reloaded.");
}
else
{
cs.sendMessage(RED+"Insufficient permissions.");
cs.sendMessage(PERMISSIONS_ERROR);
}
}
@@ -518,14 +521,7 @@ public class CommandHandler implements CommandExecutor
{
if(cs instanceof Player)
{
if(((Player)cs).hasPermission("anticheat."+permission))
{
return true;
}
else
{
return false;
}
return ((Player)cs).hasPermission("anticheat."+permission);
}
else
{