Awesome new reports! Woohoo! Some of this stuff hasn't changed since the release of AntiCheat, so I hope this makes it less of an eyesore.

This commit is contained in:
H31IX committed 2012-08-08 03:37:39 -04:00
1 parent 9216a9a2f0
commit 9386ec838a
1 file changed
+136 -65
@@ -309,33 +309,49 @@ public class CommandHandler implements CommandExecutor
} }
} }
public void handleReport(CommandSender cs) public void handleReport(CommandSender cs, String[] args)
{ {
if (Permission.SYSTEM_REPORT.get(cs)) if (Permission.SYSTEM_REPORT.get(cs))
{ {
getPlayers(); getPlayers();
if (!low.isEmpty()) if(args.length > 1)
{ {
cs.sendMessage(GREEN + "----Level: Low (Not likely hacking)----"); String group = args[1];
for (String string : low) if(group.equalsIgnoreCase("low"))
{ {
cs.sendMessage(GREEN + string); int num = getReportPageNum(args);
if (num > 0)
{
sendReport(cs, low, "Low", GREEN, num);
}
else
{
cs.sendMessage(RED + "Not a valid page number: " + WHITE + args[2]);
} }
} }
if (!med.isEmpty()) else if(group.equalsIgnoreCase("medium"))
{ {
cs.sendMessage(YELLOW + "----Level: Medium (Possibly hacking/lagging)----"); int num = getReportPageNum(args);
for (String string : med) if (num > 0)
{ {
cs.sendMessage(YELLOW + string); sendReport(cs, med, "Medium", YELLOW, num);
}
else
{
cs.sendMessage(RED + "Not a valid page number: " + WHITE + args[2]);
} }
} }
if (!high.isEmpty()) if(group.equalsIgnoreCase("high"))
{ {
cs.sendMessage(RED + "----Level: High (Probably hacking or bad connection)----"); int num = getReportPageNum(args);
for (String string : high) if (num > 0)
{ {
cs.sendMessage(RED + string); sendReport(cs, high, "High", RED, num);
}
else
{
cs.sendMessage(RED + "Not a valid page number: " + WHITE + args[2]);
}
} }
} }
} }
@@ -345,6 +361,56 @@ public class CommandHandler implements CommandExecutor
} }
} }
public int getReportPageNum(String [] args)
{
if (args.length == 2)
{
return 1;
}
else if (Utilities.isInt(args[2]))
{
return Integer.parseInt(args[2]);
}
else
{
return -1;
}
}
public void sendReport(CommandSender cs, List<String> players, String group, ChatColor color, int page)
{
int pages = (int)Math.ceil(((float)players.size())/7);
if(page <= pages && page > 0)
{
cs.sendMessage("--------------------[" + GREEN + "REPORT[" + page + "/"+pages+"]" + WHITE + "]---------------------");
cs.sendMessage(GRAY + "Group: " + color + group);
for (int x = 0; x < 7; x++)
{
int index = ((page-1)*6)+(x+((page-1)*1));
if(index < players.size())
{
String player = players.get(index);
cs.sendMessage(GRAY + player);
}
}
cs.sendMessage("-----------------------------------------------------");
}
else
{
if(pages == 0)
{
cs.sendMessage("--------------------[" + GREEN + "REPORT[1/1]" + WHITE + "]---------------------");
cs.sendMessage(GRAY + "Group: " + color + group);
cs.sendMessage(GRAY + "There are no users in this group.");
cs.sendMessage("-----------------------------------------------------");
}
else
{
cs.sendMessage(RED+"Page not found. Requested "+WHITE+page+RED+", Max "+WHITE+pages);
}
}
}
public void handlePlayerReport(CommandSender cs, String[] args) public void handlePlayerReport(CommandSender cs, String[] args)
{ {
if (Permission.SYSTEM_REPORT.get(cs)) if (Permission.SYSTEM_REPORT.get(cs))
@@ -353,21 +419,22 @@ public class CommandHandler implements CommandExecutor
if (list.size() == 1) if (list.size() == 1)
{ {
Player player = list.get(0); Player player = list.get(0);
List<CheckType> l = new ArrayList();
for(CheckType type : CheckType.values())
{
if(type.getUses(player) > 0)
{
l.add(type);
}
}
if (args.length == 2) if (args.length == 2)
{ {
sendPlayerReport(cs, CheckType.values(), player, 1); sendPlayerReport(cs, l, player, 1);
} }
else if (Utilities.isInt(args[2])) else if (Utilities.isInt(args[2]))
{ {
int num = Integer.parseInt(args[2]); int num = Integer.parseInt(args[2]);
if (num <= 3 && num > 1) sendPlayerReport(cs, l, player, num);
{
sendPlayerReport(cs, CheckType.values(), player, num);
}
else
{
cs.sendMessage(RED + "Page: " + num + RED + " does not exist.");
}
} }
else else
{ {
@@ -389,11 +456,9 @@ public class CommandHandler implements CommandExecutor
} }
} }
public void sendPlayerReport(CommandSender cs, CheckType[] types, Player player, int page) public void sendPlayerReport(CommandSender cs, List<CheckType> types, Player player, int page)
{
cs.sendMessage("--------------------[" + GREEN + "REPORT[" + page + "/3]" + WHITE + "]---------------------");
if (page == 1)
{ {
int pages = (int)Math.ceil(((float)types.size())/6);
int level = playerManager.getLevel(player); int level = playerManager.getLevel(player);
String levelString = GREEN + "Low"; String levelString = GREEN + "Low";
if (level >= 20) if (level >= 20)
@@ -404,11 +469,17 @@ public class CommandHandler implements CommandExecutor
{ {
levelString = RED + "High"; levelString = RED + "High";
} }
if(page <= pages && page > 0)
{
cs.sendMessage("--------------------[" + GREEN + "REPORT[" + page + "/"+pages+"]" + WHITE + "]---------------------");
cs.sendMessage(GRAY + "Player: " + WHITE + player.getName()); cs.sendMessage(GRAY + "Player: " + WHITE + player.getName());
cs.sendMessage(GRAY + "Level: " + levelString); cs.sendMessage(GRAY + "Level: " + levelString);
for (int i = 0; i < 6; i++) for (int x = 0; x < 6; x++)
{ {
int use = types[i].getUses(player); int index = ((page-1)*5)+(x+((page-1)*1));
if(index < types.size())
{
int use = types.get(index).getUses(player);
ChatColor color = WHITE; ChatColor color = WHITE;
if (use >= 20) if (use >= 20)
{ {
@@ -418,45 +489,26 @@ public class CommandHandler implements CommandExecutor
{ {
color = RED; color = RED;
} }
cs.sendMessage(GRAY + CheckType.getName(types[i]) + ": " + color + use); cs.sendMessage(GRAY + CheckType.getName(types.get(index)) + ": " + color + use);
}
}
else if (page == 2)
{
for (int i = 6; i < 14; i++)
{
int use = types[i].getUses(player);
ChatColor color = WHITE;
if (use >= 20)
{
color = YELLOW;
}
else if (use > 50)
{
color = RED;
}
cs.sendMessage(GRAY + CheckType.getName(types[i]) + ": " + color + use);
}
}
else if (page == 3)
{
for (int i = 14; i < 21; i++)
{
int use = types[i].getUses(player);
ChatColor color = WHITE;
if (use >= 20)
{
color = YELLOW;
}
else if (use > 50)
{
color = RED;
}
cs.sendMessage(GRAY + CheckType.getName(types[i]) + ": " + color + use);
} }
} }
cs.sendMessage("-----------------------------------------------------"); cs.sendMessage("-----------------------------------------------------");
}
else
{
if(pages == 0)
{
cs.sendMessage("--------------------[" + GREEN + "REPORT[1/1]" + WHITE + "]---------------------");
cs.sendMessage(GRAY + "Player: " + WHITE + player.getName());
cs.sendMessage(GRAY + "Level: " + levelString);
cs.sendMessage(GRAY + "This user has not failed any checks.");
cs.sendMessage("-----------------------------------------------------");
}
else
{
cs.sendMessage(RED+"Page not found. Requested "+WHITE+page+RED+", Max "+WHITE+pages);
}
}
} }
public void handleReload(CommandSender cs) public void handleReload(CommandSender cs)
@@ -478,10 +530,17 @@ public class CommandHandler implements CommandExecutor
if (args.length == 3) if (args.length == 3)
{ {
if (args[0].equalsIgnoreCase("report")) if (args[0].equalsIgnoreCase("report"))
{
if(args[1].equalsIgnoreCase("low") || args[1].equalsIgnoreCase("medium") || args[1].equalsIgnoreCase("high"))
{
handleReport(cs, args);
}
else
{ {
handlePlayerReport(cs, args); handlePlayerReport(cs, args);
} }
} }
}
else if (args.length == 2) else if (args.length == 2)
{ {
if (args[0].equalsIgnoreCase("log")) if (args[0].equalsIgnoreCase("log"))
@@ -501,9 +560,16 @@ public class CommandHandler implements CommandExecutor
handleSpy(cs, args); handleSpy(cs, args);
} }
else if (args[0].equalsIgnoreCase("report")) else if (args[0].equalsIgnoreCase("report"))
{
if(args[1].equalsIgnoreCase("low") || args[1].equalsIgnoreCase("medium") || args[1].equalsIgnoreCase("high"))
{
handleReport(cs, args);
}
else
{ {
handlePlayerReport(cs, args); handlePlayerReport(cs, args);
} }
}
else else
{ {
cs.sendMessage(RED + "Unrecognized command."); cs.sendMessage(RED + "Unrecognized command.");
@@ -521,7 +587,12 @@ public class CommandHandler implements CommandExecutor
} }
else if (args[0].equalsIgnoreCase("report")) else if (args[0].equalsIgnoreCase("report"))
{ {
handleReport(cs); cs.sendMessage(ChatColor.GREEN+"To see the report of a specific user, type their name, like so:");
cs.sendMessage(ChatColor.WHITE+"/anticheat report [user]");
cs.sendMessage(ChatColor.GRAY+" - This will allow you to see the checks that user has failed.");
cs.sendMessage(ChatColor.GREEN+"To see the report of an AntiCheat group, type it's name, like so:");
cs.sendMessage(ChatColor.WHITE+"/anticheat report [low/medium/high]");
cs.sendMessage(ChatColor.GRAY+" - This will allow you to see which players are good, and which could be hacking.");
} }
else if (args[0].equalsIgnoreCase("reload")) else if (args[0].equalsIgnoreCase("reload"))
{ {