mirror of
https://github.com/darksaid98/AntiCheatReloaded.git
synced 2026-12-03 14:38:46 +00:00
Allow plugins modifying block durability to pass through the fastbreak check.
This commit is contained in:
1 parent
bb756e952c
commit
8938167947
2 files changed
+23
-1
No files matched your search
@@ -27,6 +27,7 @@ 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;
|
||||||
|
|
||||||
public class BlockListener extends EventListener
|
public class BlockListener extends EventListener
|
||||||
{
|
{
|
||||||
@@ -34,6 +35,15 @@ public class BlockListener extends EventListener
|
|||||||
private final CheckManager checkManager = getCheckManager();
|
private final CheckManager checkManager = getCheckManager();
|
||||||
private final Anticheat plugin = getPlugin();
|
private final Anticheat plugin = getPlugin();
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onBlockDamage(BlockDamageEvent event)
|
||||||
|
{
|
||||||
|
if(event.getInstaBreak())
|
||||||
|
{
|
||||||
|
backend.logInstantBreak(event.getPlayer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockBreak(BlockBreakEvent event)
|
public void onBlockBreak(BlockBreakEvent event)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import org.bukkit.event.player.PlayerToggleSprintEvent;
|
|||||||
public class Backend
|
public class Backend
|
||||||
{
|
{
|
||||||
public static final int ENTERED_EXTITED_TIME = 20;
|
public static final int ENTERED_EXTITED_TIME = 20;
|
||||||
|
public static final int INSTANT_BREAK_TIME = 20;
|
||||||
public static final int JOIN_TIME = 40;
|
public static final int JOIN_TIME = 40;
|
||||||
public static final int DROPPED_ITEM_TIME = 2;
|
public static final int DROPPED_ITEM_TIME = 2;
|
||||||
public static final int DAMAGE_TIME = 50;
|
public static final int DAMAGE_TIME = 50;
|
||||||
@@ -80,6 +81,7 @@ public class Backend
|
|||||||
private List<String> startEat = new ArrayList<String>();
|
private List<String> startEat = new ArrayList<String>();
|
||||||
private List<String> healed = new ArrayList<String>();
|
private List<String> healed = new ArrayList<String>();
|
||||||
private List<String> sprinted = new ArrayList<String>();
|
private List<String> sprinted = new ArrayList<String>();
|
||||||
|
private List<String> instantBreakExempt = new ArrayList<String>();
|
||||||
private Map<String,Integer> flightViolation = new HashMap<String,Integer>();
|
private Map<String,Integer> flightViolation = new HashMap<String,Integer>();
|
||||||
private Map<String,Integer> chatLevel = new HashMap<String,Integer>();
|
private Map<String,Integer> chatLevel = new HashMap<String,Integer>();
|
||||||
private Map<String,Integer> chatKicks = new HashMap<String,Integer>();
|
private Map<String,Integer> chatKicks = new HashMap<String,Integer>();
|
||||||
@@ -244,7 +246,7 @@ public class Backend
|
|||||||
|
|
||||||
public boolean checkFastBreak(Player player, Block block)
|
public boolean checkFastBreak(Player player, Block block)
|
||||||
{
|
{
|
||||||
if(player.getGameMode() != GameMode.CREATIVE && !player.getInventory().getItemInHand().containsEnchantment(Enchantment.DIG_SPEED) && !Utilities.isInstantBreak(block.getType()))
|
if(player.getGameMode() != GameMode.CREATIVE && !player.getInventory().getItemInHand().containsEnchantment(Enchantment.DIG_SPEED) && !Utilities.isInstantBreak(block.getType()) && !isInstantBreakExempt(player))
|
||||||
{
|
{
|
||||||
if (!justBroke(player))
|
if (!justBroke(player))
|
||||||
{
|
{
|
||||||
@@ -308,6 +310,16 @@ public class Backend
|
|||||||
chatLevel.remove(player.getName());
|
chatLevel.remove(player.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void logInstantBreak(final Player player)
|
||||||
|
{
|
||||||
|
logEvent(instantBreakExempt,player,INSTANT_BREAK_TIME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isInstantBreakExempt(Player player)
|
||||||
|
{
|
||||||
|
return instantBreakExempt.contains(player.getName());
|
||||||
|
}
|
||||||
|
|
||||||
public void logSprint(final Player player)
|
public void logSprint(final Player player)
|
||||||
{
|
{
|
||||||
logEvent(sprinted,player,SPRINT_MIN);
|
logEvent(sprinted,player,SPRINT_MIN);
|
||||||
|
|||||||
Reference in new issue
Block a user