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>
<groupId>com.rammelkast.anticheatreloaded</groupId>
<artifactId>AntiCheatReloaded</artifactId>
<version>1.6.0-ALPHA</version>
<version>1.6.1-ALPHA</version>
<name>AntiCheatReloaded</name>
<url>https://rammelkast.com</url>
<properties>
@@ -65,7 +65,8 @@ public class AntiCheat extends JavaPlugin {
eventList.add(new EntityListener());
eventList.add(new VehicleListener());
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();
setupEvents();
setupCommands();
@@ -73,32 +74,67 @@ public class AntiCheat extends JavaPlugin {
// Enterprise must come before levels
setupEnterprise();
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
KillAuraCheck.listenPackets();
BlinkCheck.startTimer();
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
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) {
e.printStackTrace();
}
@@ -218,4 +254,29 @@ public class AntiCheat extends JavaPlugin {
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 {
VL_COUNT.put(p.getUniqueId(), VL_COUNT.get(p.getUniqueId()) + 1);
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());
}
}
@@ -30,7 +30,7 @@ public class BlinkCheck {
public void run() {
MOVE_COUNT.clear();
}
}.runTaskTimer(AntiCheat.getPlugin(), 0, 20);
}.runTaskTimer(AntiCheat.getPlugin(), 20, 20);
}
public static void listenPackets() {
@@ -229,6 +229,7 @@ public class UserManager {
}
} else if (event.equalsIgnoreCase("KICK")) {
user.getPlayer().kickPlayer(RED + kickReason);
AntiCheat.getPlugin().onPlayerKicked();
String msg = RED + config.getLang().KICK_BROADCAST().replaceAll("&player", name) + " (" + CheckType.getName(type) + ")";
if (!msg.equals("")) {
manager.log(msg);
@@ -167,7 +167,7 @@ public class NPC_1_11 {
}
public void damage() {
if (this.npc == null) {
if (this.npc == null || this.getOwner() == null) {
return;
}
if (new Random().nextBoolean() && this.npc.isInvisible()) {