mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-31 20:01:25 +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 clickedX;
|
||||||
public int clickedY;
|
public int clickedY;
|
||||||
public int clickedZ;
|
public int clickedZ;
|
||||||
|
public int clickedTick;
|
||||||
|
|
||||||
|
// TODO: use tick here too ?
|
||||||
public long wasInstaBreak;
|
public long wasInstaBreak;
|
||||||
|
|
||||||
public final Stats stats;
|
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.PlayerAnimationEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
|
||||||
|
import fr.neatmonster.nocheatplus.utilities.TickTask;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* M#"""""""'M dP dP M#"""""""'M dP
|
* M#"""""""'M dP dP M#"""""""'M dP
|
||||||
* ## mmmm. `M 88 88 ## mmmm. `M 88
|
* ## mmmm. `M 88 88 ## mmmm. `M 88
|
||||||
@ -219,10 +221,11 @@ public class BlockBreakListener implements Listener {
|
|||||||
if (block == null)
|
if (block == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Skip if already set to the same block without breaking.
|
final int tick = TickTask.getTick();
|
||||||
// TODO: should probably always set or depending on configuration.
|
// 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 (data.fastBreakBreakTime < data.fastBreakfirstDamage && data.clickedX == block.getX() && data.clickedZ == block.getZ() && data.clickedY == block.getY()){
|
||||||
return;
|
if (tick - data.clickedTick <= 1 ) return;
|
||||||
|
}
|
||||||
|
|
||||||
// (Always set, the interact event only fires once: the first time.)
|
// (Always set, the interact event only fires once: the first time.)
|
||||||
// Only record first damage:
|
// Only record first damage:
|
||||||
@ -231,6 +234,7 @@ public class BlockBreakListener implements Listener {
|
|||||||
data.clickedX = block.getX();
|
data.clickedX = block.getX();
|
||||||
data.clickedY = block.getY();
|
data.clickedY = block.getY();
|
||||||
data.clickedZ = block.getZ();
|
data.clickedZ = block.getZ();
|
||||||
|
data.clickedTick = tick;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user