A few extra permissions..

This commit is contained in:
Adam committed 2012-04-27 18:00:55 -04:00
1 parent b6caa519b9
commit 63868d6a25
2 files changed
+60 -46

No files matched your search

@@ -36,23 +36,29 @@ public class BlockListener implements Listener {
//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);
if(!player.hasPermission("anticheat.noswing"))
{
tracker.increaseLevel(player);
plugin.log(player.getName()+" didn't swing their arm on a block break!");
event.setCancelled(true);
}
}
else
{
//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);
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);
}
}
}
}
@@ -75,21 +81,24 @@ public class BlockListener implements Listener {
//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!");
event.setCancelled(true);
//event.setCancelled(true);
}
}
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);
}
}
//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);
}
@@ -2,7 +2,6 @@ package net.h31ix.anticheat.event;
import net.h31ix.anticheat.Anticheat;
import net.h31ix.anticheat.PlayerTracker;
import net.h31ix.anticheat.checks.EyeCheck;
import net.h31ix.anticheat.checks.LengthCheck;
import net.h31ix.anticheat.manage.BowManager;
import net.h31ix.anticheat.manage.ExemptManager;
@@ -33,18 +32,21 @@ public class EntityListener implements Listener {
{
if(event.getEntity() instanceof Player)
{
//This mostly prevents bow spam, hopefully more auto-firing in the future
Player player = (Player)event.getEntity();
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(!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!");
}
}
}
}
@@ -70,13 +72,16 @@ public class EntityListener implements Listener {
time = 100;
}
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());
if(lc.getXDifference() > 5.0D || lc.getZDifference() > 5.0D || lc.getYDifference() > 4.3D)
{
event.setCancelled(true);
}
ex.logHit(player,time);
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);
}
}
}
}