Compare commits

..
5 Commits
Author SHA1 Message Date
Rammelkast f609758d28 Ready for Minecraft 1.12 2017-11-20 19:34:51 +01:00
Rammelkast 2d064ee849 1.12 fixes 2017-11-18 17:04:03 +01:00
Rammelkast 717b7acb67 Quick metrics fix 2017-11-18 16:55:20 +01:00
Rammelkast 2617aa1225 Cleanup 2017-05-06 16:00:08 +02:00
Rammelkast dd8c495ee6 Modify Metrics data & fix 2017-03-03 12:40:30 +01:00
18 changed files with 125 additions and 59 deletions

No files matched your search

+2 -2
View File
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.rammelkast.anticheatreloaded</groupId> <groupId>com.rammelkast.anticheatreloaded</groupId>
<artifactId>AntiCheatReloaded</artifactId> <artifactId>AntiCheatReloaded</artifactId>
<version>1.6.1-ALPHA</version> <version>1.6.2-ALPHA</version>
<name>AntiCheatReloaded</name> <name>AntiCheatReloaded</name>
<url>https://rammelkast.com</url> <url>https://rammelkast.com</url>
<properties> <properties>
@@ -93,7 +93,7 @@
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId> <artifactId>craftbukkit</artifactId>
<version>1.11.2-R0.1-SNAPSHOT</version> <version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
@@ -52,7 +52,6 @@ public class AntiCheat extends JavaPlugin {
private static boolean verbose; private static boolean verbose;
private static boolean developer; private static boolean developer;
private static ProtocolManager protocolManager; private static ProtocolManager protocolManager;
private static boolean protocolLib = false;
private static Long loadTime; private static Long loadTime;
@Override @Override
@@ -70,18 +69,23 @@ public class AntiCheat extends JavaPlugin {
setupConfig(); setupConfig();
setupEvents(); setupEvents();
setupCommands(); setupCommands();
setupProtocol();
// Enterprise must come before levels // Enterprise must come before levels
setupEnterprise(); setupEnterprise();
restoreLevels(); restoreLevels();
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) { if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
setupProtocol();
} else {
getLogger().severe("Shutting down, ProtocolLib not found!");
Bukkit.getPluginManager().disablePlugin(this);
return;
}
getLogger().info("Found ProtocolLib, enabling checks that use ProtcolLib..."); getLogger().info("Found ProtocolLib, enabling checks that use ProtcolLib...");
// Enable packetlisteners // Enable packetlisteners
KillAuraCheck.listenPackets(); KillAuraCheck.listenPackets();
BlinkCheck.startTimer(); BlinkCheck.startTimer();
BlinkCheck.listenPackets(); BlinkCheck.listenPackets();
}
// Check if other AC's are installed // Check if other AC's are installed
Bukkit.getScheduler().runTaskLater(this, new Runnable() { Bukkit.getScheduler().runTaskLater(this, new Runnable() {
@@ -120,19 +124,34 @@ public class AntiCheat extends JavaPlugin {
metrics.addCustomChart(new Metrics.SingleLineChart("cheaters_kicked") { metrics.addCustomChart(new Metrics.SingleLineChart("cheaters_kicked") {
@Override @Override
public int getValue() { public int getValue() {
return playersKicked; int kicked = playersKicked;
// Reset so we don't keep sending the same value
playersKicked = 0;
return kicked;
} }
}); });
metrics.addCustomChart(new Metrics.SingleLineChart("killaura_violations") { metrics.addCustomChart(new Metrics.SingleLineChart("killaura_violations") {
@Override @Override
public int getValue() { public int getValue() {
return killauraViolations; int violations = killauraViolations;
// Reset so we don't keep sending the same value
killauraViolations = 0;
return violations;
} }
}); });
metrics.addCustomChart(new Metrics.SingleLineChart("glide_violations") { metrics.addCustomChart(new Metrics.SingleLineChart("glide_violations") {
@Override @Override
public int getValue() { public int getValue() {
return glideViolations; int violations = glideViolations;
// Reset so we don't keep sending the same value
glideViolations = 0;
return violations;
}
});
metrics.addCustomChart(new Metrics.SimplePie("protocollib_version") {
@Override
public String getValue() {
return Bukkit.getPluginManager().getPlugin("ProtocolLib").getDescription().getVersion();
} }
}); });
} catch (Exception e) { } catch (Exception e) {
@@ -151,12 +170,9 @@ public class AntiCheat extends JavaPlugin {
} }
private void setupProtocol() { private void setupProtocol() {
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
protocolLib = true;
protocolManager = ProtocolLibrary.getProtocolManager(); protocolManager = ProtocolLibrary.getProtocolManager();
verboseLog("Hooked into ProtocolLib"); verboseLog("Hooked into ProtocolLib");
} }
}
private void setupEvents() { private void setupEvents() {
for (Listener listener : eventList) { for (Listener listener : eventList) {
@@ -222,10 +238,6 @@ public class AntiCheat extends JavaPlugin {
developer = b; developer = b;
} }
public static boolean isUsingProtocolLib() {
return protocolLib;
}
public static void debugLog(final String string) { public static void debugLog(final String string) {
Bukkit.getScheduler().runTask(getPlugin(), new Runnable() { Bukkit.getScheduler().runTask(getPlugin(), new Runnable() {
public void run() { public void run() {
@@ -276,7 +288,7 @@ public class AntiCheat extends JavaPlugin {
} }
public void onGlideViolation() { public void onGlideViolation() {
this.killauraViolations++; this.glideViolations++;
} }
} }
@@ -25,7 +25,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@@ -16,7 +16,7 @@ import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.check.CheckResult; import com.rammelkast.anticheatreloaded.check.CheckResult;
import com.rammelkast.anticheatreloaded.check.CheckType; import com.rammelkast.anticheatreloaded.check.CheckType;
import com.rammelkast.anticheatreloaded.event.EventListener; import com.rammelkast.anticheatreloaded.event.EventListener;
import com.rammelkast.anticheatreloaded.util.NPC_1_11; import com.rammelkast.anticheatreloaded.util.NPC_1_12;
import com.rammelkast.anticheatreloaded.util.VersionUtil; import com.rammelkast.anticheatreloaded.util.VersionUtil;
/** /**
@@ -24,7 +24,7 @@ import com.rammelkast.anticheatreloaded.util.VersionUtil;
*/ */
public class KillAuraCheck { public class KillAuraCheck {
private static final Map<UUID, NPC_1_11> NPC_LIST = new HashMap<UUID, NPC_1_11>(); 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, Integer> VL_COUNT = new HashMap<UUID, Integer>();
public static void cleanPlayer(Player p) { public static void cleanPlayer(Player p) {
@@ -72,7 +72,7 @@ public class KillAuraCheck {
if (NPC_LIST.containsKey(p.getUniqueId())) if (NPC_LIST.containsKey(p.getUniqueId()))
NPC_LIST.get(p.getUniqueId()).damage(e, p); NPC_LIST.get(p.getUniqueId()).damage(e, p);
else { else {
NPC_1_11 npc = new NPC_1_11(p); NPC_1_12 npc = new NPC_1_12(p);
NPC_LIST.put(p.getUniqueId(), npc); NPC_LIST.put(p.getUniqueId(), npc);
npc.spawn(); npc.spawn();
} }
@@ -39,9 +39,9 @@ public class BlinkCheck {
public void onPacketReceiving(PacketEvent e) { public void onPacketReceiving(PacketEvent e) {
Player p = e.getPlayer(); Player p = e.getPlayer();
Location cur = e.getPlayer().getLocation(); Location cur = e.getPlayer().getLocation();
if (!MOVE_COUNT.containsKey(p.getUniqueId())) if (!MOVE_COUNT.containsKey(p.getUniqueId())) {
MOVE_COUNT.put(p.getUniqueId(), 1); MOVE_COUNT.put(p.getUniqueId(), 1);
else { } else {
MOVE_COUNT.put(p.getUniqueId(), MOVE_COUNT.get(p.getUniqueId()) + 1); MOVE_COUNT.put(p.getUniqueId(), MOVE_COUNT.get(p.getUniqueId()) + 1);
if (AntiCheat.getManager().getCheckManager().checkInWorld(p) && !AntiCheat.getManager().getCheckManager().isOpExempt(p) && !AntiCheat.getManager().getCheckManager().isExempt(p, CheckType.BLINK)) { if (AntiCheat.getManager().getCheckManager().checkInWorld(p) && !AntiCheat.getManager().getCheckManager().isOpExempt(p) && !AntiCheat.getManager().getCheckManager().isExempt(p, CheckType.BLINK)) {
if (MOVE_COUNT.get(p.getUniqueId()) > AntiCheat.getManager().getBackend().getMagic().BLINK_PACKET()) { if (MOVE_COUNT.get(p.getUniqueId()) > AntiCheat.getManager().getBackend().getMagic().BLINK_PACKET()) {
@@ -15,8 +15,8 @@ import com.rammelkast.anticheatreloaded.util.Utilities;
import com.rammelkast.anticheatreloaded.util.VersionUtil; import com.rammelkast.anticheatreloaded.util.VersionUtil;
/** /**
* * @author Rammelkast
* @author Marco TODO rewrite this check * TODO rewrite this check
*/ */
public class FlightCheck { public class FlightCheck {
@@ -28,7 +28,7 @@ public class FlightCheck {
public static CheckResult runCheck(Player player, Distance distance) { public static CheckResult runCheck(Player player, Distance distance) {
if (distance.getYDifference() > AntiCheat.getManager().getBackend().getMagic().TELEPORT_MIN() if (distance.getYDifference() > AntiCheat.getManager().getBackend().getMagic().TELEPORT_MIN()
|| VersionUtil.isFlying(player)) { || VersionUtil.isFlying(player)) {
// This was a teleport or user is flying/elyta'ing, so we don't care // This was a teleport or user is flying/using elytra, so we don't care
// about it. // about it.
return PASS; return PASS;
} }
@@ -49,6 +49,8 @@ public class GlideCheck {
Location to = player.getLocation(); Location to = player.getLocation();
to.setY(to.getY() - distanceToFall(to)); to.setY(to.getY() - distanceToFall(to));
player.teleport(to); player.teleport(to);
// Report glide violation to statistics, just for the lulz jk
AntiCheat.getPlugin().onGlideViolation();
return new CheckResult(CheckResult.Result.FAILED, return new CheckResult(CheckResult.Result.FAILED,
player.getName() + " was set back for gliding (yDiff=" + new BigDecimal(yDiff).setScale(2, BigDecimal.ROUND_UP) + ")"); player.getName() + " was set back for gliding (yDiff=" + new BigDecimal(yDiff).setScale(2, BigDecimal.ROUND_UP) + ")");
} else { } else {
@@ -14,6 +14,7 @@ import org.bukkit.entity.Player;
import com.rammelkast.anticheatreloaded.AntiCheat; import com.rammelkast.anticheatreloaded.AntiCheat;
import com.rammelkast.anticheatreloaded.check.CheckResult; import com.rammelkast.anticheatreloaded.check.CheckResult;
import com.rammelkast.anticheatreloaded.util.Utilities; import com.rammelkast.anticheatreloaded.util.Utilities;
import com.rammelkast.anticheatreloaded.util.VersionUtil;
/** /**
* This check seems to be broken/outdated * This check seems to be broken/outdated
@@ -27,14 +28,11 @@ public class WaterWalkCheck {
public static Map<UUID, Integer> waterSpeedViolation = new HashMap<UUID, Integer>(); public static Map<UUID, Integer> waterSpeedViolation = new HashMap<UUID, Integer>();
public static Map<UUID, Integer> waterAscensionViolation = new HashMap<UUID, Integer>(); public static Map<UUID, Integer> waterAscensionViolation = new HashMap<UUID, Integer>();
/**
* TODO check & fix for 1.11? (see #25)
*/
public static CheckResult runCheck(Player player, double x, double y, double z) { public static CheckResult runCheck(Player player, double x, double y, double z) {
Block block = player.getLocation().getBlock(); Block block = player.getLocation().getBlock();
UUID uuid = player.getUniqueId(); UUID uuid = player.getUniqueId();
if (player.getVehicle() == null && !player.isFlying()) { if (player.getVehicle() == null && !player.isFlying() && !VersionUtil.isFrostWalk(player)) {
if (block.isLiquid()) { if (block.isLiquid()) {
if (isInWater.contains(uuid)) { if (isInWater.contains(uuid)) {
if (isInWaterCache.contains(uuid)) { if (isInWaterCache.contains(uuid)) {
@@ -0,0 +1,17 @@
package com.rammelkast.anticheatreloaded.check.player;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
*
* @author Rammelkast
*
*/
public class GhosthandCheck {
public static final Map<UUID, Integer> FLAG_COUNT = new HashMap<UUID, Integer>();
public static final int MAX_FLAGS = 3; // TODO config?
}
@@ -26,6 +26,7 @@ import com.rammelkast.anticheatreloaded.config.yaml.CommentedConfiguration;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader;
public class ConfigurationFile { public class ConfigurationFile {
@@ -59,7 +60,13 @@ public class ConfigurationFile {
this.saveDefault = saveDefault; this.saveDefault = saveDefault;
if (saveDefault) { if (saveDefault) {
defaultConfigFile = YamlConfiguration.loadConfiguration(plugin.getResource(fileName)); InputStreamReader reader = new InputStreamReader(plugin.getResource(fileName));
defaultConfigFile = YamlConfiguration.loadConfiguration(reader);
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
} }
load(); load();
} }
@@ -26,6 +26,8 @@ import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.config.ConfigurationTable; import com.rammelkast.anticheatreloaded.config.ConfigurationTable;
import com.rammelkast.anticheatreloaded.config.providers.Lang; import com.rammelkast.anticheatreloaded.config.providers.Lang;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
@@ -50,7 +52,13 @@ public class MySQLLangHolder extends ConfigurationTable implements InvocationHan
@Override @Override
public void open() { public void open() {
defaults = YamlConfiguration.loadConfiguration(AntiCheat.getPlugin().getResource("lang.yml")); InputStreamReader reader = new InputStreamReader(AntiCheat.getPlugin().getResource("lang.yml"));
defaults = YamlConfiguration.loadConfiguration(reader);
try {
reader.close();
} catch (IOException e1) {
e1.printStackTrace();
}
stringValues = new HashMap<String, String>(); stringValues = new HashMap<String, String>();
listValues = new HashMap<String, List<String>>(); listValues = new HashMap<String, List<String>>();
@@ -26,6 +26,8 @@ import com.rammelkast.anticheatreloaded.config.Configuration;
import com.rammelkast.anticheatreloaded.config.ConfigurationTable; import com.rammelkast.anticheatreloaded.config.ConfigurationTable;
import com.rammelkast.anticheatreloaded.config.providers.Magic; import com.rammelkast.anticheatreloaded.config.providers.Magic;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.sql.ResultSet; import java.sql.ResultSet;
@@ -47,7 +49,13 @@ public class MySQLMagicHolder extends ConfigurationTable implements InvocationHa
@Override @Override
public void open() { public void open() {
defaults = YamlConfiguration.loadConfiguration(AntiCheat.getPlugin().getResource("magic.yml")); InputStreamReader reader = new InputStreamReader(AntiCheat.getPlugin().getResource("magic.yml"));
defaults = YamlConfiguration.loadConfiguration(reader);
try {
reader.close();
} catch (IOException e1) {
e1.printStackTrace();
}
ints = new HashMap<String, Integer>(); ints = new HashMap<String, Integer>();
doubles = new HashMap<String, Double>(); doubles = new HashMap<String, Double>();
@@ -33,6 +33,7 @@ import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayDeque; import java.util.ArrayDeque;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -188,7 +189,9 @@ public class CommentedConfiguration extends YamlConfiguration {
CommentedConfiguration config = new CommentedConfiguration(); CommentedConfiguration config = new CommentedConfiguration();
try { try {
config.load(stream); InputStreamReader reader = new InputStreamReader(stream);
config.load(reader);
reader.close();
} catch (IOException ex) { } catch (IOException ex) {
Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration from stream", ex); Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration from stream", ex);
} catch (InvalidConfigurationException ex) { } catch (InvalidConfigurationException ex) {
@@ -18,6 +18,11 @@
package com.rammelkast.anticheatreloaded.manage; package com.rammelkast.anticheatreloaded.manage;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.bukkit.BanList.Type;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@@ -28,10 +33,6 @@ import com.rammelkast.anticheatreloaded.util.Group;
import com.rammelkast.anticheatreloaded.util.User; import com.rammelkast.anticheatreloaded.util.User;
import com.rammelkast.anticheatreloaded.util.Utilities; import com.rammelkast.anticheatreloaded.util.Utilities;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class UserManager { public class UserManager {
private List<User> users = new ArrayList<User>(); private List<User> users = new ArrayList<User>();
private static AntiCheatManager manager; private static AntiCheatManager manager;
@@ -243,7 +244,7 @@ public class UserManager {
} }
} }
} else if (event.equalsIgnoreCase("BAN")) { } else if (event.equalsIgnoreCase("BAN")) {
user.getPlayer().setBanned(true); Bukkit.getBanList(Type.NAME).addBan(user.getPlayer().getName(), RED + banReason, null, null);
user.getPlayer().kickPlayer(RED + banReason); user.getPlayer().kickPlayer(RED + banReason);
String msg = RED + config.getLang().BAN_BROADCAST().replaceAll("&player", name) + " (" + CheckType.getName(type) + ")"; String msg = RED + config.getLang().BAN_BROADCAST().replaceAll("&player", name) + " (" + CheckType.getName(type) + ")";
if (!msg.equals("")) { if (!msg.equals("")) {
@@ -3,6 +3,7 @@ package com.rammelkast.anticheatreloaded.util;
import java.util.EnumSet; import java.util.EnumSet;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
public class NMS_1_9_PLUS { public class NMS_1_9_PLUS {
@@ -15,4 +16,6 @@ public class NMS_1_9_PLUS {
static final PotionEffectType LEVITATION = PotionEffectType.LEVITATION; static final PotionEffectType LEVITATION = PotionEffectType.LEVITATION;
static final Enchantment FROST_WALKER = Enchantment.FROST_WALKER;
} }
@@ -5,9 +5,9 @@ import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_11_R1.CraftServer; import org.bukkit.craftbukkit.v1_12_R1.CraftServer;
import org.bukkit.craftbukkit.v1_11_R1.CraftWorld; import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
@@ -17,19 +17,19 @@ import org.bukkit.util.Vector;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import com.rammelkast.anticheatreloaded.AntiCheat; import com.rammelkast.anticheatreloaded.AntiCheat;
import net.minecraft.server.v1_11_R1.EntityHuman; import net.minecraft.server.v1_12_R1.EntityHuman;
import net.minecraft.server.v1_11_R1.EntityPlayer; import net.minecraft.server.v1_12_R1.EntityPlayer;
import net.minecraft.server.v1_11_R1.MinecraftServer; import net.minecraft.server.v1_12_R1.MinecraftServer;
import net.minecraft.server.v1_11_R1.PacketPlayOutEntityMetadata; import net.minecraft.server.v1_12_R1.PacketPlayOutEntityMetadata;
import net.minecraft.server.v1_11_R1.PacketPlayOutEntityTeleport; import net.minecraft.server.v1_12_R1.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_11_R1.PacketPlayOutNamedEntitySpawn; import net.minecraft.server.v1_12_R1.PacketPlayOutNamedEntitySpawn;
import net.minecraft.server.v1_11_R1.PacketPlayOutPlayerInfo; import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerInfo;
import net.minecraft.server.v1_11_R1.PlayerConnection; import net.minecraft.server.v1_12_R1.PlayerConnection;
import net.minecraft.server.v1_11_R1.PlayerInteractManager; import net.minecraft.server.v1_12_R1.PlayerInteractManager;
import net.minecraft.server.v1_11_R1.World; import net.minecraft.server.v1_12_R1.World;
import net.minecraft.server.v1_11_R1.WorldServer; import net.minecraft.server.v1_12_R1.WorldServer;
public class NPC_1_11 { public class NPC_1_12 {
private final UUID owner; private final UUID owner;
private final String name; private final String name;
@@ -42,7 +42,7 @@ public class NPC_1_11 {
return this.entityId; return this.entityId;
} }
public NPC_1_11(Player owner) { public NPC_1_12(Player owner) {
this.owner = owner.getUniqueId(); this.owner = owner.getUniqueId();
this.name = NameGenerator.generateName(); this.name = NameGenerator.generateName();
Location eyelocation = owner.getEyeLocation(); Location eyelocation = owner.getEyeLocation();
@@ -19,7 +19,7 @@ public class VersionUtil {
Material.SPRUCE_WOOD_STAIRS, Material.WOOD_STAIRS); Material.SPRUCE_WOOD_STAIRS, Material.WOOD_STAIRS);
public static boolean isFlying(Player p) { public static boolean isFlying(Player p) {
if (getVersion().equals("v1_9_R1") || getVersion().equals("v1_10_R1") || getVersion().equals("v1_11_R1")) { 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); return p.isFlying() || p.isGliding() || p.hasPotionEffect(NMS_1_9_PLUS.LEVITATION);
} else { } else {
return p.isFlying(); return p.isFlying();
@@ -27,7 +27,7 @@ public class VersionUtil {
} }
public static EnumSet<Material> getMoveUpBlocks() { public static EnumSet<Material> getMoveUpBlocks() {
if (getVersion().equals("v1_9_R1") || getVersion().equals("v1_10_R1") || getVersion().equals("v1_11_R1")) { 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; return NMS_1_9_PLUS.MOVE_UP_BLOCKS_1_9;
} else { } else {
return MOVE_UP_BLOCKS_1_8; return MOVE_UP_BLOCKS_1_8;
@@ -35,7 +35,7 @@ public class VersionUtil {
} }
public static boolean isNewYSpeed() { public static boolean isNewYSpeed() {
if (getVersion().equals("v1_9_R1") || getVersion().equals("v1_10_R1") || getVersion().equals("v1_11_R1")) { if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
return true; return true;
} else { } else {
return false; return false;
@@ -43,11 +43,19 @@ public class VersionUtil {
} }
public static long getHealTime() { public static long getHealTime() {
if (getVersion().equals("v1_9_R1") || getVersion().equals("v1_10_R1") || getVersion().equals("v1_11_R1")) { if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
return 495; return 495;
} else { } else {
return 1995; return 1995;
} }
} }
public static boolean isFrostWalk(Player player) {
if (getVersion().startsWith("v1_9") || getVersion().startsWith("v1_10") || getVersion().startsWith("v1_11") || getVersion().startsWith("v1_12")) {
return player.getInventory().getBoots().containsEnchantment(NMS_1_9_PLUS.FROST_WALKER);
} else {
return false;
}
}
} }
+1 -1
View File
@@ -2,7 +2,7 @@ name: AntiCheatReloaded
author: Rammelkast author: Rammelkast
description: AntiCheatReloaded helps easily identify and block malicious users on your server. description: AntiCheatReloaded helps easily identify and block malicious users on your server.
main: com.rammelkast.anticheatreloaded.AntiCheat main: com.rammelkast.anticheatreloaded.AntiCheat
softdepend: [ProtocolLib] depend: [ProtocolLib]
startup: postworld startup: postworld
version: ${project.build.version} version: ${project.build.version}
commands: commands: