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
+17 -3

No files matched your search

@@ -35,12 +35,17 @@ public class BlockListener implements Listener {
{
//Check if an animation was done before this
if(!am.swungArm(player))
{
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(!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());
@@ -56,6 +61,7 @@ public class BlockListener implements Listener {
}
}
}
}
am.reset(player);
}
@@ -75,9 +81,11 @@ 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)
@@ -91,6 +99,7 @@ public class BlockListener implements Listener {
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,8 +32,10 @@ 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(!player.hasPermission("anticheat.autofire"))
{
//This mostly prevents bow spam, hopefully more auto-firing in the future
if(!bm.hasShot(player))
{
tracker.decreaseLevel(player);
@@ -48,6 +49,7 @@ public class EntityListener implements Listener {
}
}
}
}
@EventHandler
public void onEntityDamage(EntityDamageEvent event)
@@ -70,6 +72,8 @@ public class EntityListener implements Listener {
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)
@@ -81,4 +85,5 @@ public class EntityListener implements Listener {
}
}
}
}
}