This commit is contained in:
Rammelkast committed 2017-05-06 16:00:08 +02:00
1 parent dd8c495ee6
commit 2617aa1225
5 files changed
+17 -22

No files matched your search

@@ -52,7 +52,6 @@ public class AntiCheat extends JavaPlugin {
private static boolean verbose;
private static boolean developer;
private static ProtocolManager protocolManager;
private static boolean protocolLib = false;
private static Long loadTime;
@Override
@@ -70,22 +69,24 @@ public class AntiCheat extends JavaPlugin {
setupConfig();
setupEvents();
setupCommands();
setupProtocol();
// Enterprise must come before levels
setupEnterprise();
restoreLevels();
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
getLogger().info("Found ProtocolLib, enabling checks that use ProtcolLib...");
// Enable packetlisteners
KillAuraCheck.listenPackets();
BlinkCheck.startTimer();
BlinkCheck.listenPackets();
setupProtocol();
} else {
getLogger().severe("Shutting down, ProtocolLib not found!");
Bukkit.getPluginManager().disablePlugin(this);
return;
}
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() {
@@ -169,11 +170,8 @@ public class AntiCheat extends JavaPlugin {
}
private void setupProtocol() {
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
protocolLib = true;
protocolManager = ProtocolLibrary.getProtocolManager();
verboseLog("Hooked into ProtocolLib");
}
protocolManager = ProtocolLibrary.getProtocolManager();
verboseLog("Hooked into ProtocolLib");
}
private void setupEvents() {
@@ -240,10 +238,6 @@ public class AntiCheat extends JavaPlugin {
developer = b;
}
public static boolean isUsingProtocolLib() {
return protocolLib;
}
public static void debugLog(final String string) {
Bukkit.getScheduler().runTask(getPlugin(), new Runnable() {
public void run() {
@@ -25,7 +25,6 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -39,9 +39,9 @@ public class BlinkCheck {
public void onPacketReceiving(PacketEvent e) {
Player p = e.getPlayer();
Location cur = e.getPlayer().getLocation();
if (!MOVE_COUNT.containsKey(p.getUniqueId()))
if (!MOVE_COUNT.containsKey(p.getUniqueId())) {
MOVE_COUNT.put(p.getUniqueId(), 1);
else {
} else {
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 (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;
/**
*
* @author Marco TODO rewrite this check
* @author Rammelkast
* TODO rewrite this check
*/
public class FlightCheck {
@@ -28,7 +28,7 @@ public class FlightCheck {
public static CheckResult runCheck(Player player, Distance distance) {
if (distance.getYDifference() > AntiCheat.getManager().getBackend().getMagic().TELEPORT_MIN()
|| 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.
return PASS;
}
@@ -49,6 +49,8 @@ public class GlideCheck {
Location to = player.getLocation();
to.setY(to.getY() - distanceToFall(to));
player.teleport(to);
// Report glide violation to statistics, just for the lulz jk
AntiCheat.getPlugin().onGlideViolation();
return new CheckResult(CheckResult.Result.FAILED,
player.getName() + " was set back for gliding (yDiff=" + new BigDecimal(yDiff).setScale(2, BigDecimal.ROUND_UP) + ")");
} else {