mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-17 21:11:26 +01:00
Add permission for breaking fluids.
This commit is contained in:
parent
81c924225d
commit
1bb1dd8a89
@ -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:
|
||||
|
@ -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);
|
||||
|
@ -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";
|
||||
|
Loading…
Reference in New Issue
Block a user