mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 06:28:52 +00:00
Added heuristic KillAura check
This commit is contained in:
1 parent
f88c31051b
commit
d41d08ccc6
9 files changed
+105
-56
No files matched your search
@@ -93,60 +93,13 @@ public class AntiCheatReloaded extends JavaPlugin {
|
|||||||
if (!VersionUtil.isSupported()) {
|
if (!VersionUtil.isSupported()) {
|
||||||
Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.RED + "The version of this server is NOT supported by ACR! The plugin will be buggy!");
|
Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.RED + "The version of this server is NOT supported by ACR! The plugin will be buggy!");
|
||||||
}
|
}
|
||||||
|
|
||||||
getLogger().info("Enabling checks that use ProtcolLib");
|
getLogger().info("Enabling checks that use ProtcolLib");
|
||||||
// Enable packetlisteners
|
// Enable packetlisteners
|
||||||
BlinkCheck.startTimer();
|
BlinkCheck.startTimer();
|
||||||
BlinkCheck.listenPackets();
|
BlinkCheck.listenPackets();
|
||||||
KillAuraCheck.listenPackets();
|
KillAuraCheck.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("Matrix") != null) {
|
|
||||||
getLogger().severe("*----------------------------------------------*");
|
|
||||||
getLogger().severe("You are also running Matrix!");
|
|
||||||
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("Spartan") != null) {
|
|
||||||
getLogger().severe("*----------------------------------------------*");
|
|
||||||
getLogger().severe("You are also running Spartan!");
|
|
||||||
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("NoAura") != null) {
|
|
||||||
getLogger().severe("*----------------------------------------------*");
|
|
||||||
getLogger().severe("You are also running NoAura!");
|
|
||||||
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 || Bukkit.getPluginManager().getPlugin("AntiCheatPlus") != 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("*----------------------------------------------*");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 90L);
|
|
||||||
|
|
||||||
updateManager = new UpdateManager();
|
updateManager = new UpdateManager();
|
||||||
|
|
||||||
// End tests
|
// End tests
|
||||||
@@ -175,7 +128,6 @@ public class AntiCheatReloaded extends JavaPlugin {
|
|||||||
public String call() throws Exception {
|
public String call() throws Exception {
|
||||||
return VersionUtil.getVersion();
|
return VersionUtil.getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
}));
|
}));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -178,6 +178,9 @@ public class Backend {
|
|||||||
SpeedCheck.SPEED_VIOLATIONS.remove(player.getUniqueId());
|
SpeedCheck.SPEED_VIOLATIONS.remove(player.getUniqueId());
|
||||||
ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId().toString());
|
ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId().toString());
|
||||||
KillAuraCheck.ANGLE_FLAGS.remove(player.getUniqueId().toString());
|
KillAuraCheck.ANGLE_FLAGS.remove(player.getUniqueId().toString());
|
||||||
|
KillAuraCheck.CLICKSPEED_MAP.remove(player.getUniqueId().toString());
|
||||||
|
KillAuraCheck.DEVIATION_SCORES.remove(player.getUniqueId().toString());
|
||||||
|
KillAuraCheck.DIFF_MAP.remove(player.getUniqueId().toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public CheckResult checkFastBow(Player player, float force) {
|
public CheckResult checkFastBow(Player player, float force) {
|
||||||
|
|||||||
@@ -19,7 +19,9 @@
|
|||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.check.combat;
|
package com.rammelkast.anticheatreloaded.check.combat;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -30,11 +32,15 @@ import org.bukkit.event.entity.EntityDamageEvent;
|
|||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
|
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||||
import com.rammelkast.anticheatreloaded.util.checkassist.KillauraAssist;
|
import com.rammelkast.anticheatreloaded.util.checkassist.KillauraAssist;
|
||||||
|
|
||||||
public class KillAuraCheck {
|
public class KillAuraCheck {
|
||||||
|
|
||||||
public static final Map<String, Integer> ANGLE_FLAGS = new HashMap<String, Integer>();
|
public static final Map<String, Integer> ANGLE_FLAGS = new HashMap<String, Integer>();
|
||||||
|
public static final Map<String, Integer> DEVIATION_SCORES = new HashMap<String, Integer>();
|
||||||
|
public static final Map<String, Integer> DIFF_MAP = new HashMap<String, Integer>();
|
||||||
|
public static final Map<String, ClickSpeed> CLICKSPEED_MAP = new HashMap<String, ClickSpeed>();
|
||||||
private static final KillauraAssist KILLAURA_ASSIST;
|
private static final KillauraAssist KILLAURA_ASSIST;
|
||||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||||
|
|
||||||
@@ -77,6 +83,82 @@ public class KillAuraCheck {
|
|||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static CheckResult checkFightSpeed(Player player, EntityDamageEvent event) {
|
||||||
|
if (!CLICKSPEED_MAP.containsKey(player.getUniqueId().toString())) {
|
||||||
|
CLICKSPEED_MAP.put(player.getUniqueId().toString(), new ClickSpeed());
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
ClickSpeed clickSpeed = CLICKSPEED_MAP.get(player.getUniqueId().toString());
|
||||||
|
clickSpeed.registerClick();
|
||||||
|
int deviationScore = clickSpeed.getDeviationScore();
|
||||||
|
// Prevents false positives since scores under 2000 aren't reliable
|
||||||
|
if (deviationScore < 2000) {
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!DEVIATION_SCORES.containsKey(player.getUniqueId().toString())) {
|
||||||
|
DEVIATION_SCORES.put(player.getUniqueId().toString(), deviationScore);
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
Magic magic = AntiCheatReloaded.getManager().getConfiguration().getMagic();
|
||||||
|
int lastScore = DEVIATION_SCORES.get(player.getUniqueId().toString());
|
||||||
|
DEVIATION_SCORES.put(player.getUniqueId().toString(), deviationScore);
|
||||||
|
int diff = Math.abs(deviationScore - lastScore);
|
||||||
|
if (!DIFF_MAP.containsKey(player.getUniqueId().toString())) {
|
||||||
|
DIFF_MAP.put(player.getUniqueId().toString(), diff);
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
int lastDiff = DIFF_MAP.get(player.getUniqueId().toString());
|
||||||
|
DIFF_MAP.put(player.getUniqueId().toString(), diff);
|
||||||
|
if (Math.abs(diff - lastDiff) < magic.KILLAURA_FIGHTSPEED_MINDIFF()) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
return new CheckResult(CheckResult.Result.FAILED, "had a suspiciously consistant fighting speed (absdiff=" + Math.abs(diff - lastDiff) + ")");
|
||||||
|
}
|
||||||
|
return PASS;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class ClickSpeed {
|
||||||
|
private final List<Long> clicks;
|
||||||
|
private long lastClick;
|
||||||
|
|
||||||
|
public ClickSpeed() {
|
||||||
|
this.clicks = new ArrayList<Long>();
|
||||||
|
this.lastClick = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerClick() {
|
||||||
|
this.lastClick = System.currentTimeMillis();
|
||||||
|
this.clicks.add(this.lastClick);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDeviationScore() {
|
||||||
|
long last = 0;
|
||||||
|
List<Integer> deviation = new ArrayList<Integer>();
|
||||||
|
List<Long> toRemove = new ArrayList<Long>();
|
||||||
|
for (long clickTime : this.clicks) {
|
||||||
|
if (clickTime > (this.lastClick - 5000)) {
|
||||||
|
if (last == 0) {
|
||||||
|
last = clickTime;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
deviation.add((int) (clickTime - last));
|
||||||
|
} else {
|
||||||
|
toRemove.add(clickTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.clicks.removeAll(toRemove);
|
||||||
|
if (deviation.isEmpty()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
float averageDeviationScore = deviation.get(0);
|
||||||
|
for (int i = 1; i < deviation.size(); i++) {
|
||||||
|
averageDeviationScore += deviation.get(i);
|
||||||
|
}
|
||||||
|
return Math.round(averageDeviationScore / deviation.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
KILLAURA_ASSIST = new KillauraAssist();
|
KILLAURA_ASSIST = new KillauraAssist();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,9 +30,6 @@ import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
|||||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO
|
|
||||||
*/
|
|
||||||
public class ElytraCheck {
|
public class ElytraCheck {
|
||||||
|
|
||||||
public static final HashMap<String, Double> JUMP_Y_VALUE = new HashMap<String, Double>();
|
public static final HashMap<String, Double> JUMP_Y_VALUE = new HashMap<String, Double>();
|
||||||
|
|||||||
@@ -382,6 +382,10 @@ public interface Magic {
|
|||||||
* The maximum amount of violations before flagging player as a cheater; TYPE=INTEGER, Leniency=INCREASE
|
* The maximum amount of violations before flagging player as a cheater; TYPE=INTEGER, Leniency=INCREASE
|
||||||
*/
|
*/
|
||||||
public int KILLAURA_MAX_ANGLE_VIOLATIONS();
|
public int KILLAURA_MAX_ANGLE_VIOLATIONS();
|
||||||
|
/**
|
||||||
|
* The minimum score difference for the fight speed check to consider a player legit; TYPE=INTEGER, Leniency=DECREASE
|
||||||
|
*/
|
||||||
|
public int KILLAURA_FIGHTSPEED_MINDIFF();
|
||||||
/**
|
/**
|
||||||
* The maximum angle difference allowed when breaking or placing blocks; TYPE=INTEGER, Leniency=INCREASE
|
* The maximum angle difference allowed when breaking or placing blocks; TYPE=INTEGER, Leniency=INCREASE
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -160,6 +160,14 @@ public class EntityListener extends EventListener {
|
|||||||
noHack = false;
|
noHack = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (getCheckManager().willCheck(player, CheckType.KILLAURA)) {
|
||||||
|
CheckResult result = KillAuraCheck.checkFightSpeed(player, event);
|
||||||
|
if (result.failed()) {
|
||||||
|
event.setCancelled(!silentMode());
|
||||||
|
log(result.getMessage(), player, CheckType.KILLAURA);
|
||||||
|
noHack = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (noHack) {
|
if (noHack) {
|
||||||
decrease(player);
|
decrease(player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import com.rammelkast.anticheatreloaded.check.CheckType;
|
|||||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||||
import com.rammelkast.anticheatreloaded.manage.*;
|
import com.rammelkast.anticheatreloaded.manage.*;
|
||||||
import com.rammelkast.anticheatreloaded.util.User;
|
import com.rammelkast.anticheatreloaded.util.User;
|
||||||
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -49,7 +50,7 @@ public class EventListener implements Listener {
|
|||||||
if (message == null || message.equals("")) {
|
if (message == null || message.equals("")) {
|
||||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + player.getName() + " failed " + CheckType.getName(type);
|
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + player.getName() + " failed " + CheckType.getName(type);
|
||||||
} else {
|
} else {
|
||||||
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + player.getName() + " failed " + CheckType.getName(type) + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + message;
|
message = ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.GRAY + player.getName() + " failed " + CheckType.getName(type) + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + message + ChatColor.DARK_GRAY + " | " + ChatColor.GRAY + "ping: " + VersionUtil.getPlayerPing(player) + "ms";
|
||||||
}
|
}
|
||||||
if (user != null) { // npc
|
if (user != null) { // npc
|
||||||
logCheat(type, user);
|
logCheat(type, user);
|
||||||
|
|||||||
@@ -11,12 +11,11 @@
|
|||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.-
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.manage;
|
package com.rammelkast.anticheatreloaded.manage;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -33,7 +32,6 @@ import com.rammelkast.anticheatreloaded.config.Configuration;
|
|||||||
/**
|
/**
|
||||||
* The internal hub for all managers.
|
* The internal hub for all managers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class AntiCheatManager {
|
public class AntiCheatManager {
|
||||||
private static AntiCheatReloaded plugin = null;
|
private static AntiCheatReloaded plugin = null;
|
||||||
private static Configuration configuration;
|
private static Configuration configuration;
|
||||||
|
|||||||
@@ -259,6 +259,10 @@ KILLAURA_MAX_ANGLE_DIFFERENCE: 50
|
|||||||
# The maximum amount of violations before flagging player as a cheater
|
# The maximum amount of violations before flagging player as a cheater
|
||||||
# Increase this in case of false positives
|
# Increase this in case of false positives
|
||||||
KILLAURA_MAX_ANGLE_VIOLATIONS: 3
|
KILLAURA_MAX_ANGLE_VIOLATIONS: 3
|
||||||
|
# The minimum score difference for the fight speed check to consider a player legit
|
||||||
|
# Increasing this will tighten check but might punish combat consistancy
|
||||||
|
# Decrease this in case of false positives
|
||||||
|
KILLAURA_FIGHTSPEED_MINDIFF: 3
|
||||||
# The maximum angle difference allowed when placing or breaking a block
|
# The maximum angle difference allowed when placing or breaking a block
|
||||||
# Increase this in case of false positives, can be slightly decreased to tighten check
|
# Increase this in case of false positives, can be slightly decreased to tighten check
|
||||||
ILLEGALINTERACT_MAX_ANGLE_DIFFERENCE: 75
|
ILLEGALINTERACT_MAX_ANGLE_DIFFERENCE: 75
|
||||||
Reference in new issue
Block a user