mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 14:38:46 +00:00
Explaining, small fix to avoid false kicks. This will probably one of the last commits before beginning a re-write.
This commit is contained in:
1 parent
08139b001e
commit
3abed11387
13 files changed
+61
-21
No files matched your search
@@ -11,16 +11,6 @@
|
|||||||
<url>http://repo.bukkit.org/content/repositories/releases/</url>
|
<url>http://repo.bukkit.org/content/repositories/releases/</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<profiles>
|
|
||||||
<profile>
|
|
||||||
<id>jenkins</id>
|
|
||||||
<activation>
|
|
||||||
<property>
|
|
||||||
<name>env.BUILD_NUMBER</name>
|
|
||||||
</property>
|
|
||||||
</activation>
|
|
||||||
</profile>
|
|
||||||
</profiles>
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|||||||
@@ -10,9 +10,11 @@ import net.h31ix.anticheat.event.EntityListener;
|
|||||||
import net.h31ix.anticheat.event.PlayerListener;
|
import net.h31ix.anticheat.event.PlayerListener;
|
||||||
import net.h31ix.anticheat.manage.BowManager;
|
import net.h31ix.anticheat.manage.BowManager;
|
||||||
import net.h31ix.anticheat.manage.ItemManager;
|
import net.h31ix.anticheat.manage.ItemManager;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class Anticheat extends JavaPlugin {
|
public class Anticheat extends JavaPlugin {
|
||||||
|
//Define and initialize managers, used for various checks and tasks in the listeners.
|
||||||
public ChatManager cm = new ChatManager(this);
|
public ChatManager cm = new ChatManager(this);
|
||||||
public AnimationManager am = new AnimationManager(this);
|
public AnimationManager am = new AnimationManager(this);
|
||||||
public ExemptManager ex = new ExemptManager(this);
|
public ExemptManager ex = new ExemptManager(this);
|
||||||
@@ -20,13 +22,16 @@ public class Anticheat extends JavaPlugin {
|
|||||||
public BowManager bm = new BowManager(this);
|
public BowManager bm = new BowManager(this);
|
||||||
public HealthManager hm = new HealthManager();
|
public HealthManager hm = new HealthManager();
|
||||||
public LoginManager lm = new LoginManager(this);
|
public LoginManager lm = new LoginManager(this);
|
||||||
|
//End Managers
|
||||||
|
|
||||||
public Configuration config;
|
public Configuration config;
|
||||||
public PlayerTracker tracker;
|
public PlayerTracker tracker; //PlayerTracker for monitoring levels
|
||||||
private static final Logger l = Logger.getLogger("Minecraft");
|
private static final Logger l = Logger.getLogger("Minecraft");
|
||||||
private long lastTime = System.currentTimeMillis();
|
private long lastTime = System.currentTimeMillis();
|
||||||
private long time = 0;
|
private long time = 0;
|
||||||
public boolean lagged = false;
|
public boolean lagged = false;
|
||||||
public boolean log;
|
public boolean logConsole;
|
||||||
|
public FileConfiguration log;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
@@ -40,7 +45,7 @@ public class Anticheat extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
config = new Configuration(this);
|
config = new Configuration(this);
|
||||||
tracker = new PlayerTracker(this);
|
tracker = new PlayerTracker(this);
|
||||||
log = config.logConsole;
|
logConsole = config.logConsole;
|
||||||
|
|
||||||
getServer().getPluginManager().registerEvents(new PlayerListener(this), this);
|
getServer().getPluginManager().registerEvents(new PlayerListener(this), this);
|
||||||
getServer().getPluginManager().registerEvents(new BlockListener(this), this);
|
getServer().getPluginManager().registerEvents(new BlockListener(this), this);
|
||||||
@@ -66,7 +71,7 @@ public class Anticheat extends JavaPlugin {
|
|||||||
|
|
||||||
public void log(String s)
|
public void log(String s)
|
||||||
{
|
{
|
||||||
if(this.log)
|
if(this.logConsole)
|
||||||
{
|
{
|
||||||
l.log(Level.WARNING,"[AntiCheat] "+s);
|
l.log(Level.WARNING,"[AntiCheat] "+s);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class Configuration {
|
|||||||
{
|
{
|
||||||
config.set("Logging.Log to console", b);
|
config.set("Logging.Log to console", b);
|
||||||
this.logConsole = b;
|
this.logConsole = b;
|
||||||
plugin.log = b;
|
plugin.logConsole = b;
|
||||||
try {
|
try {
|
||||||
config.save(configFile);
|
config.save(configFile);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
package net.h31ix.anticheat.checks;
|
package net.h31ix.anticheat.checks;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class EyeCheck {
|
public class EyeCheck {
|
||||||
@@ -15,6 +13,7 @@ public class EyeCheck {
|
|||||||
|
|
||||||
public boolean canSee(Player player, Block block)
|
public boolean canSee(Player player, Block block)
|
||||||
{
|
{
|
||||||
|
//TODO: The logic here is NOT concrete, especially when looking down at an angle.
|
||||||
List<Block> blocks = player.getLineOfSight(null, 20);
|
List<Block> blocks = player.getLineOfSight(null, 20);
|
||||||
Location bloc = block.getLocation();
|
Location bloc = block.getLocation();
|
||||||
boolean see = false;
|
boolean see = false;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import org.bukkit.Location;
|
|||||||
|
|
||||||
public class LengthCheck {
|
public class LengthCheck {
|
||||||
Location l1, l2;
|
Location l1, l2;
|
||||||
|
//Used for checking how far a player travels on an event and how far they are from another location
|
||||||
public LengthCheck(Location l1, Location l2)
|
public LengthCheck(Location l1, Location l2)
|
||||||
{
|
{
|
||||||
this.l1 = l1;
|
this.l1 = l1;
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public class BlockListener implements Listener {
|
|||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
if(player != null)
|
if(player != null)
|
||||||
{
|
{
|
||||||
|
//Check if an animation was done before this
|
||||||
if(!am.swungArm(player))
|
if(!am.swungArm(player))
|
||||||
{
|
{
|
||||||
tracker.increaseLevel(player);
|
tracker.increaseLevel(player);
|
||||||
@@ -40,6 +41,7 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//If so, check the distance from the block. Is it too far away?
|
||||||
LengthCheck c = new LengthCheck(block.getLocation(),event.getPlayer().getLocation());
|
LengthCheck c = new LengthCheck(block.getLocation(),event.getPlayer().getLocation());
|
||||||
if(c.getXDifference() > 6.0D || c.getZDifference() > 6.0D || c.getYDifference() > 6.0D)
|
if(c.getXDifference() > 6.0D || c.getZDifference() > 6.0D || c.getYDifference() > 6.0D)
|
||||||
{
|
{
|
||||||
@@ -63,12 +65,16 @@ public class BlockListener implements Listener {
|
|||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
if(player != null)
|
if(player != null)
|
||||||
{
|
{
|
||||||
|
//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())
|
if(!e.canSee(player, block) && !player.getWorld().getBlockAt(player.getLocation()).isLiquid())
|
||||||
{
|
{
|
||||||
tracker.increaseLevel(player);
|
//TODO: this is causing false alerts. Re-work the vision logic?
|
||||||
|
//tracker.increaseLevel(player);
|
||||||
plugin.log(player.getName()+" tried to place a block that they couldn't see!");
|
plugin.log(player.getName()+" tried to place a block that they couldn't see!");
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
//Is the player too far away?
|
||||||
LengthCheck c = new LengthCheck(block.getLocation(),event.getPlayer().getLocation());
|
LengthCheck c = new LengthCheck(block.getLocation(),event.getPlayer().getLocation());
|
||||||
if(c.getXDifference() > 6.0D || c.getZDifference() > 6.0D || c.getYDifference() > 6.0D)
|
if(c.getXDifference() > 6.0D || c.getZDifference() > 6.0D || c.getYDifference() > 6.0D)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public class EntityListener implements Listener {
|
|||||||
{
|
{
|
||||||
if(event.getEntity() instanceof Player)
|
if(event.getEntity() instanceof Player)
|
||||||
{
|
{
|
||||||
|
//This mostly prevents bow spam, hopefully more auto-firing in the future
|
||||||
Player player = (Player)event.getEntity();
|
Player player = (Player)event.getEntity();
|
||||||
if(!bm.hasShot(player))
|
if(!bm.hasShot(player))
|
||||||
{
|
{
|
||||||
@@ -60,12 +61,16 @@ public class EntityListener implements Listener {
|
|||||||
if(event.getEntity() instanceof Player)
|
if(event.getEntity() instanceof Player)
|
||||||
{
|
{
|
||||||
Player player = (Player)event.getEntity();
|
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;
|
int time = 50;
|
||||||
if(p.getInventory().getItemInHand().getEnchantments().containsKey(Enchantment.KNOCKBACK))
|
if(p.getInventory().getItemInHand().getEnchantments().containsKey(Enchantment.KNOCKBACK))
|
||||||
{
|
{
|
||||||
|
//If they were hit using knockback supply double recovery time
|
||||||
time = 100;
|
time = 100;
|
||||||
}
|
}
|
||||||
ex.logHit(p,50);
|
ex.logHit(p,50);
|
||||||
|
//Make sure they are close enough to the entity to hit them
|
||||||
LengthCheck lc = new LengthCheck(event.getEntity().getLocation(),p.getLocation());
|
LengthCheck lc = new LengthCheck(event.getEntity().getLocation(),p.getLocation());
|
||||||
if(lc.getXDifference() > 5.0D || lc.getZDifference() > 5.0D || lc.getYDifference() > 4.3D)
|
if(lc.getXDifference() > 5.0D || lc.getZDifference() > 5.0D || lc.getYDifference() > 4.3D)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ public class PlayerListener implements Listener {
|
|||||||
{
|
{
|
||||||
if(!lm.log())
|
if(!lm.log())
|
||||||
{
|
{
|
||||||
|
//Make sure a player has not joined in the last .5th of a second
|
||||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Please do not flood the server!");
|
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Please do not flood the server!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -54,6 +55,7 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerJoin(PlayerJoinEvent event)
|
public void onPlayerJoin(PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
|
//Disable zombe's mods
|
||||||
event.getPlayer().sendMessage("§f §f §1 §0 §2 §4");
|
event.getPlayer().sendMessage("§f §f §1 §0 §2 §4");
|
||||||
event.getPlayer().sendMessage("§f §f §2 §0 §4 §8");
|
event.getPlayer().sendMessage("§f §f §2 §0 §4 §8");
|
||||||
event.getPlayer().sendMessage("§f §f §4 §0 §9 §6");
|
event.getPlayer().sendMessage("§f §f §4 §0 §9 §6");
|
||||||
@@ -65,6 +67,8 @@ public class PlayerListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if(!im.hasDropped(player))
|
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);
|
im.logDrop(player);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -79,6 +83,7 @@ public class PlayerListener implements Listener {
|
|||||||
{
|
{
|
||||||
if(event.getAnimationType() == PlayerAnimationType.ARM_SWING)
|
if(event.getAnimationType() == PlayerAnimationType.ARM_SWING)
|
||||||
{
|
{
|
||||||
|
//Log animations for future checks
|
||||||
am.logAnimation(event.getPlayer());
|
am.logAnimation(event.getPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,6 +93,7 @@ public class PlayerListener implements Listener {
|
|||||||
{
|
{
|
||||||
if(event.getEntered() instanceof Player)
|
if(event.getEntered() instanceof Player)
|
||||||
{
|
{
|
||||||
|
//Give the player a grace period as they enter a vehicle, as they move very fast.
|
||||||
ex.logEnter((Player)event.getEntered());
|
ex.logEnter((Player)event.getEntered());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -97,6 +103,7 @@ public class PlayerListener implements Listener {
|
|||||||
{
|
{
|
||||||
if(!plugin.lagged)
|
if(!plugin.lagged)
|
||||||
{
|
{
|
||||||
|
//Block command spamming (consider them chats)
|
||||||
plugin.cm.addChat(event.getPlayer());
|
plugin.cm.addChat(event.getPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -107,11 +114,13 @@ public class PlayerListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if(player.getLocation().equals(player.getWorld().getSpawnLocation()))
|
if(player.getLocation().equals(player.getWorld().getSpawnLocation()))
|
||||||
{
|
{
|
||||||
|
//Make sure the player is not a potential spambot
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
player.sendMessage("Please move from spawn before speaking.");
|
player.sendMessage("Please move from spawn before speaking.");
|
||||||
}
|
}
|
||||||
if(!plugin.lagged)
|
if(!plugin.lagged)
|
||||||
{
|
{
|
||||||
|
//Block chat spamming
|
||||||
plugin.cm.addChat(player);
|
plugin.cm.addChat(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,6 +128,7 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerKick(PlayerKickEvent event)
|
public void onPlayerKick(PlayerKickEvent event)
|
||||||
{
|
{
|
||||||
|
//Clear the player's chat level when they disconnect
|
||||||
plugin.cm.clear(event.getPlayer());
|
plugin.cm.clear(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,14 +138,18 @@ public class PlayerListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if(!plugin.lagged && !ex.isHit(player))
|
if(!plugin.lagged && !ex.isHit(player))
|
||||||
{
|
{
|
||||||
|
//Log the player's health level
|
||||||
hm.log(player);
|
hm.log(player);
|
||||||
|
//Get distances for hack checks.
|
||||||
LengthCheck c = new LengthCheck(event.getFrom(), event.getTo());
|
LengthCheck c = new LengthCheck(event.getFrom(), event.getTo());
|
||||||
double xd = c.getXDifference();
|
double xd = c.getXDifference();
|
||||||
double zd = c.getZDifference();
|
double zd = c.getZDifference();
|
||||||
double yd = c.getYDifference();
|
double yd = c.getYDifference();
|
||||||
Block p1 = player.getLocation().getWorld().getBlockAt(player.getLocation());
|
Block p1 = player.getLocation().getWorld().getBlockAt(player.getLocation());
|
||||||
|
//Is the player in water?
|
||||||
if(p1.isLiquid())
|
if(p1.isLiquid())
|
||||||
{
|
{
|
||||||
|
//Are they using a boat? If so give them a bit more leniency
|
||||||
if (player.getVehicle() != null)
|
if (player.getVehicle() != null)
|
||||||
{
|
{
|
||||||
if(xd > 2.0D || zd > 2.0D)
|
if(xd > 2.0D || zd > 2.0D)
|
||||||
@@ -146,6 +160,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
else if(xd > 0.19D || zd > 0.19D)
|
else if(xd > 0.19D || zd > 0.19D)
|
||||||
{
|
{
|
||||||
|
//Otherwise check for normal walking speeds, making sure they aren't using 'jesus' hacks
|
||||||
if(!player.isSprinting() && !player.isFlying())
|
if(!player.isSprinting() && !player.isFlying())
|
||||||
{
|
{
|
||||||
tracker.increaseLevel(player);
|
tracker.increaseLevel(player);
|
||||||
@@ -155,6 +170,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//If they are flying/sprinting give them a bit of slack
|
||||||
if(xd > 0.3D || zd > 0.3D)
|
if(xd > 0.3D || zd > 0.3D)
|
||||||
{
|
{
|
||||||
tracker.increaseLevel(player);
|
tracker.increaseLevel(player);
|
||||||
@@ -165,8 +181,10 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//Are they in a vehicle?
|
||||||
if (player.getVehicle() != null)
|
if (player.getVehicle() != null)
|
||||||
{
|
{
|
||||||
|
//If they are just entering it, skip the check. They are moving way too fast naturally.
|
||||||
if(!ex.isEntering(player))
|
if(!ex.isEntering(player))
|
||||||
{
|
{
|
||||||
if(xd > 0.6D || zd > 0.6D)
|
if(xd > 0.6D || zd > 0.6D)
|
||||||
@@ -177,16 +195,20 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Otherwise, are they sneaking?
|
||||||
else if(player.isSneaking())
|
else if(player.isSneaking())
|
||||||
{
|
{
|
||||||
|
//Make sure they are at normal sneak speeds. (not using sneak hacks)
|
||||||
if(xd > 0.17D || zd > 0.17D)
|
if(xd > 0.17D || zd > 0.17D)
|
||||||
{
|
{
|
||||||
tracker.increaseLevel(player);
|
tracker.increaseLevel(player);
|
||||||
plugin.log(player.getName()+" is sneaking too fast! XSpeed="+xd+" ZSpeed="+zd);
|
plugin.log(player.getName()+" is sneaking too fast! XSpeed="+xd+" ZSpeed="+zd);
|
||||||
event.setTo(event.getFrom().clone());
|
event.setTo(event.getFrom().clone());
|
||||||
|
//If they are, force them out of it.
|
||||||
player.setSneaking(false);
|
player.setSneaking(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Otherwise set a hardcoded limit to any other traveling
|
||||||
else if(xd > 0.32D || zd > 0.32D)
|
else if(xd > 0.32D || zd > 0.32D)
|
||||||
{
|
{
|
||||||
if(!player.isSprinting() && !player.isFlying())
|
if(!player.isSprinting() && !player.isFlying())
|
||||||
@@ -197,6 +219,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//If they are sprinting or flying give slack
|
||||||
if(xd > 0.62D || zd > 0.62D)
|
if(xd > 0.62D || zd > 0.62D)
|
||||||
{
|
{
|
||||||
tracker.increaseLevel(player);
|
tracker.increaseLevel(player);
|
||||||
@@ -205,18 +228,22 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//If the player is ascending
|
||||||
if(event.getFrom().getY() < event.getTo().getY())
|
if(event.getFrom().getY() < event.getTo().getY())
|
||||||
{
|
{
|
||||||
//TODO: This is a little hacky. Any better way to figure this out?
|
//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(yd <= 0.11761 && yd >= 0.11759)
|
||||||
{
|
{
|
||||||
if(player.getLocation().getBlock().getType() != Material.VINE && player.getLocation().getBlock().getType() != Material.LADDER)
|
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!");
|
plugin.log(player.getName()+" tried to climb a wall!");
|
||||||
tracker.increaseLevel(player);
|
tracker.increaseLevel(player);
|
||||||
event.setTo(event.getFrom().clone());
|
event.setTo(event.getFrom().clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Otherwise check for fast ascension
|
||||||
else if(yd > 0.5D)
|
else if(yd > 0.5D)
|
||||||
{
|
{
|
||||||
tracker.increaseLevel(player);
|
tracker.increaseLevel(player);
|
||||||
@@ -224,14 +251,17 @@ public class PlayerListener implements Listener {
|
|||||||
event.setTo(event.getFrom().clone());
|
event.setTo(event.getFrom().clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//If they are falling
|
||||||
if(event.getFrom().getY() > event.getTo().getY())
|
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.getGameMode() != GameMode.CREATIVE && player.getVehicle() == null)
|
||||||
{
|
{
|
||||||
hm.log(player);
|
hm.log(player);
|
||||||
|
//Log health (for nofall detection)
|
||||||
if(hm.checkFall(player))
|
if(hm.checkFall(player))
|
||||||
{
|
{
|
||||||
|
//If the player is falling but has a 0 fall distance
|
||||||
plugin.log(player.getName()+" tried to avoid fall damage!");
|
plugin.log(player.getName()+" tried to avoid fall damage!");
|
||||||
tracker.increaseLevel(player);
|
tracker.increaseLevel(player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public class BowManager {
|
|||||||
|
|
||||||
public boolean hasShot(Player player)
|
public boolean hasShot(Player player)
|
||||||
{
|
{
|
||||||
|
//If the player has shot in the last .5 seconds
|
||||||
if(shot.get(player) == null || shot.get(player) == false)
|
if(shot.get(player) == null || shot.get(player) == false)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ public class ExemptManager {
|
|||||||
|
|
||||||
public void logEnter(final Player player)
|
public void logEnter(final Player player)
|
||||||
{
|
{
|
||||||
|
//For ignoring players entering vehicles
|
||||||
enter.put(player, true);
|
enter.put(player, true);
|
||||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable()
|
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ public class HealthManager {
|
|||||||
|
|
||||||
public boolean checkFall(Player player)
|
public boolean checkFall(Player player)
|
||||||
{
|
{
|
||||||
|
//Sometimes a player's fall distance is 0 when they reach the peak of their jump
|
||||||
|
//To combat false positives, the player must have 10 fall distance values of 0 in a row to trigger.
|
||||||
if(fall.get(player) == 0)
|
if(fall.get(player) == 0)
|
||||||
{
|
{
|
||||||
if(fallvl.get(player) == null)
|
if(fallvl.get(player) == null)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public class ItemManager {
|
|||||||
|
|
||||||
public void logDrop(final Player player)
|
public void logDrop(final Player player)
|
||||||
{
|
{
|
||||||
|
//Stop players from dropping blocks too fast.
|
||||||
drop.put(player, true);
|
drop.put(player, true);
|
||||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable()
|
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package net.h31ix.anticheat.manage;
|
package net.h31ix.anticheat.manage;
|
||||||
|
|
||||||
import net.h31ix.anticheat.Anticheat;
|
import net.h31ix.anticheat.Anticheat;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class LoginManager {
|
public class LoginManager {
|
||||||
Anticheat plugin;
|
Anticheat plugin;
|
||||||
@@ -14,6 +13,7 @@ public class LoginManager {
|
|||||||
|
|
||||||
public boolean log()
|
public boolean log()
|
||||||
{
|
{
|
||||||
|
//Log players entering the server. Don't allow them to join way too fast.
|
||||||
if(join == true)
|
if(join == true)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in new issue
Block a user