Allow exemption for prevention of breaking special blocks (e.g. liquid).

This commit is contained in:
asofold 2013-02-24 14:30:38 +01:00
parent 7889868905
commit f37fd4b166
3 changed files with 6 additions and 1 deletions

View File

@ -40,6 +40,8 @@ public enum CheckType {
ALL(Permissions.CHECKS),
BLOCKBREAK(BlockBreakConfig.factory, BlockBreakData.factory, Permissions.BLOCKBREAK),
/** This will allow breaking all special blocks, currently only liquid. Later there might be more sub-types. */
BLOCKBREAK_BREAK(BLOCKBREAK, Permissions.BLOCKBREAK_BREAK),
BLOCKBREAK_DIRECTION(BLOCKBREAK, Permissions.BLOCKBREAK_DIRECTION),
BLOCKBREAK_FASTBREAK(BLOCKBREAK, Permissions.BLOCKBREAK_FASTBREAK),
BLOCKBREAK_FREQUENCY(BLOCKBREAK, Permissions.BLOCKBREAK_FREQUENCY),

View File

@ -174,6 +174,8 @@ public class BlockBreakConfig extends ACheckConfig {
return reachCheck;
case BLOCKBREAK_WRONGBLOCK:
return wrongBlockCheck;
case BLOCKBREAK_BREAK:
return true;
default:
return true;
}

View File

@ -15,6 +15,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
import fr.neatmonster.nocheatplus.checks.CheckListener;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.inventory.Items;
import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager;
import fr.neatmonster.nocheatplus.permissions.Permissions;
import fr.neatmonster.nocheatplus.utilities.BlockProperties;
import fr.neatmonster.nocheatplus.utilities.TickTask;
@ -136,7 +137,7 @@ public class BlockBreakListener extends CheckListener {
cancelled = true;
// Destroying liquid blocks.
if (!cancelled && BlockProperties.isLiquid(block.getTypeId()) && !player.hasPermission(Permissions.BLOCKBREAK_BREAK_LIQUID)){
if (!cancelled && BlockProperties.isLiquid(block.getTypeId()) && !player.hasPermission(Permissions.BLOCKBREAK_BREAK_LIQUID) && !NCPExemptionManager.isExempted(player, CheckType.BLOCKBREAK_BREAK)){
cancelled = true;
}