mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 22:15:28 +00:00
Compare commits
4
Commits
1.9.4-PRE1
...
1.9.4-PRE2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fad298086c | ||
|
|
8b413a382a | ||
|
|
1428b55591 | ||
|
|
a84b573fa8 |
No files matched your search
@@ -78,8 +78,9 @@ public class AntiCheatReloaded extends JavaPlugin {
|
|||||||
eventList.add(new VehicleListener());
|
eventList.add(new VehicleListener());
|
||||||
eventList.add(new InventoryListener());
|
eventList.add(new InventoryListener());
|
||||||
// Handles 1.9+ potion effects
|
// Handles 1.9+ potion effects
|
||||||
if (!VersionUtil.isBountifulUpdate())
|
if (!VersionUtil.isBountifulUpdate()) {
|
||||||
eventList.add(new PotionEffectListener());
|
eventList.add(new PotionEffectListener());
|
||||||
|
}
|
||||||
// Order is important in some cases, don't screw with these unless
|
// Order is important in some cases, don't screw with these unless
|
||||||
// needed, especially config
|
// needed, especially config
|
||||||
this.setupConfig();
|
this.setupConfig();
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ public class SpeedCheck {
|
|||||||
double limit = checksConfig.getDouble(CheckType.SPEED, "airAcceleration", "baseLimit"); // Default 0.3725
|
double limit = checksConfig.getDouble(CheckType.SPEED, "airAcceleration", "baseLimit"); // Default 0.3725
|
||||||
// Slight increase when boxed in
|
// Slight increase when boxed in
|
||||||
if (boxedIn)
|
if (boxedIn)
|
||||||
limit *= 1.05D;
|
limit *= 1.08D;
|
||||||
// Adjust for speed effects
|
// Adjust for speed effects
|
||||||
if (player.hasPotionEffect(PotionEffectType.SPEED))
|
if (player.hasPotionEffect(PotionEffectType.SPEED))
|
||||||
limit += VersionUtil.getPotionLevel(player, PotionEffectType.SPEED) * 0.0225D;
|
limit += VersionUtil.getPotionLevel(player, PotionEffectType.SPEED) * 0.0225D;
|
||||||
|
|||||||
+23
-19
@@ -16,7 +16,6 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.command.executors;
|
package com.rammelkast.anticheatreloaded.command.executors;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -25,8 +24,8 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
import com.rammelkast.anticheatreloaded.check.CheckType;
|
import com.rammelkast.anticheatreloaded.check.CheckType;
|
||||||
@@ -45,8 +44,7 @@ public class CommandReport extends CommandBase {
|
|||||||
private static final String[] HELP = {
|
private static final String[] HELP = {
|
||||||
GRAY + "Use: " + GOLD + "/anticheat report [group]" + GRAY + " to see all users in a given group",
|
GRAY + "Use: " + GOLD + "/anticheat report [group]" + GRAY + " to see all users in a given group",
|
||||||
GRAY + "Use: " + GOLD + "/anticheat report [user]" + GRAY + " to see a single user's report",
|
GRAY + "Use: " + GOLD + "/anticheat report [user]" + GRAY + " to see a single user's report",
|
||||||
GRAY + "Use: " + GOLD + "/anticheat report [user/group] [num]" + GRAY + " to see pages of a report",
|
GRAY + "Use: " + GOLD + "/anticheat report [user/group] [num]" + GRAY + " to see pages of a report", };
|
||||||
};
|
|
||||||
|
|
||||||
public CommandReport() {
|
public CommandReport() {
|
||||||
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
super(NAME, COMMAND, USAGE, HELP, PERMISSION);
|
||||||
@@ -66,39 +64,37 @@ public class CommandReport extends CommandBase {
|
|||||||
|
|
||||||
if ("low".equalsIgnoreCase(args[0])) {
|
if ("low".equalsIgnoreCase(args[0])) {
|
||||||
groupReport(cs, null, page);
|
groupReport(cs, null, page);
|
||||||
}
|
} else if ("all".equalsIgnoreCase(args[0])) {
|
||||||
else if ("all".equalsIgnoreCase(args[0])) {
|
|
||||||
cs.sendMessage(GREEN + "Low: " + WHITE + USER_MANAGER.getUsersInGroup(null).size() + " players");
|
cs.sendMessage(GREEN + "Low: " + WHITE + USER_MANAGER.getUsersInGroup(null).size() + " players");
|
||||||
for (Group g : CONFIG.getGroups().getGroups()) {
|
for (Group g : CONFIG.getGroups().getGroups()) {
|
||||||
int numPlayers = USER_MANAGER.getUsersInGroup(g).size();
|
int numPlayers = USER_MANAGER.getUsersInGroup(g).size();
|
||||||
cs.sendMessage(g.getColor() + g.getName() + WHITE + ": " + numPlayers + " players");
|
cs.sendMessage(g.getColor() + g.getName() + WHITE + ": " + numPlayers + " players");
|
||||||
}
|
}
|
||||||
cs.sendMessage(GRAY + "Use " + GOLD + "/anticheat report [group]" + GRAY + " for a list of players in each group.");
|
cs.sendMessage(GRAY + "Use " + GOLD + "/anticheat report [group]" + GRAY
|
||||||
|
+ " for a list of players in each group.");
|
||||||
} else {
|
} else {
|
||||||
// Test groups
|
// Test groups
|
||||||
for (Group group : CONFIG.getGroups().getGroups()) {
|
for (Group group : CONFIG.getGroups().getGroups()) {
|
||||||
if (group.getName().equalsIgnoreCase(args[0]) || "low".equalsIgnoreCase(args[0]) || "all".equalsIgnoreCase(args[0])) {
|
if (group.getName().equalsIgnoreCase(args[0]) || "low".equalsIgnoreCase(args[0])
|
||||||
|
|| "all".equalsIgnoreCase(args[0])) {
|
||||||
groupReport(cs, group, page);
|
groupReport(cs, group, page);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Player targetPlayer = Bukkit.getPlayer(args[0]);
|
@SuppressWarnings("deprecation")
|
||||||
|
OfflinePlayer targetPlayer = Bukkit.getOfflinePlayer(args[0]);
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
cs.sendMessage(RED + "Not a valid group or user: " + WHITE + args[0]);
|
cs.sendMessage(RED + "Not a valid group or user: " + WHITE + args[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test users
|
User user = AntiCheatReloaded.getManager().getUserManager().getUser(targetPlayer.getUniqueId());
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
if (user != null) {
|
||||||
if (player.getUniqueId().equals(Bukkit.getPlayer(args[0]).getUniqueId())) {
|
|
||||||
User user = AntiCheatReloaded.getManager().getUserManager().getUser(player.getUniqueId());
|
|
||||||
playerReport(cs, user, page);
|
playerReport(cs, user, page);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Neither of these
|
|
||||||
cs.sendMessage(RED + "Not a valid group or user: " + WHITE + args[0]);
|
cs.sendMessage(RED + "Not a valid group or user: " + WHITE + args[0]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -112,7 +108,8 @@ public class CommandReport extends CommandBase {
|
|||||||
String groupName = group == null ? "Low" : group.getName();
|
String groupName = group == null ? "Low" : group.getName();
|
||||||
int pages = (int) Math.ceil(((float) users.size()) / 7);
|
int pages = (int) Math.ceil(((float) users.size()) / 7);
|
||||||
if (page <= pages && page > 0) {
|
if (page <= pages && page > 0) {
|
||||||
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page " + page + "/" + pages + "" + GOLD + "]----------------------");
|
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page " + page + "/" + pages + "" + GOLD
|
||||||
|
+ "]----------------------");
|
||||||
cs.sendMessage(GRAY + "Group: " + color + groupName);
|
cs.sendMessage(GRAY + "Group: " + color + groupName);
|
||||||
for (int x = 0; x < 7; x++) {
|
for (int x = 0; x < 7; x++) {
|
||||||
int index = ((page - 1) * 6) + (x + ((page - 1) * 1));
|
int index = ((page - 1) * 6) + (x + ((page - 1) * 1));
|
||||||
@@ -155,9 +152,13 @@ public class CommandReport extends CommandBase {
|
|||||||
groupString += " (" + user.getLevel() + ")";
|
groupString += " (" + user.getLevel() + ")";
|
||||||
|
|
||||||
if (page <= pages && page > 0) {
|
if (page <= pages && page > 0) {
|
||||||
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page " + page + "/" + pages + "" + GOLD + "]----------------------");
|
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page " + page + "/" + pages + "" + GOLD
|
||||||
|
+ "]----------------------");
|
||||||
cs.sendMessage(GRAY + "Player: " + WHITE + name);
|
cs.sendMessage(GRAY + "Player: " + WHITE + name);
|
||||||
cs.sendMessage(GRAY + "Ping: " + WHITE + user.getPing() + "ms " + (user.isLagging() ? ChatColor.RED + "(lagging)" : ChatColor.GREEN + "(not lagging)"));
|
int ping = user.getPing();
|
||||||
|
cs.sendMessage(GRAY + "Ping: " + ((ping == -1) ? (RED + "Offline")
|
||||||
|
: (WHITE + "" + ping + "ms "
|
||||||
|
+ (user.isLagging() ? ChatColor.RED + "(lagging)" : ChatColor.GREEN + "(not lagging)"))));
|
||||||
cs.sendMessage(GRAY + "Group: " + groupString);
|
cs.sendMessage(GRAY + "Group: " + groupString);
|
||||||
for (int x = 0; x < 6; x++) {
|
for (int x = 0; x < 6; x++) {
|
||||||
int index = ((page - 1) * 5) + (x + ((page - 1)));
|
int index = ((page - 1) * 5) + (x + ((page - 1)));
|
||||||
@@ -178,7 +179,10 @@ public class CommandReport extends CommandBase {
|
|||||||
if (pages == 0 && page == 1) {
|
if (pages == 0 && page == 1) {
|
||||||
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page 1/1" + GOLD + "]----------------------");
|
cs.sendMessage(GOLD + "----------------------[" + GRAY + "Page 1/1" + GOLD + "]----------------------");
|
||||||
cs.sendMessage(GRAY + "Player: " + WHITE + name);
|
cs.sendMessage(GRAY + "Player: " + WHITE + name);
|
||||||
cs.sendMessage(GRAY + "Ping: " + WHITE + user.getPing() + "ms " + (user.isLagging() ? ChatColor.RED + "(lagging)" : ChatColor.GREEN + "(not lagging)"));
|
int ping = user.getPing();
|
||||||
|
cs.sendMessage(GRAY + "Ping: " + ((ping == -1) ? (RED + "Offline")
|
||||||
|
: (WHITE + "" + ping + "ms "
|
||||||
|
+ (user.isLagging() ? ChatColor.RED + "(lagging)" : ChatColor.GREEN + "(not lagging)"))));
|
||||||
cs.sendMessage(GRAY + "Group: " + groupString);
|
cs.sendMessage(GRAY + "Group: " + groupString);
|
||||||
cs.sendMessage(GRAY + "This user has not failed any checks.");
|
cs.sendMessage(GRAY + "This user has not failed any checks.");
|
||||||
cs.sendMessage(MENU_END);
|
cs.sendMessage(MENU_END);
|
||||||
|
|||||||
@@ -40,15 +40,14 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.util.BoundingBox;
|
import org.bukkit.util.BoundingBox;
|
||||||
import org.bukkit.util.NumberConversions;
|
import org.bukkit.util.NumberConversions;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.utility.MinecraftVersion;
|
||||||
|
|
||||||
public final class Utilities {
|
public final class Utilities {
|
||||||
private static final List<Material> INSTANT_BREAK = new ArrayList<Material>();
|
private static final List<Material> INSTANT_BREAK = new ArrayList<Material>();
|
||||||
private static final List<Material> FOOD = new ArrayList<Material>();
|
private static final List<Material> FOOD = new ArrayList<Material>();
|
||||||
private static final List<Material> CLIMBABLE = new ArrayList<Material>();
|
private static final List<Material> CLIMBABLE = new ArrayList<Material>();
|
||||||
private static final Map<Material, Material> COMBO = new HashMap<Material, Material>();
|
private static final Map<Material, Material> COMBO = new HashMap<Material, Material>();
|
||||||
|
|
||||||
public static final Material LILY_PAD;
|
|
||||||
public static final Material COB_WEB;
|
|
||||||
|
|
||||||
public static final double JUMP_MOTION_Y = 0.41999998688697815;
|
public static final double JUMP_MOTION_Y = 0.41999998688697815;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -188,8 +187,10 @@ public final class Utilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isNearShulkerBox(Location location) {
|
public static boolean isNearShulkerBox(Location location) {
|
||||||
if (VersionUtil.isBountifulUpdate())
|
// Shulkers are 1.12+
|
||||||
|
if (MinecraftVersion.getCurrentVersion().isAtLeast(MinecraftVersion.COLOR_UPDATE)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return isShulkerBox(location.getBlock()) || isShulkerBox(location.getBlock().getRelative(BlockFace.NORTH))
|
return isShulkerBox(location.getBlock()) || isShulkerBox(location.getBlock().getRelative(BlockFace.NORTH))
|
||||||
|| isShulkerBox(location.getBlock().getRelative(BlockFace.SOUTH))
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.SOUTH))
|
||||||
|| isShulkerBox(location.getBlock().getRelative(BlockFace.EAST))
|
|| isShulkerBox(location.getBlock().getRelative(BlockFace.EAST))
|
||||||
@@ -225,7 +226,8 @@ public final class Utilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isHalfblock(Block block) {
|
public static boolean isHalfblock(Block block) {
|
||||||
if (!VersionUtil.isBountifulUpdate()) {
|
// getBoundingBox() is only available on 1.14+
|
||||||
|
if (MinecraftVersion.getCurrentVersion().isAtLeast(MinecraftVersion.VILLAGE_UPDATE)) {
|
||||||
BoundingBox box = block.getBoundingBox();
|
BoundingBox box = block.getBoundingBox();
|
||||||
double height = box.getMaxY() - box.getMinY();
|
double height = box.getMaxY() - box.getMinY();
|
||||||
if (height > 0.42 && height <= 0.6 && block.getType().isSolid())
|
if (height > 0.42 && height <= 0.6 && block.getType().isSolid())
|
||||||
@@ -431,10 +433,11 @@ public final class Utilities {
|
|||||||
*/
|
*/
|
||||||
public static boolean isOnLilyPad(Player player) {
|
public static boolean isOnLilyPad(Player player) {
|
||||||
Block block = player.getLocation().getBlock();
|
Block block = player.getLocation().getBlock();
|
||||||
return block.getType() == LILY_PAD || block.getRelative(BlockFace.NORTH).getType() == LILY_PAD
|
return block.getType() == XMaterial.LILY_PAD.parseMaterial()
|
||||||
|| block.getRelative(BlockFace.SOUTH).getType() == LILY_PAD
|
|| block.getRelative(BlockFace.NORTH).getType() == XMaterial.LILY_PAD.parseMaterial()
|
||||||
|| block.getRelative(BlockFace.EAST).getType() == LILY_PAD
|
|| block.getRelative(BlockFace.SOUTH).getType() == XMaterial.LILY_PAD.parseMaterial()
|
||||||
|| block.getRelative(BlockFace.WEST).getType() == LILY_PAD;
|
|| block.getRelative(BlockFace.EAST).getType() == XMaterial.LILY_PAD.parseMaterial()
|
||||||
|
|| block.getRelative(BlockFace.WEST).getType() == XMaterial.LILY_PAD.parseMaterial();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -458,7 +461,7 @@ public final class Utilities {
|
|||||||
return player.getLocation().getBlock().isLiquid()
|
return player.getLocation().getBlock().isLiquid()
|
||||||
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid()
|
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid()
|
||||||
|| player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid()
|
|| player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid()
|
||||||
|| (!VersionUtil.isBountifulUpdate()
|
|| (MinecraftVersion.getCurrentVersion().isAtLeast(MinecraftVersion.AQUATIC_UPDATE)
|
||||||
&& (player.getLocation().getBlock().getType() == XMaterial.KELP_PLANT.parseMaterial()
|
&& (player.getLocation().getBlock().getType() == XMaterial.KELP_PLANT.parseMaterial()
|
||||||
|| player.getLocation().getBlock().getRelative(BlockFace.UP)
|
|| player.getLocation().getBlock().getRelative(BlockFace.UP)
|
||||||
.getType() == XMaterial.KELP_PLANT.parseMaterial()
|
.getType() == XMaterial.KELP_PLANT.parseMaterial()
|
||||||
@@ -521,7 +524,6 @@ public final class Utilities {
|
|||||||
|| isWeb(player.getLocation().getBlock().getRelative(BlockFace.WEST));
|
|| isWeb(player.getLocation().getBlock().getRelative(BlockFace.WEST));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether a block is a web
|
* Determine whether a block is a web
|
||||||
*
|
*
|
||||||
@@ -529,7 +531,7 @@ public final class Utilities {
|
|||||||
* @return true if web
|
* @return true if web
|
||||||
*/
|
*/
|
||||||
public static boolean isWeb(Block block) {
|
public static boolean isWeb(Block block) {
|
||||||
return block.getType() == COB_WEB;
|
return block.getType() == XMaterial.COBWEB.parseMaterial();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -539,9 +541,11 @@ public final class Utilities {
|
|||||||
* @return true if in web
|
* @return true if in web
|
||||||
*/
|
*/
|
||||||
public static boolean isInWeb(Player player) {
|
public static boolean isInWeb(Player player) {
|
||||||
return player.getLocation().getBlock().getType() == COB_WEB
|
return player.getLocation().getBlock().getType() == XMaterial.COBWEB.parseMaterial()
|
||||||
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == COB_WEB
|
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == XMaterial.COBWEB
|
||||||
|| player.getLocation().getBlock().getRelative(BlockFace.UP).getType() == COB_WEB;
|
.parseMaterial()
|
||||||
|
|| player.getLocation().getBlock().getRelative(BlockFace.UP).getType() == XMaterial.COBWEB
|
||||||
|
.parseMaterial();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -779,7 +783,7 @@ public final class Utilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isHoneyBlock(Block block) {
|
public static boolean isHoneyBlock(Block block) {
|
||||||
if (!VersionUtil.isOfVersion("v1_15")) {
|
if (MinecraftVersion.getCurrentVersion().isAtLeast(MinecraftVersion.BEE_UPDATE)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return block.getType() == XMaterial.HONEY_BLOCK.parseMaterial();
|
return block.getType() == XMaterial.HONEY_BLOCK.parseMaterial();
|
||||||
@@ -788,9 +792,6 @@ public final class Utilities {
|
|||||||
static {
|
static {
|
||||||
// Start 1.8.8
|
// Start 1.8.8
|
||||||
if (VersionUtil.isBountifulUpdate()) {
|
if (VersionUtil.isBountifulUpdate()) {
|
||||||
LILY_PAD = XMaterial.LILY_PAD.parseMaterial();
|
|
||||||
COB_WEB = XMaterial.COBWEB.parseMaterial();
|
|
||||||
|
|
||||||
// Start instant break materials
|
// Start instant break materials
|
||||||
INSTANT_BREAK.add(XMaterial.COMPARATOR.parseMaterial());
|
INSTANT_BREAK.add(XMaterial.COMPARATOR.parseMaterial());
|
||||||
INSTANT_BREAK.add(XMaterial.REPEATER.parseMaterial());
|
INSTANT_BREAK.add(XMaterial.REPEATER.parseMaterial());
|
||||||
@@ -807,7 +808,7 @@ public final class Utilities {
|
|||||||
INSTANT_BREAK.add(Material.DEAD_BUSH);
|
INSTANT_BREAK.add(Material.DEAD_BUSH);
|
||||||
INSTANT_BREAK.add(Material.GRASS);
|
INSTANT_BREAK.add(Material.GRASS);
|
||||||
INSTANT_BREAK.add(XMaterial.TALL_GRASS.parseMaterial());
|
INSTANT_BREAK.add(XMaterial.TALL_GRASS.parseMaterial());
|
||||||
INSTANT_BREAK.add(LILY_PAD);
|
INSTANT_BREAK.add(XMaterial.LILY_PAD.parseMaterial());
|
||||||
INSTANT_BREAK.add(Material.MELON_STEM);
|
INSTANT_BREAK.add(Material.MELON_STEM);
|
||||||
INSTANT_BREAK.add(Material.MELON_STEM);
|
INSTANT_BREAK.add(Material.MELON_STEM);
|
||||||
INSTANT_BREAK.add(Material.BROWN_MUSHROOM);
|
INSTANT_BREAK.add(Material.BROWN_MUSHROOM);
|
||||||
@@ -856,10 +857,10 @@ public final class Utilities {
|
|||||||
// Start combos
|
// Start combos
|
||||||
COMBO.put(Material.SHEARS, XMaterial.WHITE_WOOL.parseMaterial());
|
COMBO.put(Material.SHEARS, XMaterial.WHITE_WOOL.parseMaterial());
|
||||||
|
|
||||||
COMBO.put(Material.IRON_SWORD, COB_WEB);
|
COMBO.put(Material.IRON_SWORD, XMaterial.COBWEB.parseMaterial());
|
||||||
COMBO.put(Material.DIAMOND_SWORD, COB_WEB);
|
COMBO.put(Material.DIAMOND_SWORD, XMaterial.COBWEB.parseMaterial());
|
||||||
COMBO.put(Material.STONE_SWORD, COB_WEB);
|
COMBO.put(Material.STONE_SWORD, XMaterial.COBWEB.parseMaterial());
|
||||||
COMBO.put(XMaterial.WOODEN_SWORD.parseMaterial(), COB_WEB);
|
COMBO.put(XMaterial.WOODEN_SWORD.parseMaterial(), XMaterial.COBWEB.parseMaterial());
|
||||||
// End combos
|
// End combos
|
||||||
|
|
||||||
// Start climbable
|
// Start climbable
|
||||||
@@ -871,8 +872,7 @@ public final class Utilities {
|
|||||||
// End 1.8.8
|
// End 1.8.8
|
||||||
// Start other version
|
// Start other version
|
||||||
else {
|
else {
|
||||||
LILY_PAD = Material.LILY_PAD;
|
MinecraftVersion currentVersion = MinecraftVersion.getCurrentVersion();
|
||||||
COB_WEB = Material.COBWEB;
|
|
||||||
|
|
||||||
// Start instant break materials
|
// Start instant break materials
|
||||||
INSTANT_BREAK.add(Material.COMPARATOR);
|
INSTANT_BREAK.add(Material.COMPARATOR);
|
||||||
@@ -918,14 +918,13 @@ public final class Utilities {
|
|||||||
INSTANT_BREAK.add(Material.TALL_SEAGRASS);
|
INSTANT_BREAK.add(Material.TALL_SEAGRASS);
|
||||||
INSTANT_BREAK.add(Material.WHEAT);
|
INSTANT_BREAK.add(Material.WHEAT);
|
||||||
// Start 1.14 objects
|
// Start 1.14 objects
|
||||||
if (VersionUtil.isOfVersion("v1_14") || VersionUtil.isOfVersion("v1_15")
|
if (currentVersion.isAtLeast(MinecraftVersion.VILLAGE_UPDATE)) {
|
||||||
|| VersionUtil.isOfVersion("v1_16")) {
|
|
||||||
INSTANT_BREAK.add(Material.BAMBOO_SAPLING);
|
INSTANT_BREAK.add(Material.BAMBOO_SAPLING);
|
||||||
INSTANT_BREAK.add(Material.CORNFLOWER);
|
INSTANT_BREAK.add(Material.CORNFLOWER);
|
||||||
}
|
}
|
||||||
// End 1.14 objects
|
// End 1.14 objects
|
||||||
// Start 1.15 objects
|
// Start 1.15 objects
|
||||||
if (VersionUtil.isOfVersion("v1_15") || VersionUtil.isOfVersion("v1_16")) {
|
if (currentVersion.isAtLeast(MinecraftVersion.BEE_UPDATE)) {
|
||||||
INSTANT_BREAK.add(Material.HONEY_BLOCK);
|
INSTANT_BREAK.add(Material.HONEY_BLOCK);
|
||||||
}
|
}
|
||||||
// End 1.15 objects
|
// End 1.15 objects
|
||||||
@@ -970,14 +969,13 @@ public final class Utilities {
|
|||||||
FOOD.add(Material.SPIDER_EYE);
|
FOOD.add(Material.SPIDER_EYE);
|
||||||
FOOD.add(Material.TROPICAL_FISH);
|
FOOD.add(Material.TROPICAL_FISH);
|
||||||
// Start 1.14 objects
|
// Start 1.14 objects
|
||||||
if (VersionUtil.isOfVersion("v1_14") || VersionUtil.isOfVersion("v1_15")
|
if (currentVersion.isAtLeast(MinecraftVersion.VILLAGE_UPDATE)) {
|
||||||
|| VersionUtil.isOfVersion("v1_16")) {
|
|
||||||
FOOD.add(Material.SUSPICIOUS_STEW);
|
FOOD.add(Material.SUSPICIOUS_STEW);
|
||||||
FOOD.add(Material.SWEET_BERRIES);
|
FOOD.add(Material.SWEET_BERRIES);
|
||||||
}
|
}
|
||||||
// End 1.14 objects
|
// End 1.14 objects
|
||||||
// Start 1.15 objects
|
// Start 1.15 objects
|
||||||
if (VersionUtil.isOfVersion("v1_15") || VersionUtil.isOfVersion("v1_16")) {
|
if (currentVersion.isAtLeast(MinecraftVersion.BEE_UPDATE)) {
|
||||||
FOOD.add(Material.HONEY_BOTTLE);
|
FOOD.add(Material.HONEY_BOTTLE);
|
||||||
}
|
}
|
||||||
// End 1.15 objects
|
// End 1.15 objects
|
||||||
@@ -1013,15 +1011,14 @@ public final class Utilities {
|
|||||||
CLIMBABLE.add(Material.LADDER);
|
CLIMBABLE.add(Material.LADDER);
|
||||||
CLIMBABLE.add(Material.WATER);
|
CLIMBABLE.add(Material.WATER);
|
||||||
// Start 1.14 objects
|
// Start 1.14 objects
|
||||||
if (VersionUtil.isOfVersion("v1_14") || VersionUtil.isOfVersion("v1_15")
|
if (currentVersion.isAtLeast(MinecraftVersion.VILLAGE_UPDATE)) {
|
||||||
|| VersionUtil.isOfVersion("v1_16")) {
|
|
||||||
CLIMBABLE.add(Material.SCAFFOLDING);
|
CLIMBABLE.add(Material.SCAFFOLDING);
|
||||||
CLIMBABLE.add(Material.SWEET_BERRY_BUSH);
|
CLIMBABLE.add(Material.SWEET_BERRY_BUSH);
|
||||||
}
|
}
|
||||||
// End 1.14 objects
|
// End 1.14 objects
|
||||||
|
|
||||||
// Start 1.16 objects
|
// Start 1.16 objects
|
||||||
if (VersionUtil.isOfVersion("v1_16")) {
|
if (currentVersion.isAtLeast(MinecraftVersion.NETHER_UPDATE)) {
|
||||||
CLIMBABLE.add(XMaterial.TWISTING_VINES.parseMaterial());
|
CLIMBABLE.add(XMaterial.TWISTING_VINES.parseMaterial());
|
||||||
CLIMBABLE.add(XMaterial.TWISTING_VINES_PLANT.parseMaterial());
|
CLIMBABLE.add(XMaterial.TWISTING_VINES_PLANT.parseMaterial());
|
||||||
CLIMBABLE.add(XMaterial.WEEPING_VINES.parseMaterial());
|
CLIMBABLE.add(XMaterial.WEEPING_VINES.parseMaterial());
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.rammelkast.anticheatreloaded.util;
|
package com.rammelkast.anticheatreloaded.util;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -32,12 +31,13 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.utility.MinecraftVersion;
|
||||||
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
import com.rammelkast.anticheatreloaded.AntiCheatReloaded;
|
||||||
|
|
||||||
public class VersionUtil {
|
public class VersionUtil {
|
||||||
|
|
||||||
private static final List<String> SUPPORTED_VERSIONS = Arrays
|
private static final List<String> SUPPORTED_VERSIONS;
|
||||||
.asList(new String[] { "v1_16", "v1_15", "v1_14", "v1_13", "v1_8_R3" });
|
private static final MinecraftVersion CURRENT_VERSION;
|
||||||
|
|
||||||
public static String getVersion() {
|
public static String getVersion() {
|
||||||
return Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
|
return Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
|
||||||
@@ -75,14 +75,14 @@ public class VersionUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isRiptiding(Player player) {
|
public static boolean isRiptiding(Player player) {
|
||||||
if (isBountifulUpdate()) {
|
if (!CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return player.isRiptiding();
|
return player.isRiptiding();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSlowFalling(Player player) {
|
public static boolean isSlowFalling(Player player) {
|
||||||
if (isBountifulUpdate()) {
|
if (!CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return player.hasPotionEffect(PotionEffectType.SLOW_FALLING);
|
return player.hasPotionEffect(PotionEffectType.SLOW_FALLING);
|
||||||
@@ -149,9 +149,14 @@ public class VersionUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSwimming(Player player) {
|
public static boolean isSwimming(Player player) {
|
||||||
if (isBountifulUpdate()) {
|
if (!CURRENT_VERSION.isAtLeast(MinecraftVersion.AQUATIC_UPDATE)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return player.isSwimming();
|
return player.isSwimming();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
SUPPORTED_VERSIONS = Arrays.asList(new String[] { "v1_16", "v1_15", "v1_14", "v1_13", "v1_12", "v1_8_R3" });
|
||||||
|
CURRENT_VERSION = MinecraftVersion.getCurrentVersion();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user