mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-02 13:57:49 +01:00
Hack for cobwebs. Add permission for placing blocks against fluids.
This commit is contained in:
parent
77c50efce2
commit
a7e0069595
@ -94,6 +94,11 @@ permissions:
|
||||
nocheatplus.checks.blockplace:
|
||||
description: Allow the player to bypass all BlockPlace checks.
|
||||
children:
|
||||
nocheatplus.checks.blockplace.against:
|
||||
description: Allow the player to place blocks against other blocks.
|
||||
children:
|
||||
nocheatplus.checks.blockplace.against.liquids:
|
||||
description: Allow the player to place blocks against liquids.
|
||||
nocheatplus.checks.blockplace.direction:
|
||||
description: Allow the player to bypass to Direction check.
|
||||
nocheatplus.checks.blockplace.fastplace:
|
||||
|
@ -91,6 +91,7 @@ public class MovingConfig extends ACheckConfig {
|
||||
public final int survivalFlySprintingSpeed;
|
||||
public final int survivalFlySwimmingSpeed;
|
||||
public final int survivalFlyWalkingSpeed;
|
||||
public final boolean survivalFlyCobwebHack;
|
||||
public final ActionList survivalFlyActions;
|
||||
|
||||
// Special tolerance values:
|
||||
@ -136,6 +137,7 @@ public class MovingConfig extends ACheckConfig {
|
||||
survivalFlySprintingSpeed = data.getInt(ConfPaths.MOVING_SURVIVALFLY_SPRINTINGSPEED, 100);
|
||||
survivalFlySwimmingSpeed = data.getInt(ConfPaths.MOVING_SURVIVALFLY_SWIMMINGSPEED, 100);
|
||||
survivalFlyWalkingSpeed = data.getInt(ConfPaths.MOVING_SURVIVALFLY_WALKINGSPEED, 100);
|
||||
survivalFlyCobwebHack = data.getBoolean(ConfPaths.MOVING_SURVIVALFLY_COBWEBHACK, true);
|
||||
survivalFlyActions = data.getActionList(ConfPaths.MOVING_SURVIVALFLY_ACTIONS, Permissions.MOVING_SURVIVALFLY);
|
||||
|
||||
yOnGround = data.getDouble(ConfPaths.MOVING_YONGROUND, 0.001, 2.0, 0.001);
|
||||
|
@ -113,6 +113,8 @@ public class MovingData extends ACheckData {
|
||||
public double survivalFlyLastFromY;
|
||||
public int survivalFlyOnIce;
|
||||
public boolean survivalFlyWasInBed;
|
||||
public long survivalFlyCobwebTime;
|
||||
public double survivalFlyCobwebVL;
|
||||
|
||||
// Locations shared between all checks.
|
||||
public final PlayerLocation from = new PlayerLocation();
|
||||
|
@ -113,7 +113,7 @@ public class MovingListener implements Listener {
|
||||
final Material mat = block.getType();
|
||||
|
||||
if (BlockProperties.isLiquid(event.getBlockAgainst().getTypeId())
|
||||
&& mat != Material.WATER_LILY)
|
||||
&& mat != Material.WATER_LILY && !player.hasPermission(Permissions.BLOCKPLACE_AGAINST_LIQUIDS))
|
||||
// The block was placed against a liquid block, cancel its
|
||||
// placement.
|
||||
event.setCancelled(true);
|
||||
|
@ -42,7 +42,7 @@ public class SurvivalFly extends Check {
|
||||
|
||||
public static final double blockingSpeed = 0.16D;
|
||||
public static final double swimmingSpeed = 0.11D;
|
||||
public static final double webSpeed = walkingSpeed * 0.15D;
|
||||
public static final double webSpeed = 0.105D; // TODO: walkingSpeed * 0.15D; <- does not work
|
||||
|
||||
public static final double modIce = 2.5D;
|
||||
|
||||
@ -223,10 +223,22 @@ public class SurvivalFly extends Check {
|
||||
double vAllowedDistance, vDistanceAboveLimit;
|
||||
if (from.isInWeb()){
|
||||
// Very simple: force players to descend or stay.
|
||||
vAllowedDistance = 0;
|
||||
vAllowedDistance = from.isOnGround() ? 0.1D : 0;
|
||||
data.jumpAmplifier = 0;
|
||||
final double vy = player.getVelocity().getY();
|
||||
vDistanceAboveLimit = vy;
|
||||
vDistanceAboveLimit = to.getY() - from.getY();
|
||||
if (cc.survivalFlyCobwebHack && vDistanceAboveLimit > 0 && hDistanceAboveLimit <= 0){
|
||||
final long now = System.currentTimeMillis();
|
||||
if (now - data.survivalFlyCobwebTime > 3000){
|
||||
data.survivalFlyCobwebTime = now;
|
||||
data.survivalFlyCobwebVL = vDistanceAboveLimit * 100D;
|
||||
}
|
||||
else data.survivalFlyCobwebVL += vDistanceAboveLimit * 100D;
|
||||
if (data.survivalFlyCobwebVL < 325) { // Totally random !
|
||||
if (data.setBack == null) data.setBack = player.getLocation();
|
||||
data.survivalFlyJumpPhase = 0;
|
||||
return data.setBack;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
vAllowedDistance = (!fromOnGround && !toOnGround ? 1.45D : 1.35D) + data.verticalFreedom;
|
||||
@ -257,6 +269,8 @@ public class SurvivalFly extends Check {
|
||||
data.survivalFlyVL *= 0.95D;
|
||||
// System.out.println("vertical freedom: " + data.verticalFreedom + " ("+data.verticalVelocity+"/"+data.verticalVelocityCounter+")");
|
||||
// Did the player move in unexpected ways?
|
||||
// System.out.println("hDist: " + hDistance + " / " + hAllowedDistance + " , vDist: " + (to.getY() - from.getY()) + " ("+player.getVelocity().getY()+")" + " / " + vAllowedDistance + " / from passable: " + BlockProperties.isPassable(from));
|
||||
// System.out.println(from.getY() +"(" + player.getLocation().getY() + ") -> " + to.getY()) ;
|
||||
if (result > 0D) {
|
||||
// Increment violation counter.
|
||||
data.survivalFlyVL += result;
|
||||
|
@ -463,6 +463,7 @@ public abstract class ConfPaths {
|
||||
public static final String MOVING_SURVIVALFLY_SPRINTINGSPEED = MOVING_SURVIVALFLY + "sprintingspeed";
|
||||
public static final String MOVING_SURVIVALFLY_SWIMMINGSPEED = MOVING_SURVIVALFLY + "swimmingspeed";
|
||||
public static final String MOVING_SURVIVALFLY_WALKINGSPEED = MOVING_SURVIVALFLY + "walkingspeed";
|
||||
public static final String MOVING_SURVIVALFLY_COBWEBHACK = MOVING_SURVIVALFLY + "cobwebhack";
|
||||
public static final String MOVING_SURVIVALFLY_ACTIONS = MOVING_SURVIVALFLY + "actions";
|
||||
|
||||
// Special (to be sorted in or factored out).
|
||||
|
@ -88,6 +88,8 @@ public class Permissions {
|
||||
* 888 88P' 888 "88 88" "88,e8' 888 8b 888 888 "88 888 "88,e8' "YeeP"
|
||||
*/
|
||||
private static final String BLOCKPLACE = CHECKS + ".blockplace";
|
||||
public static final String BLOCKPLACE_AGAINST = BLOCKPLACE + ".against";
|
||||
public static final String BLOCKPLACE_AGAINST_LIQUIDS = BLOCKPLACE_AGAINST + ".liquids";
|
||||
public static final String BLOCKPLACE_DIRECTION = BLOCKPLACE + ".direction";
|
||||
public static final String BLOCKPLACE_FASTPLACE = BLOCKPLACE + ".fastplace";
|
||||
public static final String BLOCKPLACE_NOSWING = BLOCKPLACE + ".noswing";
|
||||
@ -211,5 +213,5 @@ public class Permissions {
|
||||
public static final String ZOMBE_FLY = ZOMBE + ".fly";
|
||||
public static final String ZOMBE_NOCLIP = ZOMBE + ".noclip";
|
||||
public static final String ZOMBE_CHEAT = ZOMBE + ".cheat";
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user