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
2 files changed
+27 -1

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.CheckManager;
import net.h31ix.anticheat.manage.CheckType; import net.h31ix.anticheat.manage.CheckType;
import net.h31ix.anticheat.manage.Distance; import net.h31ix.anticheat.manage.Distance;
import org.bukkit.GameMode;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockPlaceEvent;
public class BlockListener extends EventListener 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 @EventHandler
public void onBlockBreak(BlockBreakEvent event) public void onBlockBreak(BlockBreakEvent event)
{ {
@@ -36,12 +36,13 @@ public enum CheckType
WATER_WALK("anticheat.waterwalk"), WATER_WALK("anticheat.waterwalk"),
NO_SWING("anticheat.noswing"), NO_SWING("anticheat.noswing"),
FAST_BREAK("anticheat.fastbreak"), FAST_BREAK("anticheat.fastbreak"),
FAST_PLACE("anticheat.fastplace"),
SPAM("anticheat.spam"), SPAM("anticheat.spam"),
SPRINT("anticheat.sprint"), SPRINT("anticheat.sprint"),
SNEAK("anticheat.sneak"), SNEAK("anticheat.sneak"),
SPEED("anticheat.speed"), SPEED("anticheat.speed"),
SPIDER("anticheat.spider"), SPIDER("anticheat.spider"),
NOFALL("anticheat.spider"), NOFALL("anticheat.nofall"),
FAST_BOW("anticheat.fastbow"), FAST_BOW("anticheat.fastbow"),
FAST_EAT("anticheat.fasteat"), FAST_EAT("anticheat.fasteat"),
FAST_HEAL("anticheat.fastheal"), FAST_HEAL("anticheat.fastheal"),