Code cleanup, prepare for release

This commit is contained in:
Rammelkast committed 2020-04-23 19:46:58 +02:00
1 parent df3c410436
commit a7419e3968
15 files changed
+150 -158

No files matched your search

@@ -64,7 +64,6 @@ public class AntiCheatReloaded extends JavaPlugin {
private static UpdateManager updateManager;
private double tps = -1;
private int currentTick;
@Override
public void onEnable() {
@@ -152,7 +151,6 @@ public class AntiCheatReloaded extends JavaPlugin {
tps = (tps == 0.0D ? ticks : (tps + ticks) / 2.0D);
ticks = 1;
}
currentTick++;
}
}.runTaskTimer(this, 40L, 1L);
// Launch MorePackets timer
@@ -30,13 +30,11 @@ import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerToggleSprintEvent;
import org.bukkit.potion.PotionEffectType;
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
import com.rammelkast.anticheatreloaded.check.combat.KillAuraCheck;
import com.rammelkast.anticheatreloaded.check.combat.VelocityCheck;
import com.rammelkast.anticheatreloaded.check.movement.ElytraCheck;
@@ -58,7 +56,6 @@ import com.rammelkast.anticheatreloaded.util.VersionUtil;
public class Backend {
public Map<UUID, Long> velocitized = new HashMap<UUID, Long>();
private List<UUID> isAscending = new ArrayList<UUID>();
private Map<UUID, Integer> ascensionCount = new HashMap<UUID, Integer>();
private Map<UUID, Integer> chatLevel = new HashMap<UUID, Integer>();
private Map<UUID, Integer> commandLevel = new HashMap<UUID, Integer>();
private Map<UUID, Integer> nofallViolation = new HashMap<UUID, Integer>();
@@ -86,11 +83,9 @@ public class Backend {
private Map<UUID, Long> inventoryTime = new HashMap<UUID, Long>();
private Map<UUID, Integer> inventoryClicks = new HashMap<UUID, Integer>();
private Map<UUID, Material> itemInHand = new HashMap<UUID, Material>();
private Map<UUID, Integer> steps = new HashMap<UUID, Integer>();
private Map<UUID, Long> stepTime = new HashMap<UUID, Long>();
private HashSet<Byte> transparent = new HashSet<Byte>();
private Map<UUID, Long> lastFallPacket = new HashMap<UUID, Long>();
private Map<String, Integer> fastSneakViolations = new HashMap<String, Integer>();
private Map<UUID, Integer> fastSneakViolations = new HashMap<UUID, Integer>();
private Magic magic;
private AntiCheatManager manager = null;
@@ -118,67 +113,66 @@ public class Backend {
}
public void garbageClean(Player player) {
UUID pU = player.getUniqueId();
UUID uuid = player.getUniqueId();
VelocityCheck.cleanPlayer(player);
MorePacketsCheck.MOVE_COUNT.remove(player.getUniqueId());
blocksDropped.remove(pU);
blockTime.remove(pU);
FlightCheck.MOVING_EXEMPT.remove(pU);
brokenBlock.remove(pU);
placedBlock.remove(pU);
bowWindUp.remove(pU);
startEat.remove(pU);
lastHeal.remove(pU);
sprinted.remove(pU);
WaterWalkCheck.IS_IN_WATER.remove(pU);
WaterWalkCheck.IS_IN_WATER_CACHE.remove(pU);
instantBreakExempt.remove(pU);
isAscending.remove(player.getUniqueId());
ascensionCount.remove(player.getUniqueId());
FlightCheck.BLOCKS_OVER_FLIGHT.remove(pU);
nofallViolation.remove(pU);
fastBreakViolation.remove(pU);
YAxisCheck.Y_AXIS_VIOLATIONS.remove(pU);
YAxisCheck.LAST_Y_AXIS_VIOLATION.remove(pU);
YAxisCheck.LAST_Y_COORD_CACHE.remove(pU);
YAxisCheck.LAST_Y_TIME.remove(pU);
WaterWalkCheck.WATER_ASCENSION_VIOLATIONS.remove(pU);
WaterWalkCheck.WATER_SPEED_VIOLATIONS.remove(pU);
fastBreaks.remove(pU);
blockBreakHolder.remove(pU);
lastBlockBroken.remove(pU);
fastPlaceViolation.remove(pU);
lastBlockPlaced.remove(pU);
lastBlockPlaceTime.remove(pU);
blockPunches.remove(pU);
projectilesShot.remove(pU);
velocitized.remove(pU);
velocitytrack.remove(pU);
startEat.remove(pU);
lastHeal.remove(pU);
projectileTime.remove(pU);
bowWindUp.remove(pU);
instantBreakExempt.remove(pU);
sprinted.remove(pU);
brokenBlock.remove(pU);
placedBlock.remove(pU);
FlightCheck.MOVING_EXEMPT.remove(pU);
blockTime.remove(pU);
blocksDropped.remove(pU);
lastInventoryTime.remove(pU);
inventoryTime.remove(pU);
inventoryClicks.remove(pU);
lastFallPacket.remove(pU);
fastSneakViolations.remove(player.getUniqueId().toString());
GlideCheck.LAST_MOTION_Y.remove(pU);
GlideCheck.LAST_FALL_DISTANCE.remove(pU);
GlideCheck.VIOLATIONS.remove(pU);
SpeedCheck.SPEED_VIOLATIONS.remove(player.getUniqueId());
ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId().toString());
KillAuraCheck.ANGLE_FLAGS.remove(pU);
KillAuraCheck.PITCH_MOVEMENTS_CACHE.remove(pU);
KillAuraCheck.GCD_CACHE.remove(pU);
blocksDropped.remove(uuid);
blockTime.remove(uuid);
brokenBlock.remove(uuid);
placedBlock.remove(uuid);
bowWindUp.remove(uuid);
startEat.remove(uuid);
lastHeal.remove(uuid);
sprinted.remove(uuid);
instantBreakExempt.remove(uuid);
isAscending.remove(uuid);
nofallViolation.remove(uuid);
fastBreakViolation.remove(uuid);
fastBreaks.remove(uuid);
blockBreakHolder.remove(uuid);
lastBlockBroken.remove(uuid);
fastPlaceViolation.remove(uuid);
lastBlockPlaced.remove(uuid);
lastBlockPlaceTime.remove(uuid);
blockPunches.remove(uuid);
projectilesShot.remove(uuid);
velocitized.remove(uuid);
velocitytrack.remove(uuid);
startEat.remove(uuid);
lastHeal.remove(uuid);
projectileTime.remove(uuid);
bowWindUp.remove(uuid);
instantBreakExempt.remove(uuid);
sprinted.remove(uuid);
brokenBlock.remove(uuid);
placedBlock.remove(uuid);
blockTime.remove(uuid);
blocksDropped.remove(uuid);
lastInventoryTime.remove(uuid);
inventoryTime.remove(uuid);
inventoryClicks.remove(uuid);
lastFallPacket.remove(uuid);
fastSneakViolations.remove(uuid);
VelocityCheck.VIOLATIONS.remove(uuid);
MorePacketsCheck.MOVE_COUNT.remove(uuid);
GlideCheck.LAST_MOTION_Y.remove(uuid);
GlideCheck.LAST_FALL_DISTANCE.remove(uuid);
GlideCheck.VIOLATIONS.remove(uuid);
SpeedCheck.SPEED_VIOLATIONS.remove(uuid);
ElytraCheck.JUMP_Y_VALUE.remove(uuid);
KillAuraCheck.ANGLE_FLAGS.remove(uuid);
KillAuraCheck.PITCH_MOVEMENTS_CACHE.remove(uuid);
KillAuraCheck.GCD_CACHE.remove(uuid);
FlightCheck.MOVING_EXEMPT.remove(uuid);
FlightCheck.ASCENSION_COUNT.remove(uuid);
FlightCheck.BLOCKS_OVER_FLIGHT.remove(uuid);
YAxisCheck.Y_AXIS_VIOLATIONS.remove(uuid);
YAxisCheck.LAST_Y_AXIS_VIOLATION.remove(uuid);
YAxisCheck.LAST_Y_COORD_CACHE.remove(uuid);
YAxisCheck.LAST_Y_TIME.remove(uuid);
WaterWalkCheck.IS_IN_WATER.remove(uuid);
WaterWalkCheck.IS_IN_WATER_CACHE.remove(uuid);
WaterWalkCheck.WATER_ASCENSION_VIOLATIONS.remove(uuid);
WaterWalkCheck.WATER_SPEED_VIOLATIONS.remove(uuid);
}
public CheckResult checkFastBow(Player player, float force) {
@@ -321,24 +315,24 @@ public class Backend {
&& !Utilities.cantStandAtExp(location)) {
double i = x > magic.XZ_SPEED_MAX_SNEAK() ? x : z > magic.XZ_SPEED_MAX_SNEAK() ? z : -1;
if (i != -1) {
if (this.fastSneakViolations.containsKey(player.getUniqueId().toString())) {
int flags = this.fastSneakViolations.get(player.getUniqueId().toString());
if (this.fastSneakViolations.containsKey(player.getUniqueId())) {
int flags = this.fastSneakViolations.get(player.getUniqueId());
if (flags >= 3) { // TODO possible config
return new CheckResult(CheckResult.Result.FAILED,
"was sneaking too fast (speed=" + i + ", max=" + magic.XZ_SPEED_MAX_SNEAK() + ")");
}
this.fastSneakViolations.put(player.getUniqueId().toString(), flags + 1);
this.fastSneakViolations.put(player.getUniqueId(), flags + 1);
return PASS;
} else {
this.fastSneakViolations.put(player.getUniqueId().toString(), 1);
this.fastSneakViolations.put(player.getUniqueId(), 1);
return PASS;
}
} else {
this.fastSneakViolations.remove(player.getUniqueId().toString());
this.fastSneakViolations.remove(player.getUniqueId());
return PASS;
}
} else {
this.fastSneakViolations.remove(player.getUniqueId().toString());
this.fastSneakViolations.remove(player.getUniqueId());
return PASS;
}
}
@@ -383,39 +377,6 @@ public class Backend {
}
}
public CheckResult checkAscension(Player player, double y1, double y2) {
int max = magic.ASCENSION_COUNT_MAX();
String string = "";
if (player.hasPotionEffect(PotionEffectType.JUMP)) {
max += 12;
string = " with jump potion";
}
Block block = player.getLocation().getBlock();
if (!isMovingExempt(player) && !Utilities.isInWater(player) && !VersionUtil.isFlying(player)
&& !justBroke(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock())
&& !Utilities.isClimbableBlock(player.getEyeLocation().getBlock())
&& !Utilities.isClimbableBlock(player.getLocation().clone().add(0, -0.98, 0).getBlock())
&& !player.isInsideVehicle() && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -1, 0).getBlock())
&& !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -0.5, 0).getBlock())) {
// TODO isMoveUpBlock does not seem to be a success with stairs
if (y1 < y2) {
if (!block.getRelative(BlockFace.NORTH).isLiquid() && !block.getRelative(BlockFace.SOUTH).isLiquid()
&& !block.getRelative(BlockFace.EAST).isLiquid()
&& !block.getRelative(BlockFace.WEST).isLiquid()) {
increment(player, ascensionCount, max);
if (ascensionCount.get(player.getUniqueId()) >= max) {
return new CheckResult(CheckResult.Result.FAILED,
"ascended " + ascensionCount.get(player.getUniqueId()) + " times in a row (max = " + max
+ string + ")");
}
}
} else {
ascensionCount.put(player.getUniqueId(), 0);
}
}
return PASS;
}
public CheckResult checkSwing(Player player, Block block) {
UUID uuid = player.getUniqueId();
if (!isInstantBreakExempt(player)) {
@@ -809,7 +770,7 @@ public class Backend {
GlideCheck.LAST_FALL_DISTANCE.remove(player.getUniqueId());
GlideCheck.LAST_MOTION_Y.remove(player.getUniqueId());
GlideCheck.VIOLATIONS.remove(player.getUniqueId());
ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId().toString());
ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId());
}
public void logExitFly(final Player player) {
@@ -887,35 +848,35 @@ public class Backend {
commandLevel.put(user.getUUID(), level + 1);
}
public int increment(Player player, Map<UUID, Integer> ascensionCount2, int num) {
public int increment(Player player, Map<UUID, Integer> map, int num) {
UUID name = player.getUniqueId();
if (ascensionCount2.get(name) == null) {
ascensionCount2.put(name, 1);
if (map.get(name) == null) {
map.put(name, 1);
return 1;
} else {
int amount = ascensionCount2.get(name) + 1;
int amount = map.get(name) + 1;
if (amount < num + 1) {
ascensionCount2.put(name, amount);
map.put(name, amount);
return amount;
} else {
ascensionCount2.put(name, num);
map.put(name, num);
return num;
}
}
}
public int incrementOld(Player player, Map<UUID, Integer> ascensionCount2, int num) {
public int incrementOld(Player player, Map<UUID, Integer> map, int num) {
UUID uuid = player.getUniqueId();
if (ascensionCount2.get(uuid) == null) {
ascensionCount2.put(uuid, 1);
if (map.get(uuid) == null) {
map.put(uuid, 1);
return 1;
} else {
int amount = ascensionCount2.get(uuid) + 1;
int amount = map.get(uuid) + 1;
if (amount < num + 1) {
ascensionCount2.put(uuid, amount);
map.put(uuid, amount);
return amount;
} else {
ascensionCount2.put(uuid, num);
map.put(uuid, num);
return num;
}
}
@@ -35,11 +35,7 @@ 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 final Map<UUID, Integer> VIOLATIONS = new HashMap<UUID, Integer>();
public static void runCheck(EntityDamageByEntityEvent e, final Player player) {
if (!AntiCheatReloaded.getManager().getCheckManager().willCheck(player, CheckType.VELOCITY))
@@ -51,24 +47,24 @@ public class VelocityCheck {
if (!player.isOnline())
return;
if (then.distance(player.getLocation()) < 0.125) {
if (!VL_COUNT.containsKey(player.getUniqueId()))
VL_COUNT.put(player.getUniqueId(), 1);
if (!VIOLATIONS.containsKey(player.getUniqueId()))
VIOLATIONS.put(player.getUniqueId(), 1);
else {
VL_COUNT.put(player.getUniqueId(), VL_COUNT.get(player.getUniqueId()) + 1);
if (VL_COUNT.get(player.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic()
VIOLATIONS.put(player.getUniqueId(), VIOLATIONS.get(player.getUniqueId()) + 1);
if (VIOLATIONS.get(player.getUniqueId()) > AntiCheatReloaded.getManager().getBackend().getMagic()
.VELOCITY_MAX_FLAGS()) {
EventListener.log(
new CheckResult(CheckResult.Result.FAILED,
"had zero/low velocity " + VL_COUNT.get(player.getUniqueId()) + " times (max="
"had zero/low velocity " + VIOLATIONS.get(player.getUniqueId()) + " times (max="
+ AntiCheatReloaded.getManager().getBackend().getMagic()
.VELOCITY_MAX_FLAGS()
+ ", dist=" + then.distance(player.getLocation()) + ")").getMessage(),
player, CheckType.VELOCITY);
VL_COUNT.remove(player.getUniqueId());
VIOLATIONS.remove(player.getUniqueId());
}
}
} else {
VL_COUNT.remove(player.getUniqueId());
VIOLATIONS.remove(player.getUniqueId());
}
}
}.runTaskLater(AntiCheatReloaded.getPlugin(), 4);
@@ -20,6 +20,7 @@
package com.rammelkast.anticheatreloaded.check.movement;
import java.util.HashMap;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.Material;
@@ -33,7 +34,7 @@ import com.rammelkast.anticheatreloaded.util.VersionUtil;
public class ElytraCheck {
public static final HashMap<String, Double> JUMP_Y_VALUE = new HashMap<String, Double>();
public static final HashMap<UUID, Double> JUMP_Y_VALUE = new HashMap<UUID, Double>();
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
public static CheckResult runCheck(Player player, Distance distance) {
@@ -42,7 +43,7 @@ public class ElytraCheck {
return PASS;
}
String uuid = player.getUniqueId().toString();
UUID uuid = player.getUniqueId();
if (distance.getYDifference() > AntiCheatReloaded.getManager().getBackend().getMagic().TELEPORT_MIN()) {
// This was a teleport, so skip check.
JUMP_Y_VALUE.remove(uuid);
@@ -24,10 +24,13 @@ import java.util.Map;
import java.util.UUID;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
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;
@@ -40,6 +43,7 @@ public class FlightCheck {
public static final Map<UUID, Double> BLOCKS_OVER_FLIGHT = new HashMap<UUID, Double>();
public static final Map<UUID, Long> MOVING_EXEMPT = new HashMap<UUID, Long>();
public static final Map<UUID, Integer> ASCENSION_COUNT = new HashMap<UUID, Integer>();
private static final CheckResult PASS = new CheckResult(CheckResult.Result.PASSED);
public static CheckResult runCheck(Player player, Distance distance) {
@@ -80,6 +84,40 @@ public class FlightCheck {
}
return PASS;
}
public static CheckResult checkAscension(Player player, double y1, double y2) {
Backend backend = AntiCheatReloaded.getManager().getBackend();
int max = backend.getMagic().ASCENSION_COUNT_MAX();
String string = "";
if (player.hasPotionEffect(PotionEffectType.JUMP)) {
max += 12;
string = " with jump potion";
}
Block block = player.getLocation().getBlock();
if (!isMovingExempt(player) && !Utilities.isInWater(player) && !VersionUtil.isFlying(player)
&& !backend.justBroke(player) && !Utilities.isClimbableBlock(player.getLocation().getBlock())
&& !Utilities.isClimbableBlock(player.getEyeLocation().getBlock())
&& !Utilities.isClimbableBlock(player.getLocation().clone().add(0, -0.98, 0).getBlock())
&& !player.isInsideVehicle() && !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -1, 0).getBlock())
&& !YAxisCheck.isMoveUpBlock(player.getLocation().add(0, -0.5, 0).getBlock())) {
// TODO isMoveUpBlock does not seem to be a success with stairs
if (y1 < y2) {
if (!block.getRelative(BlockFace.NORTH).isLiquid() && !block.getRelative(BlockFace.SOUTH).isLiquid()
&& !block.getRelative(BlockFace.EAST).isLiquid()
&& !block.getRelative(BlockFace.WEST).isLiquid()) {
backend.increment(player, ASCENSION_COUNT, max);
if (ASCENSION_COUNT.get(player.getUniqueId()) >= max) {
return new CheckResult(CheckResult.Result.FAILED,
"ascended " + ASCENSION_COUNT.get(player.getUniqueId()) + " times in a row (max = " + max
+ string + ")");
}
}
} else {
ASCENSION_COUNT.put(player.getUniqueId(), 0);
}
}
return PASS;
}
public static boolean isMovingExempt(Player player) {
return isDoing(player, MOVING_EXEMPT, -1) || player.isInsideVehicle();
@@ -30,7 +30,6 @@ import org.bukkit.Material;
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;
@@ -19,6 +19,10 @@
package com.rammelkast.anticheatreloaded.command.executors;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
@@ -27,12 +31,10 @@ import org.bukkit.entity.Player;
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.command.CommandBase;
import com.rammelkast.anticheatreloaded.manage.CheckManager;
import com.rammelkast.anticheatreloaded.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import com.rammelkast.anticheatreloaded.util.Group;
import com.rammelkast.anticheatreloaded.util.Permission;
import com.rammelkast.anticheatreloaded.util.User;
import com.rammelkast.anticheatreloaded.util.Utilities;
public class CommandReport extends CommandBase {
@@ -37,7 +37,6 @@ import com.rammelkast.anticheatreloaded.manage.AntiCheatManager;
import com.rammelkast.anticheatreloaded.manage.CheckManager;
import com.rammelkast.anticheatreloaded.manage.UserManager;
import com.rammelkast.anticheatreloaded.util.User;
import com.rammelkast.anticheatreloaded.util.VersionUtil;
public class EventListener implements Listener {
private static final Map<CheckType, Integer> USAGE_LIST = new EnumMap<CheckType, Integer>(CheckType.class);
@@ -29,7 +29,6 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerAnimationEvent;
@@ -263,10 +262,10 @@ public class PlayerListener extends EventListener {
if (!VersionUtil.isBountifulUpdate()) {
if (itemInHand.getType() == Material.FIREWORK_ROCKET) {
ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId().toString());
ElytraCheck.JUMP_Y_VALUE.remove(player.getUniqueId());
if (player.isGliding()) {
// TODO config max elytra height?
ElytraCheck.JUMP_Y_VALUE.put(player.getUniqueId().toString(), 9999.99D);
ElytraCheck.JUMP_Y_VALUE.put(player.getUniqueId(), 9999.99D);
}
}
}
@@ -485,7 +484,7 @@ public class PlayerListener extends EventListener {
if (getCheckManager().willCheck(player, CheckType.FLIGHT) && !player.isFlying()) {
CheckResult result1 = YAxisCheck.runCheck(player, new Distance(from, to));
CheckResult result2 = getBackend().checkAscension(player, from.getY(), to.getY());
CheckResult result2 = FlightCheck.checkAscension(player, from.getY(), to.getY());
String log = result1.failed() ? result1.getMessage() : result2.failed() ? result2.getMessage() : "";
if (!log.equals("")) {
if (!silentMode()) {
@@ -49,6 +49,7 @@ public class VehicleListener extends EventListener {
AntiCheatReloaded.getManager().addEvent(event.getEventName(), event.getHandlers().getRegisteredListeners());
}
@SuppressWarnings("deprecation")
@EventHandler(ignoreCancelled = true)
public void onVehicleDestroy(VehicleDestroyEvent event) {
if (VersionUtil.isBountifulUpdate()) {
@@ -19,20 +19,19 @@
package com.rammelkast.anticheatreloaded.manage;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.util.VersionUtil;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.util.VersionUtil;
/**
* <p/>
* The manager that AntiCheat will check with to see if it should watch certain checks and certain players.
@@ -67,6 +67,7 @@ public class UpdateManager {
builder.append((char) readChar);
}
data = builder.toString();
reader.close();
} catch (IOException exception) {}
finally {
if (stream != null) {
@@ -77,6 +77,7 @@ public class VersionUtil {
return player.getInventory().getBoots().containsEnchantment(Enchantment.FROST_WALKER);
}
@SuppressWarnings("deprecation")
public static ItemStack getItemInHand(Player player) {
if (isBountifulUpdate()) {
return player.getItemInHand();
@@ -1124,7 +1124,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)
@@ -1847,7 +1846,6 @@ public enum XMaterial {
* @return data of this material, or 0 if none.
* @since 1.0.0
*/
@SuppressWarnings("deprecation")
public byte getData() {
return data;
}
@@ -1916,7 +1914,6 @@ public enum XMaterial {
* @see #matchXMaterial(String, byte)
* @since 2.0.0
*/
@SuppressWarnings("OptionalAssignedToNull")
@Nullable
public Material parseMaterial(boolean suggest) {
Optional<Material> cache = PARSED_CACHE.getIfPresent(this);