mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-19 14:01:20 +01:00
Adjust how first damage time for block break is updated.
This commit is contained in:
parent
764376f41d
commit
36b834df99
@ -78,6 +78,9 @@ public class BlockBreakData extends ACheckData {
|
||||
public int clickedX;
|
||||
public int clickedY;
|
||||
public int clickedZ;
|
||||
public int clickedTick;
|
||||
|
||||
// TODO: use tick here too ?
|
||||
public long wasInstaBreak;
|
||||
|
||||
public final Stats stats;
|
||||
|
@ -12,6 +12,8 @@ import org.bukkit.event.block.BlockDamageEvent;
|
||||
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import fr.neatmonster.nocheatplus.utilities.TickTask;
|
||||
|
||||
/*
|
||||
* M#"""""""'M dP dP M#"""""""'M dP
|
||||
* ## mmmm. `M 88 88 ## mmmm. `M 88
|
||||
@ -219,10 +221,11 @@ public class BlockBreakListener implements Listener {
|
||||
if (block == null)
|
||||
return;
|
||||
|
||||
// Skip if already set to the same block without breaking.
|
||||
// TODO: should probably always set or depending on configuration.
|
||||
if (data.fastBreakBreakTime < data.fastBreakfirstDamage && data.clickedX == block.getX() && data.clickedZ == block.getZ() && data.clickedY == block.getY())
|
||||
return;
|
||||
final int tick = TickTask.getTick();
|
||||
// Skip if already set to the same block without breaking within one tick difference.
|
||||
if (data.fastBreakBreakTime < data.fastBreakfirstDamage && data.clickedX == block.getX() && data.clickedZ == block.getZ() && data.clickedY == block.getY()){
|
||||
if (tick - data.clickedTick <= 1 ) return;
|
||||
}
|
||||
|
||||
// (Always set, the interact event only fires once: the first time.)
|
||||
// Only record first damage:
|
||||
@ -231,6 +234,7 @@ public class BlockBreakListener implements Listener {
|
||||
data.clickedX = block.getX();
|
||||
data.clickedY = block.getY();
|
||||
data.clickedZ = block.getZ();
|
||||
data.clickedTick = tick;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user