mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 14:38:56 +00:00
Added NoSlowdown, migrations to new config
This commit is contained in:
1 parent
add3fe5eae
commit
2086a01f80
20 files changed
+288
-243
No files matched your search
@@ -34,7 +34,6 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import com.comphenix.protocol.ProtocolManager;
|
||||
import com.rammelkast.anticheatreloaded.check.packet.MorePacketsCheck;
|
||||
import com.rammelkast.anticheatreloaded.command.CommandHandler;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
import com.rammelkast.anticheatreloaded.event.BlockListener;
|
||||
@@ -89,17 +88,18 @@ public class AntiCheatReloaded extends JavaPlugin {
|
||||
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
|
||||
this.setupProtocol();
|
||||
} else {
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.RED + "Shutting down, ProtocolLib not found!");
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.RED
|
||||
+ "Could not find ProtocolLib. Shutting down!");
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
getLogger().info("NMS version is " + VersionUtil.getVersion());
|
||||
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 not work as expected!");
|
||||
}
|
||||
|
||||
Bukkit.getConsoleSender()
|
||||
.sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.GRAY
|
||||
+ "Running Minecraft version " + VersionUtil.getVersion() + " "
|
||||
+ (VersionUtil.isSupported() ? (ChatColor.GREEN + "(supported)")
|
||||
: (ChatColor.RED + "(NOT SUPPORTED!)")));
|
||||
|
||||
getLogger().info("Enabling packet listeners");
|
||||
PacketListener.listenKeepAlivePackets();
|
||||
PacketListener.listenMovementPackets();
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
* 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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -758,10 +757,6 @@ public class Backend {
|
||||
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + magic.ENTERED_EXITED_TIME());
|
||||
}
|
||||
|
||||
public void logToggleSneak(final Player player) {
|
||||
FlightCheck.MOVING_EXEMPT.put(player.getUniqueId(), System.currentTimeMillis() + magic.SNEAK_TIME());
|
||||
}
|
||||
|
||||
public void logTeleport(final Player player) {
|
||||
manager.getUserManager().getUser(player.getUniqueId()).getMovementManager().lastTeleport = System.currentTimeMillis();
|
||||
/* Data for fly/speed should be reset */
|
||||
|
||||
@@ -46,6 +46,7 @@ public class CriticalsCheck {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static boolean isCritical(Player player) {
|
||||
return player.getFallDistance() > 0.0f && !player.isOnGround() && !player.isInsideVehicle()
|
||||
&& !player.hasPotionEffect(PotionEffectType.BLINDNESS)
|
||||
|
||||
@@ -27,12 +27,10 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.util.MovementManager;
|
||||
import com.rammelkast.anticheatreloaded.util.User;
|
||||
|
||||
public class KillAuraCheck {
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team
|
||||
* Copyright (c) 2016-2020 Rammelkast
|
||||
*
|
||||
* 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;
|
||||
|
||||
public class NoSlowdownCheck {
|
||||
|
||||
}
|
||||
@@ -105,10 +105,14 @@ public class SpeedCheck {
|
||||
// Players can move faster in air with slow falling
|
||||
if (VersionUtil.isSlowFalling(player))
|
||||
predict *= 1.25D;
|
||||
// Prevent NoSlow
|
||||
// TODO better way for this
|
||||
if (player.isBlocking() && movementManager.airTicks > 2)
|
||||
predict *= 0.8D;
|
||||
|
||||
if (distanceXZ - predict > limit) {
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
"moved too fast in air (speed=" + distanceXZ + ", limit=" + predict + ")");
|
||||
"moved too fast in air (speed=" + distanceXZ + ", limit=" + predict + ", blocking=" + player.isBlocking() + ")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,14 +179,19 @@ public class SpeedCheck {
|
||||
limit *= 1.25D;
|
||||
}
|
||||
}
|
||||
// Increased speed when stepping on/off half blocks
|
||||
if (Utilities.isNearBed(movingTowards) || Utilities.couldBeOnHalfblock(movingTowards)
|
||||
|| Utilities.isNearBed(movingTowards.clone().add(0, -0.5, 0)))
|
||||
limit *= 2.0D;
|
||||
// Increased speed when stepping on/off boat
|
||||
if (Utilities.couldBeOnBoat(player))
|
||||
limit += 0.2D;
|
||||
// Prevent NoSlow
|
||||
if (player.isBlocking() && movementManager.groundTicks > 2)
|
||||
limit *= 0.45D;
|
||||
if (distanceXZ - limit > 0) {
|
||||
return new CheckResult(CheckResult.Result.FAILED,
|
||||
"moved too fast on ground (speed=" + distanceXZ + ", limit=" + limit + ")");
|
||||
"moved too fast on ground (speed=" + distanceXZ + ", limit=" + limit + ", blocking=" + player.isBlocking() + ")");
|
||||
}
|
||||
}
|
||||
return PASS;
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.comphenix.protocol.events.PacketEvent;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Checks;
|
||||
import com.rammelkast.anticheatreloaded.config.providers.Magic;
|
||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||
|
||||
@@ -50,7 +51,7 @@ public class MorePacketsCheck {
|
||||
}
|
||||
|
||||
UUID uuid = player.getUniqueId();
|
||||
Magic magic = AntiCheatReloaded.getManager().getConfiguration().getMagic();
|
||||
Checks checksConfig = AntiCheatReloaded.getManager().getConfiguration().getChecks();
|
||||
if (AntiCheatReloaded.getManager().getBackend().isDoing(player, EXEMPT_TIMINGS, -1)) {
|
||||
return;
|
||||
}
|
||||
@@ -61,13 +62,15 @@ public class MorePacketsCheck {
|
||||
long rate = packetTimeNow - lastPacketTime;
|
||||
packetBalance += 50;
|
||||
packetBalance -= rate;
|
||||
if (packetBalance >= magic.MOREPACKETS_TRIGGER_BALANCE()) {
|
||||
int triggerBalance = checksConfig.getInteger(CheckType.MOREPACKETS, "triggerBalance");
|
||||
int minimumClamp = checksConfig.getInteger(CheckType.MOREPACKETS, "minimumClamp");
|
||||
if (packetBalance >= triggerBalance) {
|
||||
int ticks = (int) Math.round(packetBalance / 50);
|
||||
packetBalance = -1 * (magic.MOREPACKETS_TRIGGER_BALANCE() / 2);
|
||||
packetBalance = -1 * (triggerBalance / 2);
|
||||
flag(player, event, "overshot timer by " + ticks + " tick(s)");
|
||||
} else if (packetBalance < -1 * (magic.MOREPACKETS_MINIMUM_CLAMP())) {
|
||||
} else if (packetBalance < -1 * minimumClamp) {
|
||||
// Clamp minimum, 50ms=1tick of lag leniency
|
||||
packetBalance = -1 * (magic.MOREPACKETS_MINIMUM_CLAMP());
|
||||
packetBalance = -1 * minimumClamp;
|
||||
}
|
||||
|
||||
LAST_PACKET_TIME.put(uuid, packetTimeNow);
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.command.executors.CommandCheck;
|
||||
import com.rammelkast.anticheatreloaded.command.executors.CommandChecks;
|
||||
import com.rammelkast.anticheatreloaded.command.executors.CommandHelp;
|
||||
import com.rammelkast.anticheatreloaded.command.executors.CommandLog;
|
||||
import com.rammelkast.anticheatreloaded.command.executors.CommandMute;
|
||||
@@ -41,7 +41,7 @@ public class CommandHandler implements CommandExecutor {
|
||||
|
||||
public CommandHandler() {
|
||||
commands.add(new CommandHelp());
|
||||
commands.add(new CommandCheck());
|
||||
commands.add(new CommandChecks());
|
||||
commands.add(new CommandLog());
|
||||
commands.add(new CommandReload());
|
||||
commands.add(new CommandReport());
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team
|
||||
* Copyright (c) 2016-2020 Rammelkast
|
||||
*
|
||||
* 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.command.executors;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CommandCheck extends CommandBase {
|
||||
|
||||
private static final String NAME = "AntiCheatReloaded Check Management";
|
||||
private static final String COMMAND = "check";
|
||||
private static final String USAGE = "anticheat check [check] [on/off]";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_CHECK;
|
||||
private static final String[] HELP = new String[3];
|
||||
|
||||
static {
|
||||
HELP[0] = GRAY + "Use: " + AQUA + "/anticheat check [check] on" + GRAY + " to enable a check";
|
||||
HELP[1] = GRAY + "Use: " + AQUA + "/anticheat check [check] off" + GRAY + " to disable a check";
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(GRAY + "Checks: ");
|
||||
for (int i=0;i<CheckType.values().length;i++) {
|
||||
builder.append(CheckType.values()[i]);
|
||||
if (i<CheckType.values().length-1) {
|
||||
builder.append(", ");
|
||||
}
|
||||
}
|
||||
HELP[2] = builder.toString();
|
||||
}
|
||||
|
||||
public CommandCheck() {
|
||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void execute(CommandSender cs, String[] args) {
|
||||
if (args.length == 2) {
|
||||
for (CheckType type : CheckType.values()) {
|
||||
if (type.toString().equalsIgnoreCase(args[0]) || type.toString().replaceAll("_", "").equalsIgnoreCase(args[0])) {
|
||||
boolean value = CHECK_MANAGER.isActive(type);
|
||||
|
||||
boolean newValue;
|
||||
if (args[1].equalsIgnoreCase("on") || args[1].equalsIgnoreCase("enable")) {
|
||||
newValue = true;
|
||||
} else if (args[1].equalsIgnoreCase("off") || args[1].equalsIgnoreCase("disable")) {
|
||||
newValue = false;
|
||||
} else {
|
||||
sendHelp(cs);
|
||||
return;
|
||||
}
|
||||
|
||||
String strValue = (newValue ? " activated" : " deactivated");
|
||||
if (value == newValue) {
|
||||
cs.sendMessage(GREEN + type.toString() + " is already" + strValue + "!");
|
||||
} else {
|
||||
if (newValue) {
|
||||
CHECK_MANAGER.activateCheck(type, cs.getName());
|
||||
List<String> checks = CONFIG.getConfig().disabledChecks.getValue();
|
||||
if (checks.contains(type.toString())) {
|
||||
checks.remove(type.toString());
|
||||
CONFIG.getConfig().disabledChecks.setValue(checks);
|
||||
}
|
||||
} else {
|
||||
CHECK_MANAGER.deactivateCheck(type, cs.getName());
|
||||
List<String> checks = CONFIG.getConfig().disabledChecks.getValue();
|
||||
checks.add(type.toString());
|
||||
CONFIG.getConfig().disabledChecks.setValue(checks);
|
||||
}
|
||||
cs.sendMessage(GREEN + type.toString() + strValue + ".");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
sendHelp(cs);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* AntiCheatReloaded for Bukkit and Spigot.
|
||||
* Copyright (c) 2012-2015 AntiCheat Team
|
||||
* Copyright (c) 2016-2020 Rammelkast
|
||||
*
|
||||
* 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.command.executors;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.command.CommandBase;
|
||||
import com.rammelkast.anticheatreloaded.util.Permission;
|
||||
|
||||
public class CommandChecks extends CommandBase {
|
||||
|
||||
private static final String NAME = "AntiCheatReloaded Checks Management";
|
||||
private static final String COMMAND = "checks";
|
||||
private static final String USAGE = "anticheat checks";
|
||||
private static final Permission PERMISSION = Permission.SYSTEM_CHECK;
|
||||
private static final String[] HELP = new String[2];
|
||||
|
||||
static {
|
||||
HELP[0] = GRAY + "Use: " + AQUA + "/anticheat checks" + GRAY + " for a list of checks";
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(GRAY + "Checks: ");
|
||||
for (int i=0;i<CheckType.values().length;i++) {
|
||||
builder.append(CheckType.values()[i]);
|
||||
if (i<CheckType.values().length-1) {
|
||||
builder.append(", ");
|
||||
}
|
||||
}
|
||||
HELP[1] = builder.toString();
|
||||
}
|
||||
|
||||
public CommandChecks() {
|
||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void execute(CommandSender cs, String[] args) {
|
||||
sendHelp(cs);
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ public class CommandHelp extends CommandBase {
|
||||
GOLD + "/acr " + GRAY + "reload",
|
||||
GOLD + "/acr " + GRAY + "version",
|
||||
GOLD + "/acr " + GRAY + "mute",
|
||||
GOLD + "/acr " + GRAY + "check " + WHITE + "[check] [on/off]",
|
||||
GOLD + "/acr " + GRAY + "checks",
|
||||
GOLD + "/acr " + GRAY + "log " + WHITE + "[file/console] [on/off]",
|
||||
GOLD + "/acr " + GRAY + "report " + WHITE + "[group/user]",
|
||||
GOLD + "/acr " + GRAY + "reset " + WHITE + "[user]",
|
||||
|
||||
@@ -49,7 +49,6 @@ public class Config extends ConfigurationFile {
|
||||
public ConfigValue<Boolean> logToFile;
|
||||
|
||||
public ConfigValue<List<String>> disabledWorlds;
|
||||
public ConfigValue<List<String>> disabledChecks;
|
||||
|
||||
public ConfigValue<Integer> notifyEveryVl;
|
||||
|
||||
@@ -81,7 +80,6 @@ public class Config extends ConfigurationFile {
|
||||
logToFile = new ConfigValue<Boolean>("system.log-to-file");
|
||||
|
||||
disabledWorlds = new ConfigValue<List<String>>("disable-in");
|
||||
disabledChecks = new ConfigValue<List<String>>("disabled-checks");
|
||||
|
||||
notifyEveryVl = new ConfigValue<Integer>("system.notify-every-vl");
|
||||
if (notifyEveryVl.getValue() < 1) {
|
||||
|
||||
+10
-2
@@ -18,6 +18,9 @@
|
||||
*/
|
||||
package com.rammelkast.anticheatreloaded.config.holders.yaml;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.config.Configuration;
|
||||
@@ -78,8 +81,13 @@ public class YamlChecksHolder extends ConfigurationFile implements Checks {
|
||||
@Override
|
||||
public boolean isEnabled(CheckType checkType) {
|
||||
// If the root of a check has no enabled or disabled option, it has to be configured on a subcheck basis
|
||||
if (!this.getConfigFile().getConfigurationSection(checkType.name().toLowerCase()).contains("enabled"))
|
||||
if (!this.getConfigFile().isConfigurationSection(checkType.getName().toLowerCase())) {
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.RED
|
||||
+ "Missing configuration settings for " + checkType.getName() + "!");
|
||||
return true;
|
||||
return this.getConfigFile().getConfigurationSection(checkType.name().toLowerCase()).getBoolean("enabled");
|
||||
}
|
||||
if (!this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).contains("enabled"))
|
||||
return true;
|
||||
return this.getConfigFile().getConfigurationSection(checkType.getName().toLowerCase()).getBoolean("enabled");
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,6 @@ import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.check.player.IllegalInteract;
|
||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
|
||||
public class BlockListener extends EventListener {
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
@@ -47,14 +48,17 @@ public class CheckManager {
|
||||
this.manager = manager;
|
||||
this.config = manager.getConfiguration();
|
||||
|
||||
for (String string : config.getConfig().disabledChecks.getValue()) {
|
||||
for (CheckType type : CheckType.values()) {
|
||||
if (type.toString().equalsIgnoreCase(string)) {
|
||||
checkIgnoreList.add(type);
|
||||
break;
|
||||
}
|
||||
for (CheckType type : CheckType.values()) {
|
||||
if (!config.getChecks().isEnabled(type)) {
|
||||
checkIgnoreList.add(type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!checkIgnoreList.isEmpty()) {
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "ACR " + ChatColor.DARK_GRAY + "> " + ChatColor.GRAY
|
||||
+ checkIgnoreList.size() + " check(s) have been disabled");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,12 +18,7 @@
|
||||
*/
|
||||
package com.rammelkast.anticheatreloaded.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class MovementManager {
|
||||
@@ -69,6 +64,7 @@ public class MovementManager {
|
||||
// Elytra effect ticks
|
||||
public int elytraEffectTicks;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void handle(Player player, Location from, Location to, Distance distance) {
|
||||
this.onGround = player.isOnGround(); // TODO temp solution, can be spoofed
|
||||
|
||||
|
||||
@@ -32,46 +32,49 @@ public class PacketListener {
|
||||
|
||||
public static void listenMovementPackets() {
|
||||
AntiCheatReloaded.getProtocolManager()
|
||||
.addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.LOWEST,
|
||||
new PacketType[] { PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK, PacketType.Play.Server.POSITION }) {
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
// Run MorePackets check
|
||||
MorePacketsCheck.runCheck(player, event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
// Run BadPackets check
|
||||
BadPacketsCheck.runCheck(player, event);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketSending(PacketEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
// Compensate for teleport
|
||||
MorePacketsCheck.compensate(player);
|
||||
}
|
||||
});
|
||||
.addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.LOWEST,
|
||||
new PacketType[] { PacketType.Play.Client.POSITION, PacketType.Play.Client.POSITION_LOOK,
|
||||
PacketType.Play.Server.POSITION }) {
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
// Run MorePackets check
|
||||
MorePacketsCheck.runCheck(player, event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
// Run BadPackets check
|
||||
BadPacketsCheck.runCheck(player, event);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketSending(PacketEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
// Compensate for teleport
|
||||
MorePacketsCheck.compensate(player);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public static void listenKeepAlivePackets() {
|
||||
AntiCheatReloaded.getProtocolManager()
|
||||
.addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.LOWEST,
|
||||
new PacketType[] { PacketType.Play.Client.KEEP_ALIVE, PacketType.Play.Server.KEEP_ALIVE }) {
|
||||
@Override
|
||||
public void onPacketSending(PacketEvent event) {
|
||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(event.getPlayer().getUniqueId());
|
||||
user.onServerPing();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent event) {
|
||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(event.getPlayer().getUniqueId());
|
||||
user.onClientPong();
|
||||
}
|
||||
});
|
||||
.addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(), ListenerPriority.LOWEST,
|
||||
new PacketType[] { PacketType.Play.Client.KEEP_ALIVE, PacketType.Play.Server.KEEP_ALIVE }) {
|
||||
@Override
|
||||
public void onPacketSending(PacketEvent event) {
|
||||
User user = AntiCheatReloaded.getManager().getUserManager()
|
||||
.getUser(event.getPlayer().getUniqueId());
|
||||
user.onServerPing();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPacketReceiving(PacketEvent event) {
|
||||
User user = AntiCheatReloaded.getManager().getUserManager()
|
||||
.getUser(event.getPlayer().getUniqueId());
|
||||
user.onClientPong();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1250,7 +1250,6 @@ public enum XMaterial {
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@SuppressWarnings("UnstableApiUsage")
|
||||
private static final ImmutableMap<XMaterial, XMaterial> duplicated = Maps.immutableEnumMap(ImmutableMap.<XMaterial, XMaterial>builder()
|
||||
.put(MELON, MELON_SLICE)
|
||||
.put(CARROT, CARROTS)
|
||||
@@ -1906,7 +1905,6 @@ public enum XMaterial {
|
||||
* @return data of this material, or 0 if none.
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public byte getData() {
|
||||
return data;
|
||||
}
|
||||
@@ -1974,7 +1972,6 @@ public enum XMaterial {
|
||||
* @return the material related to this XMaterial based on the server version.
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@SuppressWarnings("OptionalAssignedToNull")
|
||||
@Nullable
|
||||
public Material parseMaterial(boolean suggest) {
|
||||
Optional<Material> cache = PARSED_CACHE.getIfPresent(this);
|
||||
|
||||
Reference in new issue
Block a user