mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-10-15 23:05:40 +02: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
|
author: Evenprime
|
||||||
|
|
||||||
main: cc.co.evenprime.bukkit.nocheat.NoCheat
|
main: cc.co.evenprime.bukkit.nocheat.NoCheat
|
||||||
version: 2.08
|
version: 2.08a
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
nocheat:
|
nocheat:
|
||||||
|
@ -59,6 +59,8 @@ public class DefaultConfiguration {
|
|||||||
|
|
||||||
movingNode.add(new BooleanOption("check", true, true));
|
movingNode.add(new BooleanOption("check", true, true));
|
||||||
|
|
||||||
|
movingNode.add(new BooleanOption("identifycreativemode", true, false));
|
||||||
|
|
||||||
/**** MOVING.WALKING ****/
|
/**** MOVING.WALKING ****/
|
||||||
{
|
{
|
||||||
ParentOption runflyNode = new ParentOption("runfly");
|
ParentOption runflyNode = new ParentOption("runfly");
|
||||||
@ -159,6 +161,8 @@ public class DefaultConfiguration {
|
|||||||
|
|
||||||
directionNode.add(new BooleanOption("check", true, true));
|
directionNode.add(new BooleanOption("check", true, true));
|
||||||
|
|
||||||
|
directionNode.add(new BooleanOption("checkinstabreakblocks", false, false));
|
||||||
|
|
||||||
ActionListOption actions = new ActionListOption("actions");
|
ActionListOption actions = new ActionListOption("actions");
|
||||||
|
|
||||||
directionNode.add(actions);
|
directionNode.add(actions);
|
||||||
|
@ -26,7 +26,7 @@ public class Explainations {
|
|||||||
set("debug.showactivechecks", "Print to the console an overview of all checks that are enabled when NoCheat gets loaded.");
|
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.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.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.walkingspeedlimit", "Set the speed limit for moving horizontal under 'normal' conditions.\nUnit is 1/100 of a block, default is 22.");
|
||||||
@ -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.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.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("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.");
|
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);
|
cancel = reachCheck.check(player, factor, data, cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!cancel && direction && !brokenBlock.getLocation().equals(data.instaBrokeBlockLocation)) {
|
if(!cancel && direction) {
|
||||||
cancel = directionCheck.check(player, factor, x1, y1, z1, data, cc);
|
cancel = directionCheck.check(player, factor, x1, y1, z1, brokenBlock, data, cc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cancel;
|
return cancel;
|
||||||
|
@ -2,6 +2,7 @@ package cc.co.evenprime.bukkit.nocheat.checks.blockbreak;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -27,7 +28,12 @@ public class DirectionCheck {
|
|||||||
this.action = new ActionExecutorWithHistory(plugin);
|
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;
|
boolean cancel = false;
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ public class RunFlyCheck {
|
|||||||
|
|
||||||
/************* DECIDE WHICH CHECKS NEED TO BE RUN *************/
|
/************* DECIDE WHICH CHECKS NEED TO BE RUN *************/
|
||||||
final boolean runflyCheck = cc.moving.runflyCheck && !player.hasPermission(Permissions.MOVE_RUNFLY);
|
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 morepacketsCheck = cc.moving.morePacketsCheck && !player.hasPermission(Permissions.MOVE_MOREPACKETS);
|
||||||
final boolean noclipCheck = cc.moving.noclipCheck && !player.hasPermission(Permissions.MOVE_NOCLIP);
|
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 class CCBlockBreak {
|
||||||
|
|
||||||
public final boolean check;
|
public final boolean check;
|
||||||
|
public final boolean checkinstabreakblocks;
|
||||||
public final boolean reachCheck;
|
public final boolean reachCheck;
|
||||||
public final double reachDistance;
|
public final double reachDistance;
|
||||||
public final ActionList reachActions;
|
public final ActionList reachActions;
|
||||||
@ -22,11 +23,13 @@ public class CCBlockBreak {
|
|||||||
public CCBlockBreak(Configuration data) {
|
public CCBlockBreak(Configuration data) {
|
||||||
|
|
||||||
check = data.getBoolean("blockbreak.check");
|
check = data.getBoolean("blockbreak.check");
|
||||||
|
|
||||||
reachCheck = data.getBoolean("blockbreak.reach.check");
|
reachCheck = data.getBoolean("blockbreak.reach.check");
|
||||||
reachDistance = ((double) data.getInteger("blockbreak.reach.reachlimit")) / 100D;
|
reachDistance = ((double) data.getInteger("blockbreak.reach.reachlimit")) / 100D;
|
||||||
reachActions = data.getActionList("blockbreak.reach.actions");
|
reachActions = data.getActionList("blockbreak.reach.actions");
|
||||||
|
|
||||||
directionCheck = data.getBoolean("blockbreak.direction.check");
|
directionCheck = data.getBoolean("blockbreak.direction.check");
|
||||||
directionActions = data.getActionList("blockbreak.direction.actions");
|
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 check;
|
||||||
|
|
||||||
public final boolean runflyCheck;
|
public final boolean runflyCheck;
|
||||||
|
public final boolean identifyCreativeMode;
|
||||||
public final double walkingSpeedLimit;
|
public final double walkingSpeedLimit;
|
||||||
public final double sprintingSpeedLimit;
|
public final double sprintingSpeedLimit;
|
||||||
public final double jumpheight;
|
public final double jumpheight;
|
||||||
@ -41,8 +42,10 @@ public class CCMoving {
|
|||||||
public CCMoving(Configuration data) {
|
public CCMoving(Configuration data) {
|
||||||
|
|
||||||
check = data.getBoolean("moving.check");
|
check = data.getBoolean("moving.check");
|
||||||
|
identifyCreativeMode = data.getBoolean("moving.identifycreativemode");
|
||||||
|
|
||||||
runflyCheck = data.getBoolean("moving.runfly.check");
|
runflyCheck = data.getBoolean("moving.runfly.check");
|
||||||
|
|
||||||
walkingSpeedLimit = ((double) data.getInteger("moving.runfly.walkingspeedlimit")) / 100D;
|
walkingSpeedLimit = ((double) data.getInteger("moving.runfly.walkingspeedlimit")) / 100D;
|
||||||
sprintingSpeedLimit = ((double) data.getInteger("moving.runfly.sprintingspeedlimit")) / 100D;
|
sprintingSpeedLimit = ((double) data.getInteger("moving.runfly.sprintingspeedlimit")) / 100D;
|
||||||
jumpheight = ((double) data.getInteger("moving.runfly.jumpheight")) / 100D;
|
jumpheight = ((double) data.getInteger("moving.runfly.jumpheight")) / 100D;
|
||||||
|
Loading…
Reference in New Issue
Block a user