mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-04 14:38:47 +00:00
Cleanup
This commit is contained in:
1 parent
dd8c495ee6
commit
2617aa1225
5 files changed
+14
-19
No files matched your search
@@ -52,7 +52,6 @@ public class AntiCheat extends JavaPlugin {
|
|||||||
private static boolean verbose;
|
private static boolean verbose;
|
||||||
private static boolean developer;
|
private static boolean developer;
|
||||||
private static ProtocolManager protocolManager;
|
private static ProtocolManager protocolManager;
|
||||||
private static boolean protocolLib = false;
|
|
||||||
private static Long loadTime;
|
private static Long loadTime;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -70,21 +69,23 @@ public class AntiCheat extends JavaPlugin {
|
|||||||
setupConfig();
|
setupConfig();
|
||||||
setupEvents();
|
setupEvents();
|
||||||
setupCommands();
|
setupCommands();
|
||||||
setupProtocol();
|
|
||||||
// Enterprise must come before levels
|
// Enterprise must come before levels
|
||||||
setupEnterprise();
|
setupEnterprise();
|
||||||
restoreLevels();
|
restoreLevels();
|
||||||
|
|
||||||
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
|
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
|
||||||
|
setupProtocol();
|
||||||
|
} else {
|
||||||
|
getLogger().severe("Shutting down, ProtocolLib not found!");
|
||||||
|
Bukkit.getPluginManager().disablePlugin(this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
getLogger().info("Found ProtocolLib, enabling checks that use ProtcolLib...");
|
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();
|
||||||
} else {
|
|
||||||
getLogger().severe("Shutting down, ProtocolLib not found!");
|
|
||||||
Bukkit.getPluginManager().disablePlugin(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if other AC's are installed
|
// Check if other AC's are installed
|
||||||
Bukkit.getScheduler().runTaskLater(this, new Runnable() {
|
Bukkit.getScheduler().runTaskLater(this, new Runnable() {
|
||||||
@@ -169,12 +170,9 @@ public class AntiCheat extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setupProtocol() {
|
private void setupProtocol() {
|
||||||
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
|
|
||||||
protocolLib = true;
|
|
||||||
protocolManager = ProtocolLibrary.getProtocolManager();
|
protocolManager = ProtocolLibrary.getProtocolManager();
|
||||||
verboseLog("Hooked into ProtocolLib");
|
verboseLog("Hooked into ProtocolLib");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void setupEvents() {
|
private void setupEvents() {
|
||||||
for (Listener listener : eventList) {
|
for (Listener listener : eventList) {
|
||||||
@@ -240,10 +238,6 @@ public class AntiCheat extends JavaPlugin {
|
|||||||
developer = b;
|
developer = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isUsingProtocolLib() {
|
|
||||||
return protocolLib;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void debugLog(final String string) {
|
public static void debugLog(final String string) {
|
||||||
Bukkit.getScheduler().runTask(getPlugin(), new Runnable() {
|
Bukkit.getScheduler().runTask(getPlugin(), new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|||||||
@@ -39,9 +39,9 @@ public class BlinkCheck {
|
|||||||
public void onPacketReceiving(PacketEvent e) {
|
public void onPacketReceiving(PacketEvent e) {
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
Location cur = e.getPlayer().getLocation();
|
Location cur = e.getPlayer().getLocation();
|
||||||
if (!MOVE_COUNT.containsKey(p.getUniqueId()))
|
if (!MOVE_COUNT.containsKey(p.getUniqueId())) {
|
||||||
MOVE_COUNT.put(p.getUniqueId(), 1);
|
MOVE_COUNT.put(p.getUniqueId(), 1);
|
||||||
else {
|
} else {
|
||||||
MOVE_COUNT.put(p.getUniqueId(), MOVE_COUNT.get(p.getUniqueId()) + 1);
|
MOVE_COUNT.put(p.getUniqueId(), MOVE_COUNT.get(p.getUniqueId()) + 1);
|
||||||
if (AntiCheat.getManager().getCheckManager().checkInWorld(p) && !AntiCheat.getManager().getCheckManager().isOpExempt(p) && !AntiCheat.getManager().getCheckManager().isExempt(p, CheckType.BLINK)) {
|
if (AntiCheat.getManager().getCheckManager().checkInWorld(p) && !AntiCheat.getManager().getCheckManager().isOpExempt(p) && !AntiCheat.getManager().getCheckManager().isExempt(p, CheckType.BLINK)) {
|
||||||
if (MOVE_COUNT.get(p.getUniqueId()) > AntiCheat.getManager().getBackend().getMagic().BLINK_PACKET()) {
|
if (MOVE_COUNT.get(p.getUniqueId()) > AntiCheat.getManager().getBackend().getMagic().BLINK_PACKET()) {
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ import com.rammelkast.anticheatreloaded.util.Utilities;
|
|||||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @author Rammelkast
|
||||||
* @author Marco TODO rewrite this check
|
* TODO rewrite this check
|
||||||
*/
|
*/
|
||||||
public class FlightCheck {
|
public class FlightCheck {
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ public class FlightCheck {
|
|||||||
public static CheckResult runCheck(Player player, Distance distance) {
|
public static CheckResult runCheck(Player player, Distance distance) {
|
||||||
if (distance.getYDifference() > AntiCheat.getManager().getBackend().getMagic().TELEPORT_MIN()
|
if (distance.getYDifference() > AntiCheat.getManager().getBackend().getMagic().TELEPORT_MIN()
|
||||||
|| VersionUtil.isFlying(player)) {
|
|| VersionUtil.isFlying(player)) {
|
||||||
// This was a teleport or user is flying/elyta'ing, so we don't care
|
// This was a teleport or user is flying/using elytra, so we don't care
|
||||||
// about it.
|
// about it.
|
||||||
return PASS;
|
return PASS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ public class GlideCheck {
|
|||||||
Location to = player.getLocation();
|
Location to = player.getLocation();
|
||||||
to.setY(to.getY() - distanceToFall(to));
|
to.setY(to.getY() - distanceToFall(to));
|
||||||
player.teleport(to);
|
player.teleport(to);
|
||||||
|
// Report glide violation to statistics, just for the lulz jk
|
||||||
|
AntiCheat.getPlugin().onGlideViolation();
|
||||||
return new CheckResult(CheckResult.Result.FAILED,
|
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 {
|
} else {
|
||||||
|
|||||||
Reference in new issue
Block a user