mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-03-14 15:39:36 +01:00
Option to automatically identify "creative" mode or not for flying
Option to also check "instant-breaking" blocks for blockbreak.direction
This commit is contained in:
parent
3895ff029f
commit
75050efbbd
@ -3,7 +3,7 @@ name: NoCheat
|
||||
author: Evenprime
|
||||
|
||||
main: cc.co.evenprime.bukkit.nocheat.NoCheat
|
||||
version: 2.08
|
||||
version: 2.08a
|
||||
|
||||
commands:
|
||||
nocheat:
|
||||
|
@ -58,6 +58,8 @@ public class DefaultConfiguration {
|
||||
root.add(movingNode);
|
||||
|
||||
movingNode.add(new BooleanOption("check", true, true));
|
||||
|
||||
movingNode.add(new BooleanOption("identifycreativemode", true, false));
|
||||
|
||||
/**** MOVING.WALKING ****/
|
||||
{
|
||||
@ -158,6 +160,8 @@ public class DefaultConfiguration {
|
||||
interactNode.add(directionNode);
|
||||
|
||||
directionNode.add(new BooleanOption("check", true, true));
|
||||
|
||||
directionNode.add(new BooleanOption("checkinstabreakblocks", false, false));
|
||||
|
||||
ActionListOption actions = new ActionListOption("actions");
|
||||
|
||||
|
@ -26,8 +26,8 @@ public class Explainations {
|
||||
set("debug.showactivechecks", "Print to the console an overview of all checks that are enabled when NoCheat gets loaded.");
|
||||
|
||||
set("moving.check", "If true, do various checks on PlayerMove events.");
|
||||
|
||||
|
||||
set("moving.identifycreativemode", "If true, NoCheat will automatically identify if players are in creative mode and will allow them to fly, avoid fall damage etc.");
|
||||
|
||||
set("moving.runfly.check", "If true, check if a player is walking/sprinting/sneaking/swimming too fast/high.");
|
||||
set("moving.runfly.walkingspeedlimit", "Set the speed limit for moving horizontal under 'normal' conditions.\nUnit is 1/100 of a block, default is 22.");
|
||||
set("moving.runfly.sprintingspeedlimit", "Set the speed limit for moving horizontal while sprinting.\nUnit is 1/100 of a block, default is 40.");
|
||||
@ -61,6 +61,7 @@ public class Explainations {
|
||||
set("blockbreak.reach.actions", "What should be done if a player is breaking blocks that are too far away.\nUnit is number of break(attempt)s beyond the limit.");
|
||||
|
||||
set("blockbreak.direction.check", "If true, check if a player is looking at the block that he's breaking.");
|
||||
set("blockbreak.direction.checkinstabreakblocks", "If true, NoCheat will also check for direction for Instant-Breaking blocks.\nTHIS WILL CAUSE FALSE POSITIVES, when a player keeps his mouse button pressed and moves the mouse fast over the screen.");
|
||||
set("blockbreak.direction.actions", "What should be done if a player is breaking blocks that are not in his line of sight.\nUnit is number of break(attempt)s outside the line of sight.");
|
||||
|
||||
set("blockplace.check", "If true, do various checks on BlockPlace events.");
|
||||
|
@ -51,8 +51,8 @@ public class BlockBreakCheck {
|
||||
cancel = reachCheck.check(player, factor, data, cc);
|
||||
}
|
||||
|
||||
if(!cancel && direction && !brokenBlock.getLocation().equals(data.instaBrokeBlockLocation)) {
|
||||
cancel = directionCheck.check(player, factor, x1, y1, z1, data, cc);
|
||||
if(!cancel && direction) {
|
||||
cancel = directionCheck.check(player, factor, x1, y1, z1, brokenBlock, data, cc);
|
||||
}
|
||||
}
|
||||
return cancel;
|
||||
|
@ -2,6 +2,7 @@ package cc.co.evenprime.bukkit.nocheat.checks.blockbreak;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -27,10 +28,15 @@ public class DirectionCheck {
|
||||
this.action = new ActionExecutorWithHistory(plugin);
|
||||
}
|
||||
|
||||
public boolean check(Player player, double factor, double x1, double y1, double z1, BlockBreakData data, ConfigurationCache cc) {
|
||||
public boolean check(Player player, double factor, double x1, double y1, double z1, Block brokenBlock, BlockBreakData data, ConfigurationCache cc) {
|
||||
|
||||
// If the block is instabreak and we don't check instabreak, return
|
||||
if(!cc.blockbreak.checkinstabreakblocks && brokenBlock.getLocation().equals(data.instaBrokeBlockLocation)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean cancel = false;
|
||||
|
||||
|
||||
Vector direction = player.getEyeLocation().getDirection();
|
||||
final double x2 = x1 + 2;
|
||||
final double y2 = y1 + 2;
|
||||
|
@ -72,7 +72,7 @@ public class RunFlyCheck {
|
||||
|
||||
/************* DECIDE WHICH CHECKS NEED TO BE RUN *************/
|
||||
final boolean runflyCheck = cc.moving.runflyCheck && !player.hasPermission(Permissions.MOVE_RUNFLY);
|
||||
final boolean flyAllowed = cc.moving.allowFlying || player.hasPermission(Permissions.MOVE_FLY) || (player.getGameMode() == GameMode.CREATIVE);
|
||||
final boolean flyAllowed = cc.moving.allowFlying || player.hasPermission(Permissions.MOVE_FLY) || (player.getGameMode() == GameMode.CREATIVE && cc.moving.identifyCreativeMode);
|
||||
final boolean morepacketsCheck = cc.moving.morePacketsCheck && !player.hasPermission(Permissions.MOVE_MOREPACKETS);
|
||||
final boolean noclipCheck = cc.moving.noclipCheck && !player.hasPermission(Permissions.MOVE_NOCLIP);
|
||||
|
||||
|
@ -13,6 +13,7 @@ import cc.co.evenprime.bukkit.nocheat.config.Configuration;
|
||||
public class CCBlockBreak {
|
||||
|
||||
public final boolean check;
|
||||
public final boolean checkinstabreakblocks;
|
||||
public final boolean reachCheck;
|
||||
public final double reachDistance;
|
||||
public final ActionList reachActions;
|
||||
@ -22,11 +23,13 @@ public class CCBlockBreak {
|
||||
public CCBlockBreak(Configuration data) {
|
||||
|
||||
check = data.getBoolean("blockbreak.check");
|
||||
|
||||
reachCheck = data.getBoolean("blockbreak.reach.check");
|
||||
reachDistance = ((double) data.getInteger("blockbreak.reach.reachlimit")) / 100D;
|
||||
reachActions = data.getActionList("blockbreak.reach.actions");
|
||||
|
||||
directionCheck = data.getBoolean("blockbreak.direction.check");
|
||||
directionActions = data.getActionList("blockbreak.direction.actions");
|
||||
checkinstabreakblocks = data.getBoolean("blockbreak.direction.checkinstabreakblocks");
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ public class CCMoving {
|
||||
public final boolean check;
|
||||
|
||||
public final boolean runflyCheck;
|
||||
public final boolean identifyCreativeMode;
|
||||
public final double walkingSpeedLimit;
|
||||
public final double sprintingSpeedLimit;
|
||||
public final double jumpheight;
|
||||
@ -41,8 +42,10 @@ public class CCMoving {
|
||||
public CCMoving(Configuration data) {
|
||||
|
||||
check = data.getBoolean("moving.check");
|
||||
identifyCreativeMode = data.getBoolean("moving.identifycreativemode");
|
||||
|
||||
runflyCheck = data.getBoolean("moving.runfly.check");
|
||||
|
||||
walkingSpeedLimit = ((double) data.getInteger("moving.runfly.walkingspeedlimit")) / 100D;
|
||||
sprintingSpeedLimit = ((double) data.getInteger("moving.runfly.sprintingspeedlimit")) / 100D;
|
||||
jumpheight = ((double) data.getInteger("moving.runfly.jumpheight")) / 100D;
|
||||
|
Loading…
Reference in New Issue
Block a user