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
@ -360,20 +360,11 @@ public class MovingListener implements Listener {
|
|||||||
data.noFallAssumeGround = false;
|
data.noFallAssumeGround = false;
|
||||||
data.teleported = null;
|
data.teleported = null;
|
||||||
|
|
||||||
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
|
||||||
// Potion effect "Jump".
|
// Potion effect "Jump".
|
||||||
final double jumpAmplifier;
|
final double jumpAmplifier = MovingListener.getJumpAmplifier(mcPlayer);
|
||||||
if (mcPlayer.hasEffect(MobEffectList.JUMP)) {
|
if (jumpAmplifier > 0D && cc.debug) System.out.println(player.getName() + " Jump effect: " + data.jumpAmplifier);
|
||||||
// final int amplifier = mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
|
if (jumpAmplifier > data.jumpAmplifier) data.jumpAmplifier = jumpAmplifier;
|
||||||
// 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;
|
|
||||||
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
|
// Just try to estimate velocities over time. Not very precise, but works good enough most of the time. Do
|
||||||
// general data modifications one for each event.
|
// general data modifications one for each event.
|
||||||
@ -459,7 +450,7 @@ public class MovingListener implements Listener {
|
|||||||
moveInfo.cleanup();
|
moveInfo.cleanup();
|
||||||
parkedInfo.add(moveInfo);
|
parkedInfo.add(moveInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A workaround for cancelled PlayerMoveEvents.
|
* A workaround for cancelled PlayerMoveEvents.
|
||||||
*
|
*
|
||||||
@ -770,4 +761,15 @@ public class MovingListener implements Listener {
|
|||||||
public void onPlayerKick(final PlayerKickEvent event){
|
public void onPlayerKick(final PlayerKickEvent event){
|
||||||
noFall.onLeave(event.getPlayer());
|
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 ?
|
// data.ground ?
|
||||||
// ? set jumpphase to height / 0.15 ?
|
// ? set jumpphase to height / 0.15 ?
|
||||||
data.survivalFlyJumpPhase = 0;
|
data.survivalFlyJumpPhase = 0;
|
||||||
data.jumpAmplifier = 0; // Might conflict, should probably fetch.
|
data.jumpAmplifier = MovingListener.getJumpAmplifier(mcPlayer);
|
||||||
data.clearAccounting();
|
data.clearAccounting();
|
||||||
// Tell NoFall that we assume the player to have been on ground somehow.
|
// Tell NoFall that we assume the player to have been on ground somehow.
|
||||||
data.noFallAssumeGround = true;
|
data.noFallAssumeGround = true;
|
||||||
@ -260,7 +260,7 @@ public class SurvivalFly extends Check {
|
|||||||
if (from.isInWeb()){
|
if (from.isInWeb()){
|
||||||
// Very simple: force players to descend or stay.
|
// Very simple: force players to descend or stay.
|
||||||
vAllowedDistance = from.isOnGround() ? 0.1D : 0;
|
vAllowedDistance = from.isOnGround() ? 0.1D : 0;
|
||||||
data.jumpAmplifier = 0;
|
data.jumpAmplifier = 0; // TODO: later maybe fetch.
|
||||||
vDistanceAboveLimit = yDistance;
|
vDistanceAboveLimit = yDistance;
|
||||||
if (cc.survivalFlyCobwebHack && vDistanceAboveLimit > 0 && hDistanceAboveLimit <= 0){
|
if (cc.survivalFlyCobwebHack && vDistanceAboveLimit > 0 && hDistanceAboveLimit <= 0){
|
||||||
if (now - data.survivalFlyCobwebTime > 3000){
|
if (now - data.survivalFlyCobwebTime > 3000){
|
||||||
@ -302,8 +302,10 @@ public class SurvivalFly extends Check {
|
|||||||
vDistanceAboveLimit = Math.max(vDistanceAboveLimit, Math.abs(yDistance));
|
vDistanceAboveLimit = Math.max(vDistanceAboveLimit, Math.abs(yDistance));
|
||||||
|
|
||||||
}
|
}
|
||||||
if (data.noFallAssumeGround || fromOnGround || toOnGround)
|
if (data.noFallAssumeGround || fromOnGround || toOnGround) {
|
||||||
data.jumpAmplifier = 0D;
|
// Some reset condition.
|
||||||
|
data.jumpAmplifier = MovingListener.getJumpAmplifier(mcPlayer);
|
||||||
|
}
|
||||||
|
|
||||||
if (cc.survivalFlyAccounting && !resetFrom){
|
if (cc.survivalFlyAccounting && !resetFrom){
|
||||||
final boolean useH = data.horizontalFreedom <= 0.001D;
|
final boolean useH = data.horizontalFreedom <= 0.001D;
|
||||||
|
Loading…
Reference in New Issue
Block a user