Allow exemption for blockplace/against checks.

Adds a CheckType for this purpose.
This commit is contained in:
asofold 2013-02-23 17:09:15 +01:00
parent 47862a651f
commit b72b51e317
3 changed files with 6 additions and 2 deletions

View File

@ -54,6 +54,7 @@ public enum CheckType {
BLOCKINTERACT_VISIBLE(BLOCKINTERACT, Permissions.BLOCKINTERACT_VISIBLE),
BLOCKPLACE(BlockPlaceConfig.factory, BlockPlaceData.factory, Permissions.BLOCKPLACE),
BLOCKPLACE_AGAINST(BLOCKPLACE, Permissions.BLOCKPLACE_AGAINST),
BLOCKPLACE_DIRECTION(BLOCKPLACE, Permissions.BLOCKPLACE_DIRECTION),
BLOCKPLACE_FASTPLACE(BLOCKPLACE, Permissions.BLOCKPLACE_FASTPLACE),
BLOCKPLACE_NOSWING(BLOCKPLACE, Permissions.BLOCKPLACE_NOSWING),

View File

@ -134,6 +134,8 @@ public class BlockPlaceConfig extends ACheckConfig {
return reachCheck;
case BLOCKPLACE_SPEED:
return speedCheck;
case BLOCKPLACE_AGAINST:
return true;
default:
return true;
}

View File

@ -18,6 +18,7 @@ import fr.neatmonster.nocheatplus.checks.CheckListener;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.combined.Combined;
import fr.neatmonster.nocheatplus.checks.combined.Improbable;
import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager;
import fr.neatmonster.nocheatplus.permissions.Permissions;
import fr.neatmonster.nocheatplus.utilities.BlockProperties;
@ -97,10 +98,10 @@ public class BlockPlaceListener extends CheckListener {
final int againstId = blockAgainst.getTypeId();
if (BlockProperties.isLiquid(againstId)){
if ((mat != Material.WATER_LILY || !BlockProperties.isLiquid(block.getRelative(BlockFace.DOWN).getTypeId()))
&& !player.hasPermission(Permissions.BLOCKPLACE_AGAINST_LIQUIDS)) cancelled = true;
&& !player.hasPermission(Permissions.BLOCKPLACE_AGAINST_LIQUIDS) && !NCPExemptionManager.isExempted(player, CheckType.BLOCKPLACE_AGAINST)) cancelled = true;
}
else if (againstId == Material.AIR.getId()){
if (!player.hasPermission(Permissions.BLOCKPLACE_AGAINST_AIR)) cancelled = true;
if (!player.hasPermission(Permissions.BLOCKPLACE_AGAINST_AIR) && !NCPExemptionManager.isExempted(player, CheckType.BLOCKPLACE_AGAINST)) cancelled = true;
}
// First, the fast place check.