Fastplace blocker (forgot to re-add it) and nofall permission fix.

This commit is contained in:
Adam committed 2012-05-13 22:51:43 -04:00
1 parent f92215d6ff
commit 4e54638e6c
3 files changed
+28 -2

No files matched your search

@@ -23,11 +23,13 @@ import net.h31ix.anticheat.manage.Backend;
import net.h31ix.anticheat.manage.CheckManager;
import net.h31ix.anticheat.manage.CheckType;
import net.h31ix.anticheat.manage.Distance;
import org.bukkit.GameMode;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockPlaceEvent;
public class BlockListener extends EventListener
{
@@ -44,6 +46,29 @@ public class BlockListener extends EventListener
}
}
@EventHandler
public void onBlockPlace(BlockPlaceEvent event)
{
final Player player = event.getPlayer();
Block block = event.getBlock();
if(player != null && player.getGameMode() != GameMode.CREATIVE)
{
if(checkManager.willCheck(player, CheckType.FAST_PLACE))
{
if(backend.justPlaced(player))
{
event.setCancelled(true);
log("tried to place a block of "+block.getType().name()+" too fast.",player);
}
else
{
decrease(player);
backend.logBlockPlace(player);
}
}
}
}
@EventHandler
public void onBlockBreak(BlockBreakEvent event)
{
@@ -258,7 +258,7 @@ public class Backend
}
}
return false;
}
}
public void logBowWindUp(Player player)
{
@@ -36,12 +36,13 @@ public enum CheckType
WATER_WALK("anticheat.waterwalk"),
NO_SWING("anticheat.noswing"),
FAST_BREAK("anticheat.fastbreak"),
FAST_PLACE("anticheat.fastplace"),
SPAM("anticheat.spam"),
SPRINT("anticheat.sprint"),
SNEAK("anticheat.sneak"),
SPEED("anticheat.speed"),
SPIDER("anticheat.spider"),
NOFALL("anticheat.spider"),
NOFALL("anticheat.nofall"),
FAST_BOW("anticheat.fastbow"),
FAST_EAT("anticheat.fasteat"),
FAST_HEAL("anticheat.fastheal"),