Add permission for breaking fluids.

This commit is contained in:
asofold 2012-10-07 00:17:49 +02:00
parent 81c924225d
commit 1bb1dd8a89
3 changed files with 14 additions and 0 deletions

View File

@ -72,6 +72,11 @@ permissions:
nocheatplus.checks.blockbreak:
description: Allow the player to bypass all BlockBreak checks.
children:
nocheatplus.checks.blockbreak.break:
description: Allow the player to break special blocks.
children:
nocheatplus.checks.blockbreak.break.fluid:
description: Allow players to break fluids.
nocheatplus.checks.blockbreak.direction:
description: Allow the player to bypass to Direction check.
nocheatplus.checks.blockbreak.fastbreak:

View File

@ -13,6 +13,8 @@ import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.player.PlayerAnimationEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import fr.neatmonster.nocheatplus.players.Permissions;
import fr.neatmonster.nocheatplus.utilities.BlockProperties;
import fr.neatmonster.nocheatplus.utilities.TickTask;
/*
@ -122,6 +124,11 @@ public class BlockBreakListener implements Listener {
if (!cancelled && direction.isEnabled(player) && direction.check(player, block.getLocation(), data))
cancelled = true;
// Destroying liquid blocks.
if (!cancelled && BlockProperties.isLiquid(block.getTypeId()) && !player.hasPermission(Permissions.BLOCKBREAK_BREAK_LIQUID)){
cancelled = true;
}
// At least one check failed and demanded to cancel the event.
if (cancelled){
event.setCancelled(cancelled);

View File

@ -62,6 +62,8 @@ public class Permissions {
* 888 88P' 888 "88 88" "88,e8' 888 8b 888 88P' 888 "YeeP" "88 888 888 8b
*/
private static final String BLOCKBREAK = CHECKS + ".blockbreak";
public static final String BLOCKBREAK_BREAK = BLOCKBREAK + ".break";
public static final String BLOCKBREAK_BREAK_LIQUID = BLOCKBREAK_BREAK + ".liquid";
public static final String BLOCKBREAK_DIRECTION = BLOCKBREAK + ".direction";
public static final String BLOCKBREAK_FASTBREAK = BLOCKBREAK + ".fastbreak";
public static final String BLOCKBREAK_FREQUENCY = BLOCKBREAK + ".frequency";