mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-02 14:38:45 +00:00
Update copyright & big fixes
This commit is contained in:
1 parent
7ae3f010a3
commit
1a64403223
79 files changed
+642
-502
No files matched your search
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team | http://gravitydevelopment.net
|
||||
* Copyright (c) 2016-2018 Rammelkast | https://rammelkast.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team | http://gravitydevelopment.net
|
||||
* Copyright (c) 2016-2018 Rammelkast | https://rammelkast.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* AntiCheat for Bukkit.
|
||||
* Copyright (C) 2012-2014 AntiCheat Team | http://gravitydevelopment.net
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team | http://gravitydevelopment.net
|
||||
* Copyright (c) 2016-2018 Rammelkast | https://rammelkast.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team | http://gravitydevelopment.net
|
||||
* Copyright (c) 2016-2018 Rammelkast | https://rammelkast.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.rammelkast.anticheatreloaded.check.combat;
|
||||
|
||||
import org.bukkit.Material;
|
||||
@@ -16,17 +34,24 @@ public class CriticalsCheck {
|
||||
public static void doDamageEvent(EntityDamageByEntityEvent e, Player damager) {
|
||||
if (!(e.getDamager() instanceof Player) || e.getCause() != DamageCause.ENTITY_ATTACK)
|
||||
return;
|
||||
Player p = (Player)e.getDamager();
|
||||
Player p = (Player) e.getDamager();
|
||||
if (isCritical(p)) {
|
||||
if ((p.getLocation().getY() % 1.0 == 0 || p.getLocation().getY() % 0.5 == 0) && p.getLocation().clone().subtract(0, 1.0, 0).getBlock().getType().isSolid()) {
|
||||
if ((p.getLocation().getY() % 1.0 == 0 || p.getLocation().getY() % 0.5 == 0)
|
||||
&& p.getLocation().clone().subtract(0, 1.0, 0).getBlock().getType().isSolid()) {
|
||||
e.setCancelled(true);
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, p.getName() + " failed Criticals, tried to do a critical without needed conditions").getMessage(), p, CheckType.CRITICALS);
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED,
|
||||
p.getName() + " failed Criticals, tried to do a critical without needed conditions")
|
||||
.getMessage(),
|
||||
p, CheckType.CRITICALS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isCritical(Player player) {
|
||||
return player.getFallDistance() > 0.0f && !player.isOnGround() && !player.isInsideVehicle() && !player.hasPotionEffect(PotionEffectType.BLINDNESS) && !Utilities.isHoveringOverWater(player.getLocation()) && player.getEyeLocation().getBlock().getType() != Material.LADDER;
|
||||
return player.getFallDistance() > 0.0f && !player.isOnGround() && !player.isInsideVehicle()
|
||||
&& !player.hasPotionEffect(PotionEffectType.BLINDNESS)
|
||||
&& !Utilities.isHoveringOverWater(player.getLocation())
|
||||
&& player.getEyeLocation().getBlock().getType() != Material.LADDER;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team | http://gravitydevelopment.net
|
||||
* Copyright (c) 2016-2018 Rammelkast | https://rammelkast.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rammelkast.anticheatreloaded.check.combat;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -23,22 +42,23 @@ import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
* @author Rammelkast
|
||||
*/
|
||||
public class KillAuraCheck {
|
||||
|
||||
|
||||
private static final Map<UUID, NPC_1_12> NPC_LIST = new HashMap<UUID, NPC_1_12>();
|
||||
private static final Map<UUID, Integer> VL_COUNT = new HashMap<UUID, Integer>();
|
||||
|
||||
|
||||
public static void cleanPlayer(Player p) {
|
||||
if (!VersionUtil.getVersion().equals("v1_11_R1")) {
|
||||
if (!VersionUtil.getVersion().equals("v1_12_R1")) {
|
||||
return;
|
||||
}
|
||||
NPC_LIST.remove(p.getUniqueId());
|
||||
}
|
||||
|
||||
|
||||
public static void listenPackets() {
|
||||
if (!VersionUtil.getVersion().equals("v1_11_R1")) {
|
||||
if (!VersionUtil.getVersion().equals("v1_12_R1")) {
|
||||
return;
|
||||
}
|
||||
AntiCheatReloaded.getProtocolManager().addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.NORMAL, new PacketType[] {PacketType.Play.Client.USE_ENTITY}) {
|
||||
AntiCheatReloaded.getProtocolManager().addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(),
|
||||
ListenerPriority.NORMAL, new PacketType[] { PacketType.Play.Client.USE_ENTITY }) {
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
@@ -53,10 +73,14 @@ public class KillAuraCheck {
|
||||
if (!VL_COUNT.containsKey(p.getUniqueId())) {
|
||||
VL_COUNT.put(p.getUniqueId(), 1);
|
||||
NPC_LIST.get(p.getUniqueId()).damage();
|
||||
}else {
|
||||
} 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.KILLAURA);
|
||||
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);
|
||||
AntiCheatReloaded.getPlugin().onKillAuraViolation();
|
||||
VL_COUNT.remove(p.getUniqueId());
|
||||
}
|
||||
@@ -66,7 +90,7 @@ public class KillAuraCheck {
|
||||
}
|
||||
|
||||
public static void doDamageEvent(EntityDamageByEntityEvent e, Player p) {
|
||||
if (!VersionUtil.getVersion().equals("v1_11_R1")) {
|
||||
if (!VersionUtil.getVersion().equals("v1_12_R1")) {
|
||||
return;
|
||||
}
|
||||
if (NPC_LIST.containsKey(p.getUniqueId()))
|
||||
@@ -77,14 +101,14 @@ public class KillAuraCheck {
|
||||
npc.spawn();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void doMove(PlayerMoveEvent e) {
|
||||
if (!VersionUtil.getVersion().equals("v1_11_R1")) {
|
||||
if (!VersionUtil.getVersion().equals("v1_12_R1")) {
|
||||
return;
|
||||
}
|
||||
if (NPC_LIST.containsKey(e.getPlayer().getUniqueId())) {
|
||||
NPC_LIST.get(e.getPlayer().getUniqueId()).move(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team | http://gravitydevelopment.net
|
||||
* Copyright (c) 2016-2018 Rammelkast | https://rammelkast.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rammelkast.anticheatreloaded.check.combat;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -17,13 +36,14 @@ import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||
public class VelocityCheck {
|
||||
|
||||
private static final Map<UUID, Integer> VL_COUNT = new HashMap<UUID, Integer>();
|
||||
|
||||
|
||||
public static void cleanPlayer(Player p) {
|
||||
VL_COUNT.remove(p.getUniqueId());
|
||||
}
|
||||
|
||||
|
||||
public static void runCheck(EntityDamageByEntityEvent e, final Player p) {
|
||||
if (AntiCheatReloaded.getManager().getCheckManager().isOpExempt(p) || AntiCheatReloaded.getManager().getCheckManager().isExempt(p, CheckType.VELOCITY))
|
||||
if (AntiCheatReloaded.getManager().getCheckManager().isOpExempt(p)
|
||||
|| AntiCheatReloaded.getManager().getCheckManager().isExempt(p, CheckType.VELOCITY))
|
||||
return;
|
||||
final Location then = p.getLocation();
|
||||
new BukkitRunnable() {
|
||||
@@ -36,16 +56,22 @@ public class VelocityCheck {
|
||||
VL_COUNT.put(p.getUniqueId(), 1);
|
||||
else {
|
||||
VL_COUNT.put(p.getUniqueId(), VL_COUNT.get(p.getUniqueId()) + 1);
|
||||
if (VL_COUNT.get(p.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic().VELOCITY_AMT()) {
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, p.getName() + " failed Velocity, had zero/low velocity " + VL_COUNT.get(p.getUniqueId()) + " times (max=" + AntiCheatReloaded.getManager().getBackend().getMagic().VELOCITY_AMT() + ", dist=" + then.distance(p.getLocation()) + ")").getMessage(), p, CheckType.VELOCITY);
|
||||
if (VL_COUNT.get(p.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.VELOCITY_AMT()) {
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED,
|
||||
p.getName() + " failed Velocity, had zero/low velocity "
|
||||
+ VL_COUNT.get(p.getUniqueId()) + " times (max="
|
||||
+ AntiCheatReloaded.getManager().getBackend().getMagic().VELOCITY_AMT()
|
||||
+ ", dist=" + then.distance(p.getLocation()) + ")").getMessage(),
|
||||
p, CheckType.VELOCITY);
|
||||
VL_COUNT.remove(p.getUniqueId());
|
||||
}
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
VL_COUNT.remove(p.getUniqueId());
|
||||
}
|
||||
}
|
||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 4);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team | http://gravitydevelopment.net
|
||||
* Copyright (c) 2016-2018 Rammelkast | https://rammelkast.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rammelkast.anticheatreloaded.check.movement;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -23,7 +42,7 @@ import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||
public class BlinkCheck {
|
||||
|
||||
public static final Map<UUID, Integer> MOVE_COUNT = new HashMap<UUID, Integer>();
|
||||
|
||||
|
||||
public static void startTimer() {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
@@ -32,28 +51,39 @@ public class BlinkCheck {
|
||||
}
|
||||
}.runTaskTimer(AntiCheatReloaded.getPlugin(), 20, 20);
|
||||
}
|
||||
|
||||
|
||||
public static void listenPackets() {
|
||||
AntiCheatReloaded.getProtocolManager().addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.NORMAL, new PacketType[] {PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK}) {
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
Location cur = e.getPlayer().getLocation();
|
||||
if (!MOVE_COUNT.containsKey(p.getUniqueId())) {
|
||||
MOVE_COUNT.put(p.getUniqueId(), 1);
|
||||
} else {
|
||||
MOVE_COUNT.put(p.getUniqueId(), MOVE_COUNT.get(p.getUniqueId()) + 1);
|
||||
if (AntiCheatReloaded.getManager().getCheckManager().checkInWorld(p) && !AntiCheatReloaded.getManager().getCheckManager().isOpExempt(p) && !AntiCheatReloaded.getManager().getCheckManager().isExempt(p, CheckType.BLINK)) {
|
||||
if (MOVE_COUNT.get(p.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic().BLINK_PACKET()) {
|
||||
EventListener.log(new CheckResult(CheckResult.Result.FAILED, p.getName() + " failed Blink, sent " + MOVE_COUNT.get(p.getUniqueId()) + " packets in one second (max=" + AntiCheatReloaded.getManager().getBackend().getMagic().BLINK_PACKET() + ")").getMessage(), p, CheckType.BLINK);
|
||||
MOVE_COUNT.remove(p.getUniqueId());
|
||||
e.setCancelled(true);
|
||||
e.getPlayer().teleport(cur);
|
||||
AntiCheatReloaded.getProtocolManager()
|
||||
.addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.NORMAL,
|
||||
new PacketType[] { PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK }) {
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
Location cur = e.getPlayer().getLocation();
|
||||
if (!MOVE_COUNT.containsKey(p.getUniqueId())) {
|
||||
MOVE_COUNT.put(p.getUniqueId(), 1);
|
||||
} else {
|
||||
MOVE_COUNT.put(p.getUniqueId(), MOVE_COUNT.get(p.getUniqueId()) + 1);
|
||||
if (AntiCheatReloaded.getManager().getCheckManager().checkInWorld(p)
|
||||
&& !AntiCheatReloaded.getManager().getCheckManager().isOpExempt(p)
|
||||
&& !AntiCheatReloaded.getManager().getCheckManager().isExempt(p, CheckType.BLINK)) {
|
||||
if (MOVE_COUNT.get(p.getUniqueId()) > AntiCheatReloaded.getManager().getBackend()
|
||||
.getMagic().BLINK_PACKET()) {
|
||||
EventListener.log(
|
||||
new CheckResult(CheckResult.Result.FAILED, p.getName()
|
||||
+ " failed Blink, sent " + MOVE_COUNT.get(p.getUniqueId())
|
||||
+ " packets in one second (max=" + AntiCheatReloaded.getManager()
|
||||
.getBackend().getMagic().BLINK_PACKET()
|
||||
+ ")").getMessage(),
|
||||
p, CheckType.BLINK);
|
||||
MOVE_COUNT.remove(p.getUniqueId());
|
||||
e.setCancelled(true);
|
||||
e.getPlayer().teleport(cur);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team | http://gravitydevelopment.net
|
||||
* Copyright (c) 2016-2018 Rammelkast | https://rammelkast.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rammelkast.anticheatreloaded.check.movement;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team | http://gravitydevelopment.net
|
||||
* Copyright (c) 2016-2018 Rammelkast | https://rammelkast.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rammelkast.anticheatreloaded.check.movement;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -15,8 +34,7 @@ import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
/**
|
||||
* @author Rammelkast
|
||||
* TODO rewrite this check
|
||||
* @author Rammelkast TODO rewrite this check
|
||||
*/
|
||||
public class FlightCheck {
|
||||
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team | http://gravitydevelopment.net
|
||||
* Copyright (c) 2016-2018 Rammelkast | https://rammelkast.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rammelkast.anticheatreloaded.check.movement;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -21,11 +40,11 @@ import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
public class GlideCheck {
|
||||
|
||||
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
|
||||
|
||||
|
||||
public static Map<UUID, Double> lastDiff = new HashMap<UUID, Double>();
|
||||
public static Map<UUID, Float> lastFallDistance = new HashMap<UUID, Float>();
|
||||
public static Map<UUID, Integer> violations = new HashMap<UUID, Integer>();
|
||||
|
||||
|
||||
public static CheckResult runCheck(Player player, Distance distance) {
|
||||
if (VersionUtil.isFlying(player)) {
|
||||
return PASS;
|
||||
@@ -44,7 +63,8 @@ public class GlideCheck {
|
||||
if (!violations.containsKey(player.getUniqueId())) {
|
||||
violations.put(player.getUniqueId(), 1);
|
||||
} else {
|
||||
if (violations.get(player.getUniqueId()) + 1 >= AntiCheatReloaded.getManager().getBackend().getMagic().GLIDE_LIMIT()) {
|
||||
if (violations.get(player.getUniqueId()) + 1 >= AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.GLIDE_LIMIT()) {
|
||||
violations.remove(player.getUniqueId());
|
||||
Location to = player.getLocation();
|
||||
to.setY(to.getY() - distanceToFall(to));
|
||||
@@ -52,7 +72,8 @@ public class GlideCheck {
|
||||
// Report glide violation to statistics, just for the lulz jk
|
||||
AntiCheatReloaded.getPlugin().onGlideViolation();
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
player.getName() + " was set back for gliding (yDiff=" + new BigDecimal(yDiff).setScale(2, BigDecimal.ROUND_UP) + ")");
|
||||
player.getName() + " was set back for gliding (yDiff="
|
||||
+ new BigDecimal(yDiff).setScale(2, BigDecimal.ROUND_UP) + ")");
|
||||
} else {
|
||||
violations.put(player.getUniqueId(), violations.get(player.getUniqueId()) + 1);
|
||||
}
|
||||
@@ -62,7 +83,7 @@ public class GlideCheck {
|
||||
}
|
||||
lastDiff.put(player.getUniqueId(), distance.getYDifference());
|
||||
lastFallDistance.put(player.getUniqueId(), player.getFallDistance());
|
||||
return PASS;
|
||||
return PASS;
|
||||
}
|
||||
|
||||
private static double distanceToFall(Location location) {
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team | http://gravitydevelopment.net
|
||||
* Copyright (c) 2016-2018 Rammelkast | https://rammelkast.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.rammelkast.anticheatreloaded.check.movement;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team | http://gravitydevelopment.net
|
||||
* Copyright (c) 2016-2018 Rammelkast | https://rammelkast.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rammelkast.anticheatreloaded.check.movement;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -40,9 +59,11 @@ public class WaterWalkCheck {
|
||||
boolean b;
|
||||
if (!Utilities.sprintFly(player)) {
|
||||
b = x > AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_WATER()
|
||||
|| z > AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_WATER();
|
||||
|| z > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.XZ_SPEED_MAX_WATER();
|
||||
} else {
|
||||
b = x > AntiCheatReloaded.getManager().getBackend().getMagic().XZ_SPEED_MAX_WATER_SPRINT()
|
||||
b = x > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.XZ_SPEED_MAX_WATER_SPRINT()
|
||||
|| z > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.XZ_SPEED_MAX_WATER_SPRINT();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,28 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team | http://gravitydevelopment.net
|
||||
* Copyright (c) 2016-2018 Rammelkast | https://rammelkast.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rammelkast.anticheatreloaded.check.movement;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
@@ -52,7 +69,8 @@ public class YAxisCheck {
|
||||
lastYtime.put(uuid, System.currentTimeMillis());
|
||||
} else {
|
||||
if (y1 > lastYcoord.get(uuid)
|
||||
&& yAxisViolations.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXVIOLATIONS()
|
||||
&& yAxisViolations.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.Y_MAXVIOLATIONS()
|
||||
&& (System.currentTimeMillis() - yAxisLastViolation.get(uuid)) < AntiCheatReloaded.getManager()
|
||||
.getBackend().getMagic().Y_MAXVIOTIME()) {
|
||||
Location g = player.getLocation();
|
||||
@@ -68,9 +86,10 @@ public class YAxisCheck {
|
||||
player.getName() + " tried to fly on y-axis " + yAxisViolations.get(uuid) + " times (max ="
|
||||
+ AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXVIOLATIONS() + ")");
|
||||
} else {
|
||||
if (yAxisViolations.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXVIOLATIONS()
|
||||
&& (System.currentTimeMillis() - yAxisLastViolation.get(uuid)) > AntiCheatReloaded.getManager()
|
||||
.getBackend().getMagic().Y_MAXVIOTIME()) {
|
||||
if (yAxisViolations.get(uuid) > AntiCheatReloaded.getManager().getBackend().getMagic()
|
||||
.Y_MAXVIOLATIONS()
|
||||
&& (System.currentTimeMillis() - yAxisLastViolation.get(uuid)) > AntiCheatReloaded
|
||||
.getManager().getBackend().getMagic().Y_MAXVIOTIME()) {
|
||||
yAxisViolations.put(uuid, 0);
|
||||
yAxisLastViolation.put(uuid, 0L);
|
||||
}
|
||||
@@ -78,7 +97,8 @@ public class YAxisCheck {
|
||||
long i = System.currentTimeMillis() - lastYtime.get(uuid);
|
||||
double diff = AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXDIFF()
|
||||
+ (Utilities.isStair(player.getLocation().add(0, -1, 0).getBlock()) ? 0.5 : 0.0);
|
||||
if ((y1 - lastYcoord.get(uuid)) > diff && i < AntiCheatReloaded.getManager().getBackend().getMagic().Y_TIME()) {
|
||||
if ((y1 - lastYcoord.get(uuid)) > diff
|
||||
&& i < AntiCheatReloaded.getManager().getBackend().getMagic().Y_TIME()) {
|
||||
Location g = player.getLocation();
|
||||
yAxisViolations.put(uuid, yAxisViolations.get(uuid) + 1);
|
||||
yAxisLastViolation.put(uuid, System.currentTimeMillis());
|
||||
@@ -91,9 +111,10 @@ public class YAxisCheck {
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + " tried to fly on y-axis in "
|
||||
+ i + " ms (min =" + AntiCheatReloaded.getManager().getBackend().getMagic().Y_TIME() + ")");
|
||||
} else {
|
||||
if ((y1 - lastYcoord.get(uuid)) > AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXDIFF() + 1
|
||||
|| (System.currentTimeMillis() - lastYtime.get(uuid)) > AntiCheatReloaded.getManager().getBackend()
|
||||
.getMagic().Y_TIME()) {
|
||||
if ((y1 - lastYcoord.get(uuid)) > AntiCheatReloaded.getManager().getBackend().getMagic().Y_MAXDIFF()
|
||||
+ 1
|
||||
|| (System.currentTimeMillis() - lastYtime.get(uuid)) > AntiCheatReloaded.getManager()
|
||||
.getBackend().getMagic().Y_TIME()) {
|
||||
lastYtime.put(uuid, System.currentTimeMillis());
|
||||
lastYcoord.put(uuid, y1);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team | http://gravitydevelopment.net
|
||||
* Copyright (c) 2016-2018 Rammelkast | https://rammelkast.com
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rammelkast.anticheatreloaded.check.player;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
Reference in new issue
Block a user