diff --git a/src/main/java/net/h31ix/anticheat/Anticheat.java b/src/main/java/net/h31ix/anticheat/Anticheat.java index 3ab7238..a7a3452 100644 --- a/src/main/java/net/h31ix/anticheat/Anticheat.java +++ b/src/main/java/net/h31ix/anticheat/Anticheat.java @@ -1,6 +1,7 @@ package net.h31ix.anticheat; import java.io.File; +import java.util.List; import net.h31ix.anticheat.manage.*; import java.util.logging.Level; import java.util.logging.Logger; @@ -11,6 +12,7 @@ import net.h31ix.anticheat.event.PlayerListener; import net.h31ix.anticheat.manage.BowManager; import net.h31ix.anticheat.manage.ItemManager; import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; public class Anticheat extends JavaPlugin { @@ -33,6 +35,7 @@ public class Anticheat extends JavaPlugin { public boolean lagged = false; public boolean logConsole; public FileConfiguration log; + private List worlds; @Override public void onDisable() { @@ -47,7 +50,7 @@ public class Anticheat extends JavaPlugin { config = new Configuration(this); tracker = new PlayerTracker(this); logConsole = config.logConsole; - + worlds = config.getWorlds(); getServer().getPluginManager().registerEvents(new PlayerListener(this), this); getServer().getPluginManager().registerEvents(new BlockListener(this), this); getServer().getPluginManager().registerEvents(new EntityListener(this), this); @@ -77,5 +80,20 @@ public class Anticheat extends JavaPlugin { l.log(Level.WARNING,"[AntiCheat] "+s); } } + + public boolean check(Player player) + { + boolean check = false; + String pworld = player.getWorld().getName(); + for(String world : worlds) + { + if(world.equals(pworld)) + { + check = true; + break; + } + } + return check; + } } diff --git a/src/main/java/net/h31ix/anticheat/Configuration.java b/src/main/java/net/h31ix/anticheat/Configuration.java index 856a15b..33ed7f6 100644 --- a/src/main/java/net/h31ix/anticheat/Configuration.java +++ b/src/main/java/net/h31ix/anticheat/Configuration.java @@ -2,8 +2,12 @@ package net.h31ix.anticheat; import java.io.File; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; +import org.bukkit.Bukkit; +import org.bukkit.World; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; @@ -12,12 +16,38 @@ public class Configuration { private FileConfiguration config; private Anticheat plugin; public boolean logConsole; + private List worlds = new ArrayList(); public Configuration(Anticheat plugin) { this.plugin = plugin; + load(); + } + + private void save() + { + try { + config.save(configFile); + } catch (IOException ex) { + Logger.getLogger(Configuration.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public void load() + { config = YamlConfiguration.loadConfiguration(configFile); logConsole = config.getBoolean("Logging.Log to console"); + if(config.getList("Enable in") == null) + { + List w = new ArrayList(); + for(World world : Bukkit.getServer().getWorlds()) + { + w.add(world.getName()); + } + config.set("Enable in", w); + save(); + } + worlds = (List)(config.getList("Enable in")); } public String getResult(String event) @@ -37,4 +67,8 @@ public class Configuration { } } + public List getWorlds() + { + return worlds; + } } diff --git a/src/main/java/net/h31ix/anticheat/command/CommandManager.java b/src/main/java/net/h31ix/anticheat/command/CommandManager.java index 79c269f..136527a 100644 --- a/src/main/java/net/h31ix/anticheat/command/CommandManager.java +++ b/src/main/java/net/h31ix/anticheat/command/CommandManager.java @@ -102,6 +102,14 @@ public class CommandManager implements CommandExecutor { } } } + else if(args[0].equalsIgnoreCase("reload")) + { + if(hasPermission("admin",cs)) + { + plugin.config.load(); + cs.sendMessage(green+"AntiCheat configuration reloaded."); + } + } else { cs.sendMessage("Unrecognized command."); diff --git a/src/main/java/net/h31ix/anticheat/event/BlockListener.java b/src/main/java/net/h31ix/anticheat/event/BlockListener.java index 629d5ec..1f7ec9f 100644 --- a/src/main/java/net/h31ix/anticheat/event/BlockListener.java +++ b/src/main/java/net/h31ix/anticheat/event/BlockListener.java @@ -32,37 +32,40 @@ public class BlockListener implements Listener { Player player = event.getPlayer(); Block block = event.getBlock(); if(player != null) - { - //Check if an animation was done before this - if(!am.swungArm(player)) - { - if(!player.hasPermission("anticheat.noswing")) + { + if(plugin.check(player)) + { + //Check if an animation was done before this + if(!am.swungArm(player)) { - tracker.increaseLevel(player); - plugin.log(player.getName()+" didn't swing their arm on a block break!"); - event.setCancelled(true); - } - } - else - { - if(!player.hasPermission("anticheat.longreach")) - { - //If so, check the distance from the block. Is it too far away? - LengthCheck c = new LengthCheck(block.getLocation(),event.getPlayer().getLocation()); - if(c.getXDifference() > 6.0D || c.getZDifference() > 6.0D || c.getYDifference() > 6.0D) + if(!player.hasPermission("anticheat.noswing")) { - plugin.log(player.getName()+" tried to break a block too far away!"); tracker.increaseLevel(player); + plugin.log(player.getName()+" didn't swing their arm on a block break!"); event.setCancelled(true); } - else - { - tracker.decreaseLevel(player); + } + else + { + if(!player.hasPermission("anticheat.longreach")) + { + //If so, check the distance from the block. Is it too far away? + LengthCheck c = new LengthCheck(block.getLocation(),event.getPlayer().getLocation()); + if(c.getXDifference() > 6.0D || c.getZDifference() > 6.0D || c.getYDifference() > 6.0D) + { + plugin.log(player.getName()+" tried to break a block too far away!"); + tracker.increaseLevel(player); + event.setCancelled(true); + } + else + { + tracker.decreaseLevel(player); + } } - } - } + } + } + am.reset(player); } - am.reset(player); } @EventHandler @@ -72,32 +75,35 @@ public class BlockListener implements Listener { Block block = event.getBlock(); if(player != null) { - if(block.getType() != Material.LADDER) - { - //Check if the player can see the block they are placing - //This is mostly used for preventing build/autobuild hacks (Logic not yet finished) - if(!e.canSee(player, block) && !player.getWorld().getBlockAt(player.getLocation()).isLiquid()) - { - plugin.log(player.getName()+" tried to place a block that they couldn't see!"); - event.setCancelled(true); - } - } - if(!player.hasPermission("anticheat.longreach")) + if(plugin.check(player)) { - //Is the player too far away? - LengthCheck c = new LengthCheck(block.getLocation(),event.getPlayer().getLocation()); - if(c.getXDifference() > 6.0D || c.getZDifference() > 6.0D || c.getYDifference() > 6.0D) + if(block.getType() != Material.LADDER) { - tracker.increaseLevel(player); - plugin.log(player.getName()+" tried to place a block too far away!"); - event.setCancelled(true); - } - else - { - tracker.decreaseLevel(player); + //Check if the player can see the block they are placing + //This is mostly used for preventing build/autobuild hacks (Logic not yet finished) + if(!e.canSee(player, block) && !player.getWorld().getBlockAt(player.getLocation()).isLiquid()) + { + plugin.log(player.getName()+" tried to place a block that they couldn't see!"); + event.setCancelled(true); + } } - } - } - am.reset(player); + if(!player.hasPermission("anticheat.longreach")) + { + //Is the player too far away? + LengthCheck c = new LengthCheck(block.getLocation(),event.getPlayer().getLocation()); + if(c.getXDifference() > 6.0D || c.getZDifference() > 6.0D || c.getYDifference() > 6.0D) + { + tracker.increaseLevel(player); + plugin.log(player.getName()+" tried to place a block too far away!"); + event.setCancelled(true); + } + else + { + tracker.decreaseLevel(player); + } + } + } + am.reset(player); + } } } diff --git a/src/main/java/net/h31ix/anticheat/event/EntityListener.java b/src/main/java/net/h31ix/anticheat/event/EntityListener.java index e0939b7..8867fcb 100644 --- a/src/main/java/net/h31ix/anticheat/event/EntityListener.java +++ b/src/main/java/net/h31ix/anticheat/event/EntityListener.java @@ -33,19 +33,22 @@ public class EntityListener implements Listener { if(event.getEntity() instanceof Player) { Player player = (Player)event.getEntity(); - if(!player.hasPermission("anticheat.autofire")) - { - //This mostly prevents bow spam, hopefully more auto-firing in the future - if(!bm.hasShot(player)) - { - tracker.decreaseLevel(player); - bm.logShoot((Player)event.getEntity()); - } - else - { - event.setCancelled(true); - tracker.increaseLevel(player); - plugin.log(player.getName()+" tried to fire a bow too fast!"); + if(plugin.check(player)) + { + if(!player.hasPermission("anticheat.autofire")) + { + //This mostly prevents bow spam, hopefully more auto-firing in the future + if(!bm.hasShot(player)) + { + tracker.decreaseLevel(player); + bm.logShoot((Player)event.getEntity()); + } + else + { + event.setCancelled(true); + tracker.increaseLevel(player); + plugin.log(player.getName()+" tried to fire a bow too fast!"); + } } } } @@ -60,27 +63,30 @@ public class EntityListener implements Listener { if (e.getDamager() instanceof Player) { Player p = (Player) e.getDamager(); - if(event.getEntity() instanceof Player) - { - Player player = (Player)event.getEntity(); - //Being damaged causes the player to move really fast, usually triggering a warning and - //A teleport, so give them a grace period after damaging someone or being hit for recovery. - int time = 50; - if(p.getInventory().getItemInHand().getEnchantments().containsKey(Enchantment.KNOCKBACK)) + if(plugin.check(p)) + { + if(event.getEntity() instanceof Player) { - //If they were hit using knockback supply double recovery time - time = 100; - } - ex.logHit(p,50); - if(!p.hasPermission("anticheat.longreach")) - { - //Make sure they are close enough to the entity to hit them - LengthCheck lc = new LengthCheck(event.getEntity().getLocation(),p.getLocation()); - if(lc.getXDifference() > 5.0D || lc.getZDifference() > 5.0D || lc.getYDifference() > 4.3D) + Player player = (Player)event.getEntity(); + //Being damaged causes the player to move really fast, usually triggering a warning and + //A teleport, so give them a grace period after damaging someone or being hit for recovery. + int time = 50; + if(p.getInventory().getItemInHand().getEnchantments().containsKey(Enchantment.KNOCKBACK)) { - event.setCancelled(true); - } - ex.logHit(player,time); + //If they were hit using knockback supply double recovery time + time = 100; + } + ex.logHit(p,50); + if(!p.hasPermission("anticheat.longreach")) + { + //Make sure they are close enough to the entity to hit them + LengthCheck lc = new LengthCheck(event.getEntity().getLocation(),p.getLocation()); + if(lc.getXDifference() > 5.0D || lc.getZDifference() > 5.0D || lc.getYDifference() > 4.3D) + { + event.setCancelled(true); + } + ex.logHit(player,time); + } } } } diff --git a/src/main/java/net/h31ix/anticheat/event/PlayerListener.java b/src/main/java/net/h31ix/anticheat/event/PlayerListener.java index 4b31af2..3a9dcf3 100644 --- a/src/main/java/net/h31ix/anticheat/event/PlayerListener.java +++ b/src/main/java/net/h31ix/anticheat/event/PlayerListener.java @@ -72,18 +72,21 @@ public class PlayerListener implements Listener { public void onPlayerDropItem(PlayerDropItemEvent event) { Player player = event.getPlayer(); - if(!player.hasPermission("anticheat.spamdrop")) - { - if(!im.hasDropped(player)) + if(plugin.check(player)) + { + if(!player.hasPermission("anticheat.spamdrop")) { - //Make sure the player isn't spamming drops - //For a normal user this is no big deal, but to hackers it gets rid of most of the items in their inventory - im.logDrop(player); - } - else - { - plugin.log(player.getName()+" tried to drop blocks too fast!"); - event.setCancelled(true); + if(!im.hasDropped(player)) + { + //Make sure the player isn't spamming drops + //For a normal user this is no big deal, but to hackers it gets rid of most of the items in their inventory + im.logDrop(player); + } + else + { + plugin.log(player.getName()+" tried to drop blocks too fast!"); + event.setCancelled(true); + } } } } @@ -153,203 +156,206 @@ public class PlayerListener implements Listener { public void onPlayerMove(PlayerMoveEvent event) { Player player = event.getPlayer(); - if(!plugin.lagged && !ex.isHit(player)) - { - //Log the player's health level - hm.log(player); - //Get distances for hack checks. - LengthCheck c = new LengthCheck(event.getFrom(), event.getTo()); - double xd = c.getXDifference(); - double zd = c.getZDifference(); - double yd = c.getYDifference(); - Block p1 = player.getLocation().getWorld().getBlockAt(player.getLocation()); - //Is the player in water? - if(p1.isLiquid()) + if(plugin.check(player)) + { + if(!plugin.lagged && !ex.isHit(player)) { - //Are they using a boat? If so give them a bit more leniency - if (player.getVehicle() != null) + //Log the player's health level + hm.log(player); + //Get distances for hack checks. + LengthCheck c = new LengthCheck(event.getFrom(), event.getTo()); + double xd = c.getXDifference(); + double zd = c.getZDifference(); + double yd = c.getYDifference(); + Block p1 = player.getLocation().getWorld().getBlockAt(player.getLocation()); + //Is the player in water? + if(p1.isLiquid()) { - if(xd > 2.0D || zd > 2.0D) + //Are they using a boat? If so give them a bit more leniency + if (player.getVehicle() != null) { - tracker.increaseLevel(player); - plugin.log(player.getName()+" is using a boat too fast! XSpeed="+xd+" ZSpeed="+zd); - } - } - else if(xd > 0.19D || zd > 0.19D) - { - if(!player.hasPermission("anticheat.waterwalk")) - { - //Otherwise check for normal walking speeds, making sure they aren't using 'jesus' hacks - if(!player.isSprinting() && !player.isFlying()) + if(xd > 2.0D || zd > 2.0D) { tracker.increaseLevel(player); - plugin.log(player.getName()+" is walking too fast in water! XSpeed="+xd+" ZSpeed="+zd); - event.setTo(event.getFrom().clone()); - } + plugin.log(player.getName()+" is using a boat too fast! XSpeed="+xd+" ZSpeed="+zd); + } + } + else if(xd > 0.19D || zd > 0.19D) + { + if(!player.hasPermission("anticheat.waterwalk")) + { + //Otherwise check for normal walking speeds, making sure they aren't using 'jesus' hacks + if(!player.isSprinting() && !player.isFlying()) + { + tracker.increaseLevel(player); + plugin.log(player.getName()+" is walking too fast in water! XSpeed="+xd+" ZSpeed="+zd); + event.setTo(event.getFrom().clone()); + } + } } + else + { + if(!player.hasPermission("anticheat.waterwalk")) + { + //If they are flying/sprinting give them a bit of slack + if(xd > 0.3D || zd > 0.3D) + { + tracker.increaseLevel(player); + plugin.log(player.getName()+" is flying/sprinting too fast in water! XSpeed="+xd+" ZSpeed="+zd); + event.setTo(event.getFrom().clone()); + } + } + } } else { - if(!player.hasPermission("anticheat.waterwalk")) - { - //If they are flying/sprinting give them a bit of slack - if(xd > 0.3D || zd > 0.3D) - { - tracker.increaseLevel(player); - plugin.log(player.getName()+" is flying/sprinting too fast in water! XSpeed="+xd+" ZSpeed="+zd); - event.setTo(event.getFrom().clone()); - } - } - } - } - else - { - //Are they in a vehicle? - if (player.getVehicle() != null) - { - //If they are just entering it, skip the check. They are moving way too fast naturally. - if(!ex.isEntering(player)) + //Are they in a vehicle? + if (player.getVehicle() != null) { - if(xd > 0.6D || zd > 0.6D) + //If they are just entering it, skip the check. They are moving way too fast naturally. + if(!ex.isEntering(player)) { - tracker.increaseLevel(player); - plugin.log(player.getName()+" is using a vehicle too fast! XSpeed="+xd+" ZSpeed="+zd); - event.setTo(event.getFrom().clone()); - } - } - } - //Otherwise, are they sneaking? - else if(player.isSneaking()) - { - if(!player.hasPermission("anticheat.sneakhack") && !player.isFlying()) - { - //Make sure they are at normal sneak speeds. (not using sneak hacks) - if(xd > 0.2D || zd > 0.2D) - { - tracker.increaseLevel(player); - plugin.log(player.getName()+" is sneaking too fast! XSpeed="+xd+" ZSpeed="+zd); - event.setTo(event.getFrom().clone()); - //If they are, force them out of it. - player.setSneaking(false); - } - } - } - //Otherwise set a hardcoded limit to any other traveling - else if(xd > 0.4D || zd > 0.4D) - { - if(!player.hasPermission("anticheat.speedhack")) - { - if(!player.isFlying() && !player.hasPotionEffect(PotionEffectType.SPEED)) - { - if(!player.isSprinting()) + if(xd > 0.6D || zd > 0.6D) { tracker.increaseLevel(player); - plugin.log(player.getName()+" is walking too fast! XSpeed="+xd+" ZSpeed="+zd); + plugin.log(player.getName()+" is using a vehicle too fast! XSpeed="+xd+" ZSpeed="+zd); event.setTo(event.getFrom().clone()); - } - else + } + } + } + //Otherwise, are they sneaking? + else if(player.isSneaking()) + { + if(!player.hasPermission("anticheat.sneakhack") && !player.isFlying()) + { + //Make sure they are at normal sneak speeds. (not using sneak hacks) + if(xd > 0.2D || zd > 0.2D) { - //If they are sprinting or flying give slack - if(xd > 0.7D || zd > 0.7D) + tracker.increaseLevel(player); + plugin.log(player.getName()+" is sneaking too fast! XSpeed="+xd+" ZSpeed="+zd); + event.setTo(event.getFrom().clone()); + //If they are, force them out of it. + player.setSneaking(false); + } + } + } + //Otherwise set a hardcoded limit to any other traveling + else if(xd > 0.4D || zd > 0.4D) + { + if(!player.hasPermission("anticheat.speedhack")) + { + if(!player.isFlying() && !player.hasPotionEffect(PotionEffectType.SPEED)) + { + if(!player.isSprinting()) { tracker.increaseLevel(player); - plugin.log(player.getName()+" is sprinting too fast! XSpeed="+xd+" ZSpeed="+zd); + plugin.log(player.getName()+" is walking too fast! XSpeed="+xd+" ZSpeed="+zd); event.setTo(event.getFrom().clone()); + } + else + { + //If they are sprinting or flying give slack + if(xd > 0.7D || zd > 0.7D) + { + tracker.increaseLevel(player); + plugin.log(player.getName()+" is sprinting too fast! XSpeed="+xd+" ZSpeed="+zd); + event.setTo(event.getFrom().clone()); + } } } } } } - } - //If the player is ascending - if(event.getFrom().getY() < event.getTo().getY()) - { - //TODO: This is a little hacky. Any better way to figure this out? - //Are they climbing something? - if(yd <= 0.11761 && yd >= 0.11759) + //If the player is ascending + if(event.getFrom().getY() < event.getTo().getY()) { - if(!player.hasPermission("anticheat.spider")) - { - if(player.getLocation().getBlock().getType() != Material.VINE && player.getLocation().getBlock().getType() != Material.LADDER) - { - //If it's not climbable, block it. - plugin.log(player.getName()+" tried to climb a wall!"); - tracker.increaseLevel(player); - event.setTo(event.getFrom().clone()); - } - } - } - else if(!player.isFlying() && player.getVehicle() == null) - { - if(!player.hasPermission("anticheat.flyhack")) - { - //Otherwise check for fast ascension - if(yd > 0.5D) - { - tracker.increaseLevel(player); - plugin.log(player.getName()+" is ascending too fast! YSpeed="+yd); - event.setTo(event.getFrom().clone()); - } - } - } - } - //If they are falling - else if(event.getFrom().getY() > event.getTo().getY()) - { - //Ignore players in creative or in vehicles, they give a fall distance of 0 naturally. - if(player.getGameMode() != GameMode.CREATIVE && player.getVehicle() == null) - { - if(!player.hasPermission("anticheat.nofall")) - { - hm.log(player); - //Log health (for nofall detection) - if(hm.checkFall(player)) - { - //If the player is falling but has a 0 fall distance - plugin.log(player.getName()+" tried to avoid fall damage!"); - tracker.increaseLevel(player); - } - } - } - } - //No change in Y - else - { - if(!player.hasPermission("anticheat.flyhack") && !player.isFlying()) - { - Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN); - if(!player.isSneaking()) + //TODO: This is a little hacky. Any better way to figure this out? + //Are they climbing something? + if(yd <= 0.11761 && yd >= 0.11759) { - if(!canStand(block) && !canStand(block.getRelative(BlockFace.NORTH)) && !canStand(block.getRelative(BlockFace.EAST)) && !canStand(block.getRelative(BlockFace.SOUTH)) && !canStand(block.getRelative(BlockFace.WEST))) - { - if (fm.checkFly(player)) + if(!player.hasPermission("anticheat.spider")) + { + if(player.getLocation().getBlock().getType() != Material.VINE && player.getLocation().getBlock().getType() != Material.LADDER) { + //If it's not climbable, block it. + plugin.log(player.getName()+" tried to climb a wall!"); + tracker.increaseLevel(player); event.setTo(event.getFrom().clone()); - plugin.log(player.getName()+" tried to fly!"); + } + } + } + else if(!player.isFlying() && player.getVehicle() == null) + { + if(!player.hasPermission("anticheat.flyhack")) + { + //Otherwise check for fast ascension + if(yd > 0.5D) + { + tracker.increaseLevel(player); + plugin.log(player.getName()+" is ascending too fast! YSpeed="+yd); + event.setTo(event.getFrom().clone()); + } + } + } + } + //If they are falling + else if(event.getFrom().getY() > event.getTo().getY()) + { + //Ignore players in creative or in vehicles, they give a fall distance of 0 naturally. + if(player.getGameMode() != GameMode.CREATIVE && player.getVehicle() == null) + { + if(!player.hasPermission("anticheat.nofall")) + { + hm.log(player); + //Log health (for nofall detection) + if(hm.checkFall(player)) + { + //If the player is falling but has a 0 fall distance + plugin.log(player.getName()+" tried to avoid fall damage!"); tracker.increaseLevel(player); } - else - { - tracker.decreaseLevel(player); - } } } - else - { - if(!canStand(block) && !canStand(block.getRelative(BlockFace.NORTH)) && !canStand(block.getRelative(BlockFace.EAST)) && !canStand(block.getRelative(BlockFace.SOUTH)) && !canStand(block.getRelative(BlockFace.WEST)) && !canStand(block.getRelative(BlockFace.NORTH_WEST)) && !canStand(block.getRelative(BlockFace.NORTH_EAST)) && !canStand(block.getRelative(BlockFace.SOUTH_WEST)) && !canStand(block.getRelative(BlockFace.SOUTH_EAST))) + } + //No change in Y + else + { + if(!player.hasPermission("anticheat.flyhack") && !player.isFlying()) + { + Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN); + if(!player.isSneaking()) { - if (fm.checkFly(player)) - { - event.setTo(event.getFrom().clone()); - plugin.log(player.getName()+" tried to fly!"); - tracker.increaseLevel(player); + if(!canStand(block) && !canStand(block.getRelative(BlockFace.NORTH)) && !canStand(block.getRelative(BlockFace.EAST)) && !canStand(block.getRelative(BlockFace.SOUTH)) && !canStand(block.getRelative(BlockFace.WEST))) + { + if (fm.checkFly(player)) + { + event.setTo(event.getFrom().clone()); + plugin.log(player.getName()+" tried to fly!"); + tracker.increaseLevel(player); + } + else + { + tracker.decreaseLevel(player); + } } - else - { - tracker.decreaseLevel(player); - } } - } + else + { + if(!canStand(block) && !canStand(block.getRelative(BlockFace.NORTH)) && !canStand(block.getRelative(BlockFace.EAST)) && !canStand(block.getRelative(BlockFace.SOUTH)) && !canStand(block.getRelative(BlockFace.WEST)) && !canStand(block.getRelative(BlockFace.NORTH_WEST)) && !canStand(block.getRelative(BlockFace.NORTH_EAST)) && !canStand(block.getRelative(BlockFace.SOUTH_WEST)) && !canStand(block.getRelative(BlockFace.SOUTH_EAST))) + { + if (fm.checkFly(player)) + { + event.setTo(event.getFrom().clone()); + plugin.log(player.getName()+" tried to fly!"); + tracker.increaseLevel(player); + } + else + { + tracker.decreaseLevel(player); + } + } + } + } } } }