mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-28 19:38:35 +01:00
[Bleeding] Account for server side lag in inventory.instantbow.
This commit is contained in:
parent
1b350af75f
commit
8bb35fec94
@ -6,6 +6,7 @@ import org.bukkit.entity.Player;
|
|||||||
import fr.neatmonster.nocheatplus.checks.Check;
|
import fr.neatmonster.nocheatplus.checks.Check;
|
||||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||||
import fr.neatmonster.nocheatplus.permissions.Permissions;
|
import fr.neatmonster.nocheatplus.permissions.Permissions;
|
||||||
|
import fr.neatmonster.nocheatplus.utilities.TickTask;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* M""M dP dP M#"""""""'M
|
* M""M dP dP M#"""""""'M
|
||||||
@ -61,6 +62,9 @@ public class InstantBow extends Check {
|
|||||||
// TODO: Maybe this can be removed, though TickTask does not reset at the exact moment.
|
// TODO: Maybe this can be removed, though TickTask does not reset at the exact moment.
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
// Account for server side lag.
|
||||||
|
final long correctedPullduration = cc.lag ? (long) (TickTask.getLag(expectedPullDuration, true) * pullDuration) : pullDuration;
|
||||||
|
if (correctedPullduration < expectedPullDuration){
|
||||||
// TODO: Consider: Allow one time but set yawrate penalty time ?
|
// TODO: Consider: Allow one time but set yawrate penalty time ?
|
||||||
final double difference = (expectedPullDuration - pullDuration) / 100D;
|
final double difference = (expectedPullDuration - pullDuration) / 100D;
|
||||||
|
|
||||||
@ -71,6 +75,7 @@ public class InstantBow extends Check {
|
|||||||
// violation level and find out if we should cancel the event
|
// violation level and find out if we should cancel the event
|
||||||
cancel = executeActions(player, data.instantBowVL, difference, cc.instantBowActions);
|
cancel = executeActions(player, data.instantBowVL, difference, cc.instantBowActions);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (cc.debug && player.hasPermission(Permissions.ADMINISTRATION_DEBUG)){
|
if (cc.debug && player.hasPermission(Permissions.ADMINISTRATION_DEBUG)){
|
||||||
player.sendMessage(ChatColor.YELLOW + "NCP: " + ChatColor.GRAY + "Bow shot - force: " + force +", " + (cc.instantBowStrict || pullDuration < 2 * expectedPullDuration ? ("pull time: " + pullDuration) : "") + "(" + expectedPullDuration +")");
|
player.sendMessage(ChatColor.YELLOW + "NCP: " + ChatColor.GRAY + "Bow shot - force: " + force +", " + (cc.instantBowStrict || pullDuration < 2 * expectedPullDuration ? ("pull time: " + pullDuration) : "") + "(" + expectedPullDuration +")");
|
||||||
|
Loading…
Reference in New Issue
Block a user