mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 14:38:56 +00:00
Updated to 1.15, fixed issues and made changes to some checks
This commit is contained in:
1 parent
0428c4796a
commit
0963458be5
18 files changed
+275
-501
No files matched your search
@@ -323,4 +323,8 @@ public class AntiCheatReloaded extends JavaPlugin {
|
||||
this.glideViolations++;
|
||||
}
|
||||
|
||||
public static void sendToMainThread(Runnable runnable) {
|
||||
Bukkit.getServer().getScheduler().runTask(AntiCheatReloaded.getPlugin(), runnable);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package com.rammelkast.anticheatreloaded.check;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -262,7 +263,7 @@ public class Backend {
|
||||
}
|
||||
|
||||
public CheckResult checkYSpeed(Player player, double y) {
|
||||
if (!isMovingExempt(player) && !player.isInsideVehicle() && !player.isSleeping() && (y > (VersionUtil.isNewYSpeed() ? magic.Y_SPEED_MAX() + 0.05 : magic.Y_SPEED_MAX())) && !isDoing(player, velocitized, magic.VELOCITY_TIME()) && !player.hasPotionEffect(PotionEffectType.JUMP) && !VersionUtil.isFlying(player)) {
|
||||
if (!isMovingExempt(player) && !player.isInsideVehicle() && !player.isSleeping() && (y > magic.Y_SPEED_MAX()) && !isDoing(player, velocitized, magic.VELOCITY_TIME()) && !player.hasPotionEffect(PotionEffectType.JUMP) && !VersionUtil.isFlying(player)) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, player.getName() + "'s y speed was too high (speed=" + y + ", max=" + magic.Y_SPEED_MAX() + ")");
|
||||
} else {
|
||||
return PASS;
|
||||
@@ -432,7 +433,7 @@ public class Backend {
|
||||
public CheckResult checkSwing(Player player, Block block) {
|
||||
UUID uuid = player.getUniqueId();
|
||||
if (!isInstantBreakExempt(player)) {
|
||||
if (!VersionUtil.getItemInHand(player).containsEnchantment(Enchantment.DIG_SPEED) && !(VersionUtil.getItemInHand(player).getType() == Material.SHEARS && block.getType() == Material.LEAVES)) {
|
||||
if (!VersionUtil.getItemInHand(player).containsEnchantment(Enchantment.DIG_SPEED) && !(VersionUtil.getItemInHand(player).getType() == Material.SHEARS && block.getType().name().endsWith("LEAVES"))) {
|
||||
if (blockPunches.get(uuid) != null && player.getGameMode() != GameMode.CREATIVE) {
|
||||
int i = blockPunches.get(uuid);
|
||||
if (i < magic.BLOCK_PUNCH_MIN()) {
|
||||
@@ -584,7 +585,21 @@ public class Backend {
|
||||
user.addMessage(msg);
|
||||
return PASS;
|
||||
}
|
||||
|
||||
public CheckResult checkChatUnicode(Player player, String msg) {
|
||||
UUID uuid = player.getUniqueId();
|
||||
User user = manager.getUserManager().getUser(uuid);
|
||||
if (!isPureAscii(msg)) {
|
||||
return new CheckResult(CheckResult.Result.FAILED, "Unicode chat is not allowed.");
|
||||
}
|
||||
user.addMessage(msg);
|
||||
return PASS;
|
||||
}
|
||||
|
||||
private boolean isPureAscii(String v) {
|
||||
return StandardCharsets.US_ASCII.newEncoder().canEncode(v.replaceAll("¡", "!").replaceAll("¿", "?"));
|
||||
}
|
||||
|
||||
public CheckResult checkCommandSpam(Player player, String cmd) {
|
||||
UUID uuid = player.getUniqueId();
|
||||
User user = manager.getUserManager().getUser(uuid);
|
||||
|
||||
@@ -64,8 +64,9 @@ public enum CheckType {
|
||||
AUTOTOOL(Permission.CHECK_AUTOTOOL),
|
||||
KILLAURA(Permission.CHECK_KILLAURA),
|
||||
BLINK(Permission.CHECK_BLINK),
|
||||
VELOCITY(Permission.VELOCITY),
|
||||
CRITICALS(Permission.CRITICALS);
|
||||
VELOCITY(Permission.CHECK_VELOCITY),
|
||||
CRITICALS(Permission.CHECK_CRITICALS),
|
||||
CHAT_UNICODE(Permission.CHECK_UNICODE);
|
||||
|
||||
private final Permission permission;
|
||||
private final Map<UUID, Integer> level = new HashMap<UUID, Integer>();
|
||||
|
||||
@@ -19,42 +19,28 @@
|
||||
|
||||
package com.rammelkast.anticheatreloaded.check.combat;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.events.ListenerPriority;
|
||||
import com.comphenix.protocol.events.PacketAdapter;
|
||||
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.event.EventListener;
|
||||
import com.rammelkast.anticheatreloaded.util.NPC_1_12;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
/**
|
||||
* @author Rammelkast
|
||||
*/
|
||||
@Deprecated
|
||||
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>();
|
||||
//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_12_R1")) {
|
||||
/*if (!VersionUtil.getVersion().equals("v1_12_R1")) {
|
||||
return;
|
||||
}
|
||||
NPC_LIST.remove(p.getUniqueId());
|
||||
NPC_LIST.remove(p.getUniqueId());*/
|
||||
}
|
||||
|
||||
public static void listenPackets() {
|
||||
if (!VersionUtil.getVersion().equals("v1_12_R1")) {
|
||||
/*if (!VersionUtil.getVersion().equals("v1_12_R1")) {
|
||||
return;
|
||||
}
|
||||
AntiCheatReloaded.getProtocolManager().addPacketListener(new PacketAdapter(AntiCheatReloaded.getPlugin(),
|
||||
@@ -86,11 +72,11 @@ public class KillAuraCheck {
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});*/
|
||||
}
|
||||
|
||||
public static void doDamageEvent(EntityDamageByEntityEvent e, Player p) {
|
||||
if (!VersionUtil.getVersion().equals("v1_12_R1")) {
|
||||
/*if (!VersionUtil.getVersion().equals("v1_12_R1")) {
|
||||
return;
|
||||
}
|
||||
if (NPC_LIST.containsKey(p.getUniqueId()))
|
||||
@@ -99,16 +85,16 @@ public class KillAuraCheck {
|
||||
NPC_1_12 npc = new NPC_1_12(p);
|
||||
NPC_LIST.put(p.getUniqueId(), npc);
|
||||
npc.spawn();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public static void doMove(PlayerMoveEvent e) {
|
||||
if (!VersionUtil.getVersion().equals("v1_12_R1")) {
|
||||
/*if (!VersionUtil.getVersion().equals("v1_12_R1")) {
|
||||
return;
|
||||
}
|
||||
if (NPC_LIST.containsKey(e.getPlayer().getUniqueId())) {
|
||||
NPC_LIST.get(e.getPlayer().getUniqueId()).move(e);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
@@ -35,6 +36,7 @@ import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.event.EventListener;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
/**
|
||||
* @author Rammelkast
|
||||
@@ -49,7 +51,7 @@ public class BlinkCheck {
|
||||
public void run() {
|
||||
MOVE_COUNT.clear();
|
||||
}
|
||||
}.runTaskTimer(AntiCheatReloaded.getPlugin(), 20, 20);
|
||||
}.runTaskTimer(AntiCheatReloaded.getPlugin(), 100, 20);
|
||||
}
|
||||
|
||||
public static void listenPackets() {
|
||||
@@ -67,18 +69,35 @@ public class BlinkCheck {
|
||||
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);
|
||||
int ping = VersionUtil.getPlayerPing(p);
|
||||
int blinkMagic = AntiCheatReloaded.getManager().getBackend()
|
||||
.getMagic().BLINK_PACKET();
|
||||
float pingLeniency = (float) ((ping / 150));
|
||||
if (pingLeniency < 1) pingLeniency = 1;
|
||||
if (pingLeniency > 3) pingLeniency = 3;
|
||||
blinkMagic = Math.round(pingLeniency * blinkMagic);
|
||||
final float finalPingLeniency = pingLeniency;
|
||||
try {
|
||||
if (MOVE_COUNT.get(p.getUniqueId()) > blinkMagic) {
|
||||
final int packets = MOVE_COUNT.get(p.getUniqueId());
|
||||
MOVE_COUNT.remove(p.getUniqueId());
|
||||
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
EventListener.log(
|
||||
new CheckResult(CheckResult.Result.FAILED, p.getName()
|
||||
+ " failed Blink, sent " + packets
|
||||
+ " packets in one second (max=" + AntiCheatReloaded.getManager()
|
||||
.getBackend().getMagic().BLINK_PACKET()
|
||||
+ ", leniency=" + finalPingLeniency + ", ping=" + ping + ")").getMessage(),
|
||||
p, CheckType.BLINK);
|
||||
e.setCancelled(true);
|
||||
e.getPlayer().teleport(cur);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (NullPointerException nullPointer) {
|
||||
// TODO this is thrown sometimes, might have something to do with line 83
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,16 +40,17 @@ public class ElytraCheck {
|
||||
// This was a teleport, so skip check.
|
||||
return PASS;
|
||||
}
|
||||
if (!FlightCheck.isMovingExempt(player) && !Utilities.isHoveringOverWater(player.getLocation(), 1)
|
||||
/*if (!FlightCheck.isMovingExempt(player) && !Utilities.isHoveringOverWater(player.getLocation(), 1)
|
||||
&& Utilities.cantStandAtExp(player.getLocation())
|
||||
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
|
||||
new Material[] { Material.FENCE, Material.FENCE_GATE, Material.COBBLE_WALL,
|
||||
Material.ACACIA_FENCE, Material.ACACIA_FENCE_GATE, Material.BIRCH_FENCE,
|
||||
Material.BIRCH_FENCE_GATE, Material.DARK_OAK_FENCE, Material.DARK_OAK_FENCE_GATE,
|
||||
Material.IRON_FENCE, Material.JUNGLE_FENCE, Material.JUNGLE_FENCE_GATE,
|
||||
Material.NETHER_FENCE, Material.SPRUCE_FENCE, Material.SPRUCE_FENCE_GATE, Material.IRON_BARDING })) {
|
||||
Material.fence, Material.SPRUCE_FENCE, Material.SPRUCE_FENCE_GATE, Material.IRON_BARS })) {
|
||||
|
||||
}
|
||||
}*/
|
||||
//TODO 1.15 update
|
||||
|
||||
return PASS;
|
||||
}
|
||||
|
||||
@@ -56,11 +56,11 @@ public class FlightCheck {
|
||||
if (!isMovingExempt(player) && !Utilities.isHoveringOverWater(player.getLocation(), 1)
|
||||
&& Utilities.cantStandAtExp(player.getLocation())
|
||||
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN),
|
||||
new Material[] { Material.FENCE, Material.FENCE_GATE, Material.COBBLE_WALL,
|
||||
Material.ACACIA_FENCE, Material.ACACIA_FENCE_GATE, Material.BIRCH_FENCE,
|
||||
Material.BIRCH_FENCE_GATE, Material.DARK_OAK_FENCE, Material.DARK_OAK_FENCE_GATE,
|
||||
Material.IRON_FENCE, Material.JUNGLE_FENCE, Material.JUNGLE_FENCE_GATE,
|
||||
Material.NETHER_FENCE, Material.SPRUCE_FENCE, Material.SPRUCE_FENCE_GATE, Material.IRON_BARDING })) {
|
||||
new Material[] { Material.IRON_BARS })
|
||||
&& Utilities.blockIsnt(player.getLocation().getBlock().getRelative(BlockFace.DOWN), new String[] {
|
||||
"FENCE",
|
||||
"FENCE_GATE"
|
||||
})) {
|
||||
|
||||
if (!blocksOverFlight.containsKey(uuid)) {
|
||||
blocksOverFlight.put(uuid, 0D);
|
||||
|
||||
@@ -24,17 +24,13 @@ 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.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.Backend;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.util.Distance;
|
||||
import com.rammelkast.anticheatreloaded.util.Utilities;
|
||||
import com.rammelkast.anticheatreloaded.util.VersionUtil;
|
||||
|
||||
public class GlideCheck {
|
||||
@@ -49,6 +45,9 @@ public class GlideCheck {
|
||||
if (VersionUtil.isFlying(player)) {
|
||||
return PASS;
|
||||
}
|
||||
if (player.getLocation().getBlock().getType() == Material.LADDER || player.getLocation().getBlock().getRelative(0, 1, 0).getType() == Material.LADDER) {
|
||||
return PASS;
|
||||
}
|
||||
if (!lastDiff.containsKey(player.getUniqueId())) {
|
||||
lastDiff.put(player.getUniqueId(), distance.getYDifference());
|
||||
return PASS;
|
||||
|
||||
@@ -69,7 +69,7 @@ public class WaterWalkCheck {
|
||||
}
|
||||
if (!b && !Utilities.isFullyInWater(player.getLocation())
|
||||
&& Utilities.isHoveringOverWater(player.getLocation(), 1) && y == 0D
|
||||
&& !block.getType().equals(Material.WATER_LILY)) {
|
||||
&& !block.getType().equals(Material.LILY_PAD)) {
|
||||
b = true;
|
||||
}
|
||||
if (b) {
|
||||
|
||||
@@ -126,7 +126,8 @@ public class YAxisCheck {
|
||||
}
|
||||
|
||||
public static boolean isMoveUpBlock(Block block) {
|
||||
return VersionUtil.getMoveUpBlocks().contains(block.getType());
|
||||
Material type = block.getType();
|
||||
return type.name().endsWith("STAIRS"); // TODO slabs/others?
|
||||
}
|
||||
|
||||
}
|
||||
@@ -55,7 +55,6 @@ import org.bukkit.inventory.PlayerInventory;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckResult;
|
||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.FlightCheck;
|
||||
import com.rammelkast.anticheatreloaded.check.movement.GlideCheck;
|
||||
@@ -176,7 +175,26 @@ public class PlayerListener extends EventListener {
|
||||
player.sendMessage(ChatColor.RED + result.getMessage());
|
||||
}
|
||||
getBackend().processChatSpammer(player);
|
||||
log(null, player, CheckType.CHAT_SPAM);
|
||||
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
log(null, player, CheckType.CHAT_SPAM);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (getCheckManager().willCheck(player, CheckType.CHAT_UNICODE)) {
|
||||
CheckResult result = getBackend().checkChatUnicode(player, event.getMessage());
|
||||
if (result.failed()) {
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(ChatColor.RED + result.getMessage());
|
||||
AntiCheatReloaded.sendToMainThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
log(null, player, CheckType.CHAT_UNICODE);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,10 +243,9 @@ public class PlayerListener extends EventListener {
|
||||
Player player = event.getPlayer();
|
||||
PlayerInventory inv = player.getInventory();
|
||||
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
Material m = inv.getItemInHand().getType();
|
||||
if (m == Material.BOW) {
|
||||
if (inv.getItemInMainHand().getType() == Material.BOW) {
|
||||
getBackend().logBowWindUp(player);
|
||||
} else if (Utilities.isFood(m)) {
|
||||
} else if (Utilities.isFood(inv.getItemInMainHand().getType()) || Utilities.isFood(inv.getItemInOffHand().getType())) {
|
||||
getBackend().logEatingStart(player);
|
||||
}
|
||||
}
|
||||
@@ -258,7 +275,7 @@ public class PlayerListener extends EventListener {
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlayerEnterBed(PlayerBedEnterEvent event) {
|
||||
if (event.getBed().getType() != Material.BED) return;
|
||||
if (event.getBed().getType().name().endsWith("BED")) return;
|
||||
getBackend().logEnterExit(event.getPlayer());
|
||||
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
@@ -266,7 +283,7 @@ public class PlayerListener extends EventListener {
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlayerExitBed(PlayerBedLeaveEvent event) {
|
||||
if (event.getBed().getType() != Material.BED) return;
|
||||
if (event.getBed().getType().name().endsWith("BED")) return;
|
||||
getBackend().logEnterExit(event.getPlayer());
|
||||
|
||||
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
|
||||
@@ -301,7 +318,7 @@ public class PlayerListener extends EventListener {
|
||||
if (player.hasMetadata(Utilities.SPY_METADATA)) {
|
||||
for (Player p : player.getServer().getOnlinePlayers()) {
|
||||
if (!Permission.SYSTEM_SPY.get(p)) {
|
||||
p.hidePlayer(player);
|
||||
p.hidePlayer(AntiCheatReloaded.getPlugin(), player);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -323,7 +340,8 @@ public class PlayerListener extends EventListener {
|
||||
final User user = getUserManager().getUser(player.getUniqueId());
|
||||
user.setTo(to.getX(), to.getY(), to.getZ());
|
||||
|
||||
KillAuraCheck.doMove(event);
|
||||
//KillAuraCheck.doMove(event);
|
||||
//TODO
|
||||
|
||||
if (getCheckManager().willCheckQuick(player, CheckType.SPRINT)) {
|
||||
CheckResult result = getBackend().checkSprintStill(player, from, to);
|
||||
@@ -446,7 +464,8 @@ public class PlayerListener extends EventListener {
|
||||
|
||||
@EventHandler(priority=EventPriority.HIGHEST)
|
||||
public void onDeath(PlayerDeathEvent e) {
|
||||
KillAuraCheck.cleanPlayer(e.getEntity()); // Remove bots on death to reduce lag
|
||||
//KillAuraCheck.cleanPlayer(e.getEntity()); // Remove bots on death to reduce lag
|
||||
//TODO
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* 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.util;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class NMS_1_9_PLUS {
|
||||
|
||||
static final EnumSet<Material> MOVE_UP_BLOCKS_1_9 = EnumSet.of(Material.ACACIA_STAIRS, Material.BIRCH_WOOD_STAIRS,
|
||||
Material.BRICK_STAIRS, Material.COBBLESTONE_STAIRS, Material.DARK_OAK_STAIRS, Material.JUNGLE_WOOD_STAIRS,
|
||||
Material.NETHER_BRICK_STAIRS, Material.QUARTZ_STAIRS, Material.RED_SANDSTONE_STAIRS,
|
||||
Material.SANDSTONE_STAIRS, Material.SMOOTH_STAIRS, Material.SPRUCE_WOOD_STAIRS, Material.WOOD_STAIRS,
|
||||
Material.PURPUR_STAIRS);
|
||||
|
||||
static final PotionEffectType LEVITATION = PotionEffectType.LEVITATION;
|
||||
|
||||
static final Enchantment FROST_WALKER = Enchantment.FROST_WALKER;
|
||||
|
||||
public static ItemStack getItemInHand(Player player) {
|
||||
return player.getInventory().getItemInMainHand();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,244 +0,0 @@
|
||||
/*
|
||||
* 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.util;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||
|
||||
import net.minecraft.server.v1_12_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_12_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_12_R1.EnumItemSlot;
|
||||
import net.minecraft.server.v1_12_R1.MinecraftServer;
|
||||
import net.minecraft.server.v1_12_R1.PacketPlayOutEntityMetadata;
|
||||
import net.minecraft.server.v1_12_R1.PacketPlayOutEntityTeleport;
|
||||
import net.minecraft.server.v1_12_R1.PacketPlayOutNamedEntitySpawn;
|
||||
import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerInfo;
|
||||
import net.minecraft.server.v1_12_R1.PlayerConnection;
|
||||
import net.minecraft.server.v1_12_R1.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_12_R1.World;
|
||||
import net.minecraft.server.v1_12_R1.WorldServer;
|
||||
|
||||
public class NPC_1_12 {
|
||||
|
||||
private final UUID owner;
|
||||
private final String name;
|
||||
private UUID uuid;
|
||||
private EntityPlayer npc;
|
||||
private int entityId;
|
||||
private Location location;
|
||||
|
||||
public int getID() {
|
||||
return this.entityId;
|
||||
}
|
||||
|
||||
public NPC_1_12(Player owner) {
|
||||
this.owner = owner.getUniqueId();
|
||||
this.name = NameGenerator.generateName();
|
||||
Location eyelocation = owner.getEyeLocation();
|
||||
Vector vec = owner.getLocation().getDirection();
|
||||
vec.setX(-3 * vec.getX());
|
||||
vec.setZ(-3 * vec.getZ());
|
||||
Location back = eyelocation.add(vec);
|
||||
this.location = back; // TODO
|
||||
}
|
||||
|
||||
public void spawn() {
|
||||
final MinecraftServer nmsServer = ((CraftServer) Bukkit.getServer()).getServer();
|
||||
final WorldServer nmsWorld = ((CraftWorld) this.getOwner().getWorld()).getHandle();
|
||||
this.uuid = UUID.randomUUID();
|
||||
(this.npc = new EntityPlayer(nmsServer, nmsWorld, new GameProfile(this.uuid, this.name),
|
||||
new PlayerInteractManager((World) nmsWorld))).setLocation(this.location.getX(), this.location.getY(),
|
||||
this.location.getZ(), 0.0f, 0.0f);
|
||||
this.npc.collides = false;
|
||||
this.npc.setInvisible(true);
|
||||
this.npc.setEquipment(EnumItemSlot.CHEST,
|
||||
AntiCheatReloaded.getRandom().nextBoolean()
|
||||
? CraftItemStack.asNMSCopy(new ItemStack(Material.DIAMOND_CHESTPLATE))
|
||||
: CraftItemStack.asNMSCopy(new ItemStack(Material.CHAINMAIL_CHESTPLATE)));
|
||||
this.npc.setEquipment(EnumItemSlot.FEET,
|
||||
AntiCheatReloaded.getRandom().nextBoolean()
|
||||
? CraftItemStack.asNMSCopy(new ItemStack(Material.CHAINMAIL_BOOTS))
|
||||
: CraftItemStack.asNMSCopy(new ItemStack(Material.DIAMOND_BOOTS)));
|
||||
this.entityId = this.npc.getId();
|
||||
final PlayerConnection connection = ((CraftPlayer) this.getOwner()).getHandle().playerConnection;
|
||||
connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER,
|
||||
new EntityPlayer[] { this.npc }));
|
||||
connection.sendPacket(new PacketPlayOutNamedEntitySpawn((EntityHuman) this.npc));
|
||||
}
|
||||
|
||||
public boolean up = true;
|
||||
|
||||
public void move(PlayerMoveEvent e) {
|
||||
if (e.getTo().getPitch() <= -32.5) {
|
||||
if (e.getTo().getPitch() <= -82.5) {
|
||||
Location eyelocation = e.getPlayer().getEyeLocation();
|
||||
Vector vec = e.getPlayer().getLocation().getDirection();
|
||||
vec.setX(-3 * vec.getX());
|
||||
vec.setY(e.getPlayer().getLocation().getY() - 8.25);
|
||||
vec.setZ(-3 * vec.getZ());
|
||||
Location back = eyelocation.add(vec);
|
||||
this.location = back; // TODO
|
||||
this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(),
|
||||
(float) new Random().nextFloat() * 20, (float) new Random().nextFloat() * 20);
|
||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection
|
||||
.sendPacket(new PacketPlayOutEntityTeleport(npc));
|
||||
if (new Random().nextInt(50) == 25 && this.npc.isInvisible()) {
|
||||
this.npc.setInvisible(false);
|
||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection
|
||||
.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (NPC_1_12.this.npc == null || NPC_1_12.this.getOwner() == null) {
|
||||
return;
|
||||
}
|
||||
npc.setInvisible(true);
|
||||
((CraftPlayer) getOwner()).getHandle().playerConnection
|
||||
.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||
}
|
||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 4);
|
||||
}
|
||||
} else {
|
||||
Location eyelocation = e.getPlayer().getEyeLocation();
|
||||
Vector vec = e.getPlayer().getLocation().getDirection();
|
||||
vec.setX(-3 * vec.getX());
|
||||
vec.setY(e.getPlayer().getLocation().getY());
|
||||
vec.setZ(-3 * vec.getZ());
|
||||
Location back = eyelocation.add(vec);
|
||||
this.location = back; // TODO
|
||||
this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(),
|
||||
(float) new Random().nextFloat() * 20, (float) new Random().nextFloat() * 20);
|
||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection
|
||||
.sendPacket(new PacketPlayOutEntityTeleport(npc));
|
||||
}
|
||||
} else if (e.getTo().getPitch() >= 22) {
|
||||
Location eyelocation = e.getPlayer().getEyeLocation();
|
||||
Vector vec = e.getPlayer().getLocation().getDirection();
|
||||
vec.setX(-3 * vec.getX());
|
||||
vec.setY(e.getPlayer().getLocation().getY() - 0.4);
|
||||
vec.setZ(-3 * vec.getZ());
|
||||
Location back = eyelocation.add(vec);
|
||||
this.location = back; // TODO
|
||||
this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float) new Random().nextFloat() * 20,
|
||||
(float) new Random().nextFloat() * 20);
|
||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection
|
||||
.sendPacket(new PacketPlayOutEntityTeleport(npc));
|
||||
} else {
|
||||
Location eyelocation = e.getPlayer().getEyeLocation();
|
||||
Vector vec = e.getPlayer().getLocation().getDirection();
|
||||
vec.setX(-1.95 * vec.getX());
|
||||
if (up)
|
||||
vec.setY(vec.getY() + 0.5);
|
||||
else
|
||||
vec.setY(vec.getY() - 0.25);
|
||||
if (new Random().nextInt(10) == 5)
|
||||
up = !up;
|
||||
vec.setZ(-1.95 * vec.getZ());
|
||||
Location back = eyelocation.add(vec);
|
||||
this.location = back; // TODO
|
||||
this.npc.setPositionRotation(back.getX(), back.getY(), back.getZ(), (float) new Random().nextFloat() * 20,
|
||||
(float) new Random().nextFloat() * 20);
|
||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection
|
||||
.sendPacket(new PacketPlayOutEntityTeleport(npc));
|
||||
if (new Random().nextInt(1000) == 500 && this.npc.isInvisible()) {
|
||||
this.npc.setInvisible(false);
|
||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection
|
||||
.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (NPC_1_12.this.npc == null || NPC_1_12.this.getOwner() == null) {
|
||||
return;
|
||||
}
|
||||
npc.setInvisible(true);
|
||||
((CraftPlayer) getOwner()).getHandle().playerConnection
|
||||
.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||
}
|
||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Player getOwner() {
|
||||
return Bukkit.getPlayer(owner);
|
||||
}
|
||||
|
||||
public void damage(EntityDamageByEntityEvent e, Player p) {
|
||||
if (p != getOwner() || this.npc == null) {
|
||||
return;
|
||||
}
|
||||
if (new Random().nextBoolean() && this.npc.isInvisible()) {
|
||||
this.npc.setInvisible(false);
|
||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection
|
||||
.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (NPC_1_12.this.npc == null || NPC_1_12.this.getOwner() == null) {
|
||||
return;
|
||||
}
|
||||
npc.setInvisible(true);
|
||||
((CraftPlayer) getOwner()).getHandle().playerConnection
|
||||
.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||
}
|
||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 6 + new Random().nextInt(7));
|
||||
}
|
||||
}
|
||||
|
||||
public void damage() {
|
||||
if (this.npc == null || this.getOwner() == null) {
|
||||
return;
|
||||
}
|
||||
if (new Random().nextBoolean() && this.npc.isInvisible()) {
|
||||
this.npc.setInvisible(false);
|
||||
((CraftPlayer) this.getOwner()).getHandle().playerConnection
|
||||
.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (NPC_1_12.this.npc == null || NPC_1_12.this.getOwner() == null) {
|
||||
return;
|
||||
}
|
||||
npc.setInvisible(true);
|
||||
((CraftPlayer) getOwner()).getHandle().playerConnection
|
||||
.sendPacket(new PacketPlayOutEntityMetadata(entityId, npc.getDataWatcher(), false));
|
||||
}
|
||||
}.runTaskLater(AntiCheatReloaded.getPlugin(), 6 + new Random().nextInt(8));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,11 +26,11 @@ public enum Permission {
|
||||
CHECK_ZOMBE_FLY, CHECK_ZOMBE_NOCLIP, CHECK_ZOMBE_CHEAT, CHECK_FLIGHT, CHECK_ELYTRA, CHECK_WATERWALK, CHECK_NOSWING, CHECK_FASTBREAK,
|
||||
CHECK_FASTPLACE, CHECK_CHATSPAM, CHECK_COMMANDSPAM, CHECK_SPRINT, CHECK_SNEAK, CHECK_SPEED, CHECK_VCLIP,
|
||||
CHECK_SPIDER, CHECK_NOFALL, CHECK_FASTBOW, CHECK_FASTEAT, CHECK_FASTHEAL, CHECK_FORCEFIELD, CHECK_LONGREACH,
|
||||
CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_VISUAL, CHECK_FASTINVENTORY, CHECK_AUTOTOOL,
|
||||
CHECK_FASTPROJECTILE, CHECK_ITEMSPAM, CHECK_VISUAL, CHECK_FASTINVENTORY, CHECK_AUTOTOOL, CHECK_KILLAURA, CHECK_BLINK, CHECK_VELOCITY, CHECK_CRITICALS, CHECK_UNICODE,
|
||||
|
||||
/* System Nodes */
|
||||
SYSTEM_LOG, SYSTEM_RESET, SYSTEM_SPY, SYSTEM_HELP, SYSTEM_UPDATE, SYSTEM_REPORT, SYSTEM_ALERT, SYSTEM_NOTICE,
|
||||
SYSTEM_CALIBRATE, SYSTEM_CHECK, SYSTEM_DEBUG, SYSTEM_RELOAD, CHECK_KILLAURA, CHECK_BLINK, VELOCITY, CRITICALS;
|
||||
SYSTEM_CALIBRATE, SYSTEM_CHECK, SYSTEM_DEBUG, SYSTEM_RELOAD;
|
||||
|
||||
private static final String PERMISSION_ALL = "anticheat.*";
|
||||
private static final String PERMISSION_SPAM = "anticheat.check.spam";
|
||||
|
||||
@@ -41,7 +41,6 @@ import java.util.regex.Pattern;
|
||||
public final class Utilities {
|
||||
private static final List<Material> INSTANT_BREAK = new ArrayList<Material>();
|
||||
private static final List<Material> FOOD = new ArrayList<Material>();
|
||||
private static final List<Material> INTERACTABLE = new ArrayList<Material>();
|
||||
private static final Map<Material, Material> COMBO = new HashMap<Material, Material>();
|
||||
|
||||
public static final String SPY_METADATA = "ac-spydata";
|
||||
@@ -228,15 +227,8 @@ public final class Utilities {
|
||||
*/
|
||||
public static boolean isSlab(Block block) {
|
||||
Material type = block.getType();
|
||||
switch (type) {
|
||||
case STEP:
|
||||
case DOUBLE_STEP:
|
||||
case WOOD_STEP:
|
||||
case WOOD_DOUBLE_STEP:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return type.name().endsWith("SLAB");
|
||||
// TODO does this even work?
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -247,30 +239,8 @@ public final class Utilities {
|
||||
*/
|
||||
public static boolean isStair(Block block) {
|
||||
Material type = block.getType();
|
||||
switch (type) {
|
||||
case WOOD_STAIRS:
|
||||
case SPRUCE_WOOD_STAIRS:
|
||||
case SMOOTH_STAIRS:
|
||||
case SANDSTONE_STAIRS:
|
||||
case QUARTZ_STAIRS:
|
||||
case JUNGLE_WOOD_STAIRS:
|
||||
case NETHER_BRICK_STAIRS:
|
||||
case BIRCH_WOOD_STAIRS:
|
||||
case COBBLESTONE_STAIRS:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a player can interact with this material
|
||||
*
|
||||
* @param m material to check
|
||||
* @return true if interactable
|
||||
*/
|
||||
public static boolean isInteractable(Material m) {
|
||||
return INTERACTABLE.contains(m);
|
||||
return type.name().endsWith("STAIRS");
|
||||
// TODO does this even work?
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -291,7 +261,7 @@ public final class Utilities {
|
||||
*/
|
||||
public static boolean isOnLilyPad(Player player) {
|
||||
Block block = player.getLocation().getBlock();
|
||||
Material lily = Material.WATER_LILY;
|
||||
Material lily = Material.LILY_PAD;
|
||||
// TODO: Can we fix X this?
|
||||
return block.getType() == lily || block.getRelative(BlockFace.NORTH).getType() == lily
|
||||
|| block.getRelative(BlockFace.SOUTH).getType() == lily
|
||||
@@ -329,9 +299,9 @@ public final class Utilities {
|
||||
* @return true if in web
|
||||
*/
|
||||
public static boolean isInWeb(Player player) {
|
||||
return player.getLocation().getBlock().getType() == Material.WEB
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.WEB
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.UP).getType() == Material.WEB;
|
||||
return player.getLocation().getBlock().getType() == Material.COBWEB
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.COBWEB
|
||||
|| player.getLocation().getBlock().getRelative(BlockFace.UP).getType() == Material.COBWEB;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -342,7 +312,7 @@ public final class Utilities {
|
||||
*/
|
||||
public static boolean isClimbableBlock(Block block) {
|
||||
return block.getType() == Material.VINE || block.getType() == Material.LADDER
|
||||
|| block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER;
|
||||
|| block.getType() == Material.WATER;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -394,7 +364,7 @@ public final class Utilities {
|
||||
* @return time in milliseconds to break
|
||||
*/
|
||||
public static long calcSurvivalFastBreak(ItemStack tool, Material block) {
|
||||
if (isInstantBreak(block) || (tool.getType() == Material.SHEARS && block == Material.LEAVES)) {
|
||||
if (isInstantBreak(block) || (tool.getType() == Material.SHEARS && block.name().endsWith("LEAVES"))) {
|
||||
return 0;
|
||||
}
|
||||
double bhardness = BlockHardness.getBlockHardness(block);
|
||||
@@ -449,6 +419,23 @@ public final class Utilities {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a block ISN'T one of the specified types
|
||||
*
|
||||
* @param block block to check
|
||||
* @param endTypes array of possible name endings
|
||||
* @return true if the block isn't any of the materials
|
||||
*/
|
||||
public static boolean blockIsnt(Block block, String[] endTypes) {
|
||||
Material type = block.getType();
|
||||
for (String s : endTypes) {
|
||||
if (type.name().endsWith(s)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a COMMAND[] input to a set of commands to execute
|
||||
@@ -542,63 +529,119 @@ public final class Utilities {
|
||||
|
||||
static {
|
||||
// START INSTANT BREAK MATERIALS
|
||||
INSTANT_BREAK.add(Material.RED_MUSHROOM);
|
||||
INSTANT_BREAK.add(Material.RED_ROSE);
|
||||
INSTANT_BREAK.add(Material.BROWN_MUSHROOM);
|
||||
INSTANT_BREAK.add(Material.YELLOW_FLOWER);
|
||||
INSTANT_BREAK.add(Material.REDSTONE);
|
||||
INSTANT_BREAK.add(Material.REDSTONE_TORCH_OFF);
|
||||
INSTANT_BREAK.add(Material.REDSTONE_TORCH_ON);
|
||||
INSTANT_BREAK.add(Material.REDSTONE_WIRE);
|
||||
INSTANT_BREAK.add(Material.LONG_GRASS);
|
||||
INSTANT_BREAK.add(Material.PAINTING);
|
||||
INSTANT_BREAK.add(Material.WHEAT);
|
||||
INSTANT_BREAK.add(Material.SUGAR_CANE);
|
||||
INSTANT_BREAK.add(Material.SUGAR_CANE_BLOCK);
|
||||
INSTANT_BREAK.add(Material.DIODE);
|
||||
INSTANT_BREAK.add(Material.DIODE_BLOCK_OFF);
|
||||
INSTANT_BREAK.add(Material.DIODE_BLOCK_ON);
|
||||
INSTANT_BREAK.add(Material.SAPLING);
|
||||
INSTANT_BREAK.add(Material.COMPARATOR);
|
||||
INSTANT_BREAK.add(Material.REPEATER);
|
||||
INSTANT_BREAK.add(Material.TORCH);
|
||||
INSTANT_BREAK.add(Material.CROPS);
|
||||
INSTANT_BREAK.add(Material.SNOW);
|
||||
INSTANT_BREAK.add(Material.REDSTONE_TORCH);
|
||||
INSTANT_BREAK.add(Material.REDSTONE_WIRE);
|
||||
INSTANT_BREAK.add(Material.TRIPWIRE);
|
||||
INSTANT_BREAK.add(Material.TRIPWIRE_HOOK);
|
||||
INSTANT_BREAK.add(Material.FIRE);
|
||||
INSTANT_BREAK.add(Material.FLOWER_POT);
|
||||
INSTANT_BREAK.add(Material.INFESTED_CHISELED_STONE_BRICKS);
|
||||
INSTANT_BREAK.add(Material.INFESTED_COBBLESTONE);
|
||||
INSTANT_BREAK.add(Material.INFESTED_CRACKED_STONE_BRICKS);
|
||||
INSTANT_BREAK.add(Material.INFESTED_MOSSY_STONE_BRICKS);
|
||||
INSTANT_BREAK.add(Material.INFESTED_STONE);
|
||||
INSTANT_BREAK.add(Material.INFESTED_STONE_BRICKS);
|
||||
INSTANT_BREAK.add(Material.TNT);
|
||||
INSTANT_BREAK.add(Material.POTATO);
|
||||
INSTANT_BREAK.add(Material.CARROT);
|
||||
INSTANT_BREAK.add(Material.SLIME_BLOCK);
|
||||
INSTANT_BREAK.add(Material.HONEY_BLOCK);
|
||||
INSTANT_BREAK.add(Material.CARROTS);
|
||||
INSTANT_BREAK.add(Material.DEAD_BUSH);
|
||||
INSTANT_BREAK.add(Material.FERN);
|
||||
INSTANT_BREAK.add(Material.LARGE_FERN);
|
||||
INSTANT_BREAK.add(Material.CHORUS_FLOWER);
|
||||
INSTANT_BREAK.add(Material.CORNFLOWER);
|
||||
INSTANT_BREAK.add(Material.SUNFLOWER);
|
||||
INSTANT_BREAK.add(Material.LILY_PAD);
|
||||
INSTANT_BREAK.add(Material.MELON_STEM);
|
||||
INSTANT_BREAK.add(Material.ATTACHED_MELON_STEM);
|
||||
INSTANT_BREAK.add(Material.BROWN_MUSHROOM);
|
||||
INSTANT_BREAK.add(Material.RED_MUSHROOM);
|
||||
INSTANT_BREAK.add(Material.NETHER_WART);
|
||||
INSTANT_BREAK.add(Material.POTATOES);
|
||||
INSTANT_BREAK.add(Material.PUMPKIN_STEM);
|
||||
INSTANT_BREAK.add(Material.ATTACHED_PUMPKIN_STEM);
|
||||
INSTANT_BREAK.add(Material.ACACIA_SAPLING);
|
||||
INSTANT_BREAK.add(Material.BAMBOO_SAPLING);
|
||||
INSTANT_BREAK.add(Material.BIRCH_SAPLING);
|
||||
INSTANT_BREAK.add(Material.DARK_OAK_SAPLING);
|
||||
INSTANT_BREAK.add(Material.JUNGLE_SAPLING);
|
||||
INSTANT_BREAK.add(Material.OAK_SAPLING);
|
||||
INSTANT_BREAK.add(Material.SPRUCE_SAPLING);
|
||||
INSTANT_BREAK.add(Material.SUGAR_CANE);
|
||||
INSTANT_BREAK.add(Material.TALL_GRASS);
|
||||
INSTANT_BREAK.add(Material.TALL_SEAGRASS);
|
||||
INSTANT_BREAK.add(Material.WHEAT);
|
||||
// END INSTANT BREAK MATERIALS
|
||||
|
||||
// START INTERACTABLE MATERIALS
|
||||
INTERACTABLE.add(Material.STONE_BUTTON);
|
||||
INTERACTABLE.add(Material.LEVER);
|
||||
INTERACTABLE.add(Material.CHEST);
|
||||
// END INTERACTABLE MATERIALS
|
||||
|
||||
// START FOOD
|
||||
FOOD.add(Material.APPLE);
|
||||
FOOD.add(Material.BAKED_POTATO);
|
||||
FOOD.add(Material.BEETROOT);
|
||||
FOOD.add(Material.BEETROOT_SOUP);
|
||||
FOOD.add(Material.BREAD);
|
||||
FOOD.add(Material.CAKE);
|
||||
FOOD.add(Material.CARROT);
|
||||
FOOD.add(Material.CHORUS_FRUIT);
|
||||
FOOD.add(Material.COOKED_BEEF);
|
||||
FOOD.add(Material.COOKED_CHICKEN);
|
||||
FOOD.add(Material.COOKED_FISH);
|
||||
FOOD.add(Material.GRILLED_PORK);
|
||||
FOOD.add(Material.PORK);
|
||||
FOOD.add(Material.MUSHROOM_SOUP);
|
||||
FOOD.add(Material.RAW_BEEF);
|
||||
FOOD.add(Material.RAW_CHICKEN);
|
||||
FOOD.add(Material.RAW_FISH);
|
||||
FOOD.add(Material.APPLE);
|
||||
FOOD.add(Material.GOLDEN_APPLE);
|
||||
FOOD.add(Material.MELON);
|
||||
FOOD.add(Material.COOKED_COD);
|
||||
FOOD.add(Material.COOKED_MUTTON);
|
||||
FOOD.add(Material.COOKED_PORKCHOP);
|
||||
FOOD.add(Material.COOKED_RABBIT);
|
||||
FOOD.add(Material.COOKED_SALMON);
|
||||
FOOD.add(Material.COOKIE);
|
||||
FOOD.add(Material.BREAD);
|
||||
FOOD.add(Material.SPIDER_EYE);
|
||||
FOOD.add(Material.DRIED_KELP);
|
||||
FOOD.add(Material.ENCHANTED_GOLDEN_APPLE);
|
||||
FOOD.add(Material.GOLDEN_APPLE);
|
||||
FOOD.add(Material.GOLDEN_CARROT);
|
||||
FOOD.add(Material.HONEY_BOTTLE);
|
||||
FOOD.add(Material.MELON_SLICE);
|
||||
FOOD.add(Material.MUSHROOM_STEW);
|
||||
FOOD.add(Material.POISONOUS_POTATO);
|
||||
FOOD.add(Material.POTATO);
|
||||
FOOD.add(Material.PUFFERFISH);
|
||||
FOOD.add(Material.PUMPKIN_PIE);
|
||||
FOOD.add(Material.RABBIT_STEW);
|
||||
FOOD.add(Material.BEEF);
|
||||
FOOD.add(Material.CHICKEN);
|
||||
FOOD.add(Material.COD);
|
||||
FOOD.add(Material.MUTTON);
|
||||
FOOD.add(Material.PORKCHOP);
|
||||
FOOD.add(Material.RABBIT);
|
||||
FOOD.add(Material.SALMON);
|
||||
FOOD.add(Material.ROTTEN_FLESH);
|
||||
FOOD.add(Material.POTATO_ITEM);
|
||||
FOOD.add(Material.SPIDER_EYE);
|
||||
FOOD.add(Material.SUSPICIOUS_STEW);
|
||||
FOOD.add(Material.SWEET_BERRIES);
|
||||
FOOD.add(Material.TROPICAL_FISH);
|
||||
// END FOOD
|
||||
|
||||
// START COMBOS
|
||||
COMBO.put(Material.SHEARS, Material.WOOL);
|
||||
COMBO.put(Material.IRON_SWORD, Material.WEB);
|
||||
COMBO.put(Material.DIAMOND_SWORD, Material.WEB);
|
||||
COMBO.put(Material.STONE_SWORD, Material.WEB);
|
||||
COMBO.put(Material.WOOD_SWORD, Material.WEB);
|
||||
COMBO.put(Material.SHEARS, Material.BLACK_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.BLUE_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.BROWN_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.CYAN_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.GRAY_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.GREEN_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.LIGHT_BLUE_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.LIGHT_GRAY_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.LIME_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.MAGENTA_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.MAGENTA_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.ORANGE_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.PINK_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.PURPLE_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.RED_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.WHITE_WOOL);
|
||||
COMBO.put(Material.SHEARS, Material.YELLOW_WOOL);
|
||||
|
||||
COMBO.put(Material.IRON_SWORD, Material.COBWEB);
|
||||
COMBO.put(Material.DIAMOND_SWORD, Material.COBWEB);
|
||||
COMBO.put(Material.STONE_SWORD, Material.COBWEB);
|
||||
COMBO.put(Material.WOODEN_SWORD, Material.COBWEB);
|
||||
// END COMBOS
|
||||
}
|
||||
}
|
||||
@@ -20,18 +20,18 @@
|
||||
package com.rammelkast.anticheatreloaded.util;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class VersionUtil {
|
||||
|
||||
private static final List<String> SUPPORTED_VERSIONS = Arrays
|
||||
.asList(new String[] { "v1_8", "v1_9", "v1_10", "v1_11", "v1_12" });
|
||||
.asList(new String[] { "v1_15" });
|
||||
|
||||
public static String getVersion() {
|
||||
return Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
|
||||
@@ -46,66 +46,32 @@ public class VersionUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static final EnumSet<Material> MOVE_UP_BLOCKS_1_8 = EnumSet.of(Material.ACACIA_STAIRS,
|
||||
Material.BIRCH_WOOD_STAIRS, Material.BRICK_STAIRS, Material.COBBLESTONE_STAIRS, Material.DARK_OAK_STAIRS,
|
||||
Material.JUNGLE_WOOD_STAIRS, Material.NETHER_BRICK_STAIRS, Material.QUARTZ_STAIRS,
|
||||
Material.RED_SANDSTONE_STAIRS, Material.SANDSTONE_STAIRS, Material.SMOOTH_STAIRS,
|
||||
Material.SPRUCE_WOOD_STAIRS, Material.WOOD_STAIRS);
|
||||
|
||||
public static boolean isFlying(Player p) {
|
||||
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11")
|
||||
|| getVersion().startsWith("v1_12")) {
|
||||
return p.isFlying() || p.isGliding() || p.hasPotionEffect(NMS_1_9_PLUS.LEVITATION);
|
||||
} else {
|
||||
return p.isFlying();
|
||||
}
|
||||
}
|
||||
|
||||
public static EnumSet<Material> getMoveUpBlocks() {
|
||||
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11")
|
||||
|| getVersion().startsWith("v1_12")) {
|
||||
return NMS_1_9_PLUS.MOVE_UP_BLOCKS_1_9;
|
||||
} else {
|
||||
return MOVE_UP_BLOCKS_1_8;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isNewYSpeed() {
|
||||
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11")
|
||||
|| getVersion().startsWith("v1_12")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return p.isFlying() || p.isGliding() || p.hasPotionEffect(PotionEffectType.LEVITATION);
|
||||
}
|
||||
|
||||
public static long getHealTime() {
|
||||
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11")
|
||||
|| getVersion().startsWith("v1_12")) {
|
||||
return 495;
|
||||
} else {
|
||||
return 1995;
|
||||
}
|
||||
return 495;
|
||||
}
|
||||
|
||||
public static boolean isFrostWalk(Player player) {
|
||||
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11")
|
||||
|| getVersion().startsWith("v1_12")) {
|
||||
if (player.getInventory().getBoots() == null) {
|
||||
return false;
|
||||
}
|
||||
return player.getInventory().getBoots().containsEnchantment(NMS_1_9_PLUS.FROST_WALKER);
|
||||
} else {
|
||||
if (player.getInventory().getBoots() == null) {
|
||||
return false;
|
||||
}
|
||||
return player.getInventory().getBoots().containsEnchantment(Enchantment.FROST_WALKER);
|
||||
}
|
||||
|
||||
public static ItemStack getItemInHand(Player player) {
|
||||
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11")
|
||||
|| getVersion().startsWith("v1_12")) {
|
||||
return NMS_1_9_PLUS.getItemInHand(player);
|
||||
} else {
|
||||
return player.getItemInHand();
|
||||
return player.getInventory().getItemInMainHand();
|
||||
}
|
||||
|
||||
public static int getPlayerPing(Player player) {
|
||||
try {
|
||||
Object entityPlayer = player.getClass().getMethod("getHandle").invoke(player);
|
||||
int ping = (int) entityPlayer.getClass().getField("ping").get(entityPlayer);
|
||||
return ping;
|
||||
} catch (Exception e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,17 +85,14 @@ XZ_SPEED_MAX_WATER_SPRINT: 0.3
|
||||
Y_MAXDIFF: 5.0
|
||||
Y_MAXVIOLATIONS: 1
|
||||
Y_MAXVIOTIME: 5500
|
||||
Y_SPEED_MAX: 0.5125
|
||||
Y_SPEED_MAX: 0.5175
|
||||
Y_TIME: 800
|
||||
# Amount of suspicious mid-air movements before a player is suspected of glide
|
||||
# Increase this in case of false positives
|
||||
GLIDE_LIMIT: 10
|
||||
# Amount of hits to a bot before a player is suspected
|
||||
# Increase this in case of false positives
|
||||
KILLAURA_BOTHITS: 4
|
||||
# Maximum amount of movement packets allowed per second
|
||||
# Increase this in case of false positives
|
||||
BLINK_PACKET: 74
|
||||
BLINK_PACKET: 25
|
||||
# Maximum amount zero-velocity moments before a player is suspected
|
||||
# Increase this in case of false positives
|
||||
VELOCITY_AMT: 5
|
||||
@@ -2,6 +2,7 @@ name: AntiCheatReloaded
|
||||
author: Rammelkast
|
||||
description: AntiCheatReloaded helps easily identify and block malicious users on your server.
|
||||
main: com.rammelkast.anticheatreloaded.AntiCheatReloaded
|
||||
api-version: 1.13
|
||||
depend: [ProtocolLib]
|
||||
startup: postworld
|
||||
version: ${project.build.version}
|
||||
@@ -129,8 +130,20 @@ permissions:
|
||||
anticheat.check.autotool:
|
||||
description: Allow players to use autotool to switch tools quickly
|
||||
default: false
|
||||
anticheat.check.fastanimation:
|
||||
description: Allow players to attack or interact very quickly
|
||||
anticheat.check.killaura:
|
||||
description: Allow players to use killaura
|
||||
default: false
|
||||
anticheat.check.blink:
|
||||
description: Allow players to send lots of movement packets
|
||||
default: false
|
||||
anticheat.check.velocity:
|
||||
description: Allow players to use knockback prevention
|
||||
default: false
|
||||
anticheat.check.criticals:
|
||||
description: Allow players to use criticals
|
||||
default: false
|
||||
anticheat.check.unicode:
|
||||
description: Allow players to use unicode in chat
|
||||
default: false
|
||||
anticheat.check.exempt:
|
||||
description: Total exemption from checks
|
||||
|
||||
Reference in new issue
Block a user