Fixed stuff, added new metrics graphs

This commit is contained in:
Rammelkast committed 2017-03-02 15:08:45 +01:00
1 parent 7f13a0ad4c
commit 09ddbfba8f
6 files changed
+86 -23

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.rammelkast.anticheatreloaded</groupId> <groupId>com.rammelkast.anticheatreloaded</groupId>
<artifactId>AntiCheatReloaded</artifactId> <artifactId>AntiCheatReloaded</artifactId>
<version>1.6.0-ALPHA</version> <version>1.6.1-ALPHA</version>
<name>AntiCheatReloaded</name> <name>AntiCheatReloaded</name>
<url>https://rammelkast.com</url> <url>https://rammelkast.com</url>
<properties> <properties>
@@ -65,7 +65,8 @@ public class AntiCheat extends JavaPlugin {
eventList.add(new EntityListener()); eventList.add(new EntityListener());
eventList.add(new VehicleListener()); eventList.add(new VehicleListener());
eventList.add(new InventoryListener()); eventList.add(new InventoryListener());
// Order is important in some cases, don't screw with these unless needed, especially config // Order is important in some cases, don't screw with these unless
// needed, especially config
setupConfig(); setupConfig();
setupEvents(); setupEvents();
setupCommands(); setupCommands();
@@ -73,32 +74,67 @@ public class AntiCheat extends JavaPlugin {
// Enterprise must come before levels // Enterprise must come before levels
setupEnterprise(); setupEnterprise();
restoreLevels(); restoreLevels();
// Check if NoCheatPlus is installed
Bukkit.getScheduler().runTaskLater(this, new Runnable() {
public void run() {
if (Bukkit.getPluginManager().getPlugin("NoCheatPlus") != null) {
getLogger().severe("You are also running NoCheatPlus!");
getLogger().severe("Multiple anticheats create false cheat detections.");
getLogger().severe("Please remove or disable NoCheatPlus to silence this warning.");
}else if (Bukkit.getPluginManager().getPlugin("AAC") != null) {
getLogger().severe("You are also running AAC!");
getLogger().severe("Multiple anticheats create false cheat detections.");
getLogger().severe("Please remove or disable AAC to silence this warning.");
}
}
}, 40L);
// End tests
verboseLog("Finished loading.");
getLogger().info("Running version " + VersionUtil.getVersion() + "...");
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
getLogger().info("Found ProtocolLib, enabling checks that use ProtcolLib...");
// Enable packetlisteners // Enable packetlisteners
KillAuraCheck.listenPackets(); KillAuraCheck.listenPackets();
BlinkCheck.startTimer(); BlinkCheck.startTimer();
BlinkCheck.listenPackets(); BlinkCheck.listenPackets();
}
// Check if other AC's are installed
Bukkit.getScheduler().runTaskLater(this, new Runnable() {
public void run() {
if (Bukkit.getPluginManager().getPlugin("NoCheatPlus") != null) {
getLogger().severe("*----------------------------------------------*");
getLogger().severe("You are also running NoCheatPlus!");
getLogger().severe("Multiple anticheats create false cheat detections.");
getLogger().severe("Please remove or disable NoCheatPlus to silence this warning.");
getLogger().severe("*----------------------------------------------*");
}
if (Bukkit.getPluginManager().getPlugin("AAC") != null) {
getLogger().severe("*----------------------------------------------*");
getLogger().severe("You are also running AAC!");
getLogger().severe("Multiple anticheats create false cheat detections.");
getLogger().severe("Please remove or disable AAC to silence this warning.");
getLogger().severe("*----------------------------------------------*");
}
if (Bukkit.getPluginManager().getPlugin("AntiCheat") != null) {
getLogger().severe("*----------------------------------------------*");
getLogger().severe("You are also running AntiCheat!");
getLogger().severe("Multiple anticheats create false cheat detections.");
getLogger().severe("Please remove or disable AntiCheat to silence this warning.");
getLogger().severe("*----------------------------------------------*");
}
}
}, 60L);
// End tests
verboseLog("Finished loading.");
getLogger().info("Running NMS version " + VersionUtil.getVersion() + "...");
// Metrics // Metrics
try { try {
new Metrics(this); Metrics metrics = new Metrics(this);
metrics.addCustomChart(new Metrics.SingleLineChart("cheaters_kicked") {
@Override
public int getValue() {
return playersKicked;
}
});
metrics.addCustomChart(new Metrics.SingleLineChart("killaura_violations") {
@Override
public int getValue() {
return killauraViolations;
}
});
metrics.addCustomChart(new Metrics.SingleLineChart("glide_violations") {
@Override
public int getValue() {
return glideViolations;
}
});
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -218,4 +254,29 @@ public class AntiCheat extends JavaPlugin {
return protocolManager; return protocolManager;
} }
/**
* Amount of players kicked since start
*/
private int playersKicked = 0;
/**
* Amount of killaura violations since start
*/
private int killauraViolations = 0;
/**
* Amount of glide violations since start
*/
private int glideViolations = 0;
public void onPlayerKicked() {
this.playersKicked++;
}
public void onKillAuraViolation() {
this.killauraViolations++;
}
public void onGlideViolation() {
this.killauraViolations++;
}
} }
@@ -56,7 +56,8 @@ public class KillAuraCheck {
}else { }else {
VL_COUNT.put(p.getUniqueId(), VL_COUNT.get(p.getUniqueId()) + 1); VL_COUNT.put(p.getUniqueId(), VL_COUNT.get(p.getUniqueId()) + 1);
if (VL_COUNT.get(p.getUniqueId()) >= 5) { if (VL_COUNT.get(p.getUniqueId()) >= 5) {
EventListener.log(new CheckResult(CheckResult.Result.FAILED, p.getName() + " failed KillAura (botcheck), hit the bot " + VL_COUNT.get(p.getUniqueId()) + " times (max=5)").getMessage(), p, CheckType.BLINK); EventListener.log(new CheckResult(CheckResult.Result.FAILED, p.getName() + " failed KillAura (botcheck), hit the bot " + VL_COUNT.get(p.getUniqueId()) + " times (max=5)").getMessage(), p, CheckType.KILLAURA);
AntiCheat.getPlugin().onKillAuraViolation();
VL_COUNT.remove(p.getUniqueId()); VL_COUNT.remove(p.getUniqueId());
} }
} }
@@ -30,7 +30,7 @@ public class BlinkCheck {
public void run() { public void run() {
MOVE_COUNT.clear(); MOVE_COUNT.clear();
} }
}.runTaskTimer(AntiCheat.getPlugin(), 0, 20); }.runTaskTimer(AntiCheat.getPlugin(), 20, 20);
} }
public static void listenPackets() { public static void listenPackets() {
@@ -229,6 +229,7 @@ public class UserManager {
} }
} else if (event.equalsIgnoreCase("KICK")) { } else if (event.equalsIgnoreCase("KICK")) {
user.getPlayer().kickPlayer(RED + kickReason); user.getPlayer().kickPlayer(RED + kickReason);
AntiCheat.getPlugin().onPlayerKicked();
String msg = RED + config.getLang().KICK_BROADCAST().replaceAll("&player", name) + " (" + CheckType.getName(type) + ")"; String msg = RED + config.getLang().KICK_BROADCAST().replaceAll("&player", name) + " (" + CheckType.getName(type) + ")";
if (!msg.equals("")) { if (!msg.equals("")) {
manager.log(msg); manager.log(msg);
@@ -167,7 +167,7 @@ public class NPC_1_11 {
} }
public void damage() { public void damage() {
if (this.npc == null) { if (this.npc == null || this.getOwner() == null) {
return; return;
} }
if (new Random().nextBoolean() && this.npc.isInvisible()) { if (new Random().nextBoolean() && this.npc.isInvisible()) {