mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-01 22:14:49 +00:00
commit
ee4c9005f7
23 files changed
+1606
-1506
No files matched your search
@@ -29,121 +29,137 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public final class Utilities
|
||||
public final class Utilities
|
||||
{
|
||||
private static final List<Material> INSTANT_BREAK = new ArrayList<Material>();
|
||||
private static final List<Material> FOOD = new ArrayList<Material>();
|
||||
|
||||
|
||||
private Utilities()
|
||||
{
|
||||
|
||||
}
|
||||
public static void alert(String [] message)
|
||||
|
||||
}
|
||||
|
||||
public static void alert(String[] message)
|
||||
{
|
||||
for(String msg : message)
|
||||
for (String msg : message)
|
||||
{
|
||||
Bukkit.broadcast(msg, "anticheat.alert");
|
||||
}
|
||||
if(Anticheat.getManager().getConfiguration().logConsole())
|
||||
if (Anticheat.getManager().getConfiguration().logConsole())
|
||||
{
|
||||
for(String msg : message)
|
||||
{
|
||||
Anticheat.getManager().log(msg);
|
||||
}
|
||||
for (String msg : message)
|
||||
{
|
||||
Anticheat.getManager().log(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean cantStandAt(Block block)
|
||||
{
|
||||
return !canStand(block) && cantStandClose(block) && cantStandFar(block);
|
||||
}
|
||||
|
||||
public static boolean cantStandClose(Block block)
|
||||
{
|
||||
return !canStand(block.getRelative(BlockFace.NORTH)) && !canStand(block.getRelative(BlockFace.EAST)) && !canStand(block.getRelative(BlockFace.SOUTH)) && !canStand(block.getRelative(BlockFace.WEST));
|
||||
}
|
||||
|
||||
public static boolean cantStandFar(Block block)
|
||||
{
|
||||
return !canStand(block.getRelative(BlockFace.NORTH_WEST)) && !canStand(block.getRelative(BlockFace.NORTH_EAST)) && !canStand(block.getRelative(BlockFace.SOUTH_WEST)) && !canStand(block.getRelative(BlockFace.SOUTH_EAST));
|
||||
}
|
||||
|
||||
public static boolean canStand(Block block)
|
||||
{
|
||||
return !(block.isLiquid() || block.getType() == Material.AIR);
|
||||
}
|
||||
|
||||
public static boolean isInstantBreak(Material m)
|
||||
{
|
||||
return INSTANT_BREAK.contains(m);
|
||||
}
|
||||
|
||||
public static boolean isFood(Material m)
|
||||
{
|
||||
return FOOD.contains(m);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean sprintFly(Player player)
|
||||
{
|
||||
return player.isSprinting() || player.isFlying();
|
||||
return player.isSprinting() || player.isFlying();
|
||||
}
|
||||
|
||||
public static boolean isOnLilyPad(Player player)
|
||||
{
|
||||
Block block = player.getLocation().getBlock();
|
||||
Material lily = Material.WATER_LILY;
|
||||
return block.getType() == lily || block.getRelative(BlockFace.NORTH).getType() == lily || block.getRelative(BlockFace.SOUTH).getType() == lily || block.getRelative(BlockFace.EAST).getType() == lily || block.getRelative(BlockFace.WEST).getType() == lily;
|
||||
}
|
||||
|
||||
public static boolean isUsingMcMMOAbility(Player player)
|
||||
{
|
||||
boolean b = false;
|
||||
if(player.getServer().getPluginManager().getPlugin("mcMMO") != null)
|
||||
if (player.getServer().getPluginManager().getPlugin("mcMMO") != null)
|
||||
{
|
||||
if(mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.TREE_FELLER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.SUPER_BREAKER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.BERSERK) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.BLAST_MINING))
|
||||
{
|
||||
if (mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.TREE_FELLER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.SUPER_BREAKER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.BERSERK) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) || mcMMO.p.getPlayerProfile(player).getAbilityMode(AbilityType.BLAST_MINING))
|
||||
{
|
||||
b = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
public static boolean isSubmersed(Player player)
|
||||
{
|
||||
return player.getLocation().getBlock().isLiquid() && player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
|
||||
}
|
||||
|
||||
public static boolean isInWater(Player player)
|
||||
{
|
||||
return player.getLocation().getBlock().isLiquid() || player.getLocation().getBlock().getRelative(BlockFace.DOWN).isLiquid() || player.getLocation().getBlock().getRelative(BlockFace.UP).isLiquid();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isOnLadder(Player player)
|
||||
{
|
||||
return player.getLocation().getBlock().getType() == Material.VINE || player.getLocation().getBlock().getType() == Material.LADDER;
|
||||
}
|
||||
|
||||
public static boolean isInt(String string)
|
||||
{
|
||||
boolean x = false;
|
||||
try {
|
||||
try
|
||||
{
|
||||
Integer.parseInt(string);
|
||||
x = true;
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
return x;
|
||||
}
|
||||
static
|
||||
|
||||
static
|
||||
{
|
||||
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.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.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.TORCH);
|
||||
INSTANT_BREAK.add(Material.CROPS);
|
||||
INSTANT_BREAK.add(Material.SNOW);
|
||||
INSTANT_BREAK.add(Material.SNOW);
|
||||
INSTANT_BREAK.add(Material.TNT);
|
||||
FOOD.add(Material.COOKED_BEEF);
|
||||
FOOD.add(Material.COOKED_CHICKEN);
|
||||
@@ -160,6 +176,6 @@ public final class Utilities
|
||||
FOOD.add(Material.COOKIE);
|
||||
FOOD.add(Material.BREAD);
|
||||
FOOD.add(Material.SPIDER_EYE);
|
||||
FOOD.add(Material.ROTTEN_FLESH);
|
||||
FOOD.add(Material.ROTTEN_FLESH);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user