mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-09-19 10:21:27 +02:00
Set jumAmplifier to the actual value instead of 0 for some spots.
This commit is contained in:
parent
1a87a9d0da
commit
06a5d33542
@ -362,17 +362,8 @@ public class MovingListener implements Listener {
|
||||
|
||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||
// Potion effect "Jump".
|
||||
final double jumpAmplifier;
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) {
|
||||
// final int amplifier = mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
// if (amplifier > 20)
|
||||
// jumpAmplifier = 1.5D * (amplifier + 1D);
|
||||
// else
|
||||
// jumpAmplifier = 1.2D * (amplifier + 1D);
|
||||
jumpAmplifier = 1D + mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
if (cc.debug) System.out.println(player.getName() + " Jump effect: " + data.jumpAmplifier);
|
||||
}
|
||||
else jumpAmplifier = 1D;
|
||||
final double jumpAmplifier = MovingListener.getJumpAmplifier(mcPlayer);
|
||||
if (jumpAmplifier > 0D && cc.debug) System.out.println(player.getName() + " Jump effect: " + data.jumpAmplifier);
|
||||
if (jumpAmplifier > data.jumpAmplifier) data.jumpAmplifier = jumpAmplifier;
|
||||
|
||||
// Just try to estimate velocities over time. Not very precise, but works good enough most of the time. Do
|
||||
@ -770,4 +761,15 @@ public class MovingListener implements Listener {
|
||||
public void onPlayerKick(final PlayerKickEvent event){
|
||||
noFall.onLeave(event.getPlayer());
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine "some jump amplifier": 1 is jump boost, 2 is jump boost II.
|
||||
* @param mcPlayer
|
||||
* @return
|
||||
*/
|
||||
public static final double getJumpAmplifier(final EntityPlayer mcPlayer) {
|
||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) {
|
||||
return 1D + mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
||||
} else return 0D;
|
||||
}
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ public class SurvivalFly extends Check {
|
||||
// data.ground ?
|
||||
// ? set jumpphase to height / 0.15 ?
|
||||
data.survivalFlyJumpPhase = 0;
|
||||
data.jumpAmplifier = 0; // Might conflict, should probably fetch.
|
||||
data.jumpAmplifier = MovingListener.getJumpAmplifier(mcPlayer);
|
||||
data.clearAccounting();
|
||||
// Tell NoFall that we assume the player to have been on ground somehow.
|
||||
data.noFallAssumeGround = true;
|
||||
@ -260,7 +260,7 @@ public class SurvivalFly extends Check {
|
||||
if (from.isInWeb()){
|
||||
// Very simple: force players to descend or stay.
|
||||
vAllowedDistance = from.isOnGround() ? 0.1D : 0;
|
||||
data.jumpAmplifier = 0;
|
||||
data.jumpAmplifier = 0; // TODO: later maybe fetch.
|
||||
vDistanceAboveLimit = yDistance;
|
||||
if (cc.survivalFlyCobwebHack && vDistanceAboveLimit > 0 && hDistanceAboveLimit <= 0){
|
||||
if (now - data.survivalFlyCobwebTime > 3000){
|
||||
@ -302,8 +302,10 @@ public class SurvivalFly extends Check {
|
||||
vDistanceAboveLimit = Math.max(vDistanceAboveLimit, Math.abs(yDistance));
|
||||
|
||||
}
|
||||
if (data.noFallAssumeGround || fromOnGround || toOnGround)
|
||||
data.jumpAmplifier = 0D;
|
||||
if (data.noFallAssumeGround || fromOnGround || toOnGround) {
|
||||
// Some reset condition.
|
||||
data.jumpAmplifier = MovingListener.getJumpAmplifier(mcPlayer);
|
||||
}
|
||||
|
||||
if (cc.survivalFlyAccounting && !resetFrom){
|
||||
final boolean useH = data.horizontalFreedom <= 0.001D;
|
||||
|
Loading…
Reference in New Issue
Block a user