Add ignore-if-block-in-hand option.

This commit is contained in:
cnaude 2013-03-25 22:38:03 -07:00
parent 02a4bbb67b
commit 7b8dba06e8
4 changed files with 9 additions and 2 deletions

View File

@ -13,6 +13,7 @@
# upsidedown-check: If true then prevent players from sitting on upside down stairs.
# seat-occupied-check: Check if seat is already occupied.
# per-item-perms: Enable chairs.sit.[item] permission node. Set to false if you're sitting on every block.
# ignore-if-block-in-hand: Set this true disable sititng if player is holding a block in hand.
# ------
allowed-blocks:
- WOOD_STAIRS
@ -43,6 +44,7 @@ seat-occupied-check: true
upper-step-check: true
per-item-perms: true
ops-override-perms: false
ignore-if-block-in-hand: false
sit-effects:
enabled: false
interval: 20

View File

@ -24,7 +24,7 @@ public class Chairs extends JavaPlugin {
public List<ChairBlock> allowedBlocks = new ArrayList<ChairBlock>();
public List<Material> validSigns = new ArrayList<Material>();
public boolean sneaking, autoRotate, signCheck, permissions, notifyplayer, opsOverridePerms;
public boolean invertedStairCheck, seatOccupiedCheck, invertedStepCheck, perItemPerms;
public boolean invertedStairCheck, seatOccupiedCheck, invertedStepCheck, perItemPerms, ignoreIfBlockInHand;
public boolean sitEffectsEnabled;
public double sittingHeight, sittingHeightAdj, distance;
public int maxChairWidth;
@ -109,6 +109,7 @@ public class Chairs extends JavaPlugin {
invertedStepCheck = getConfig().getBoolean("upper-step-check");
perItemPerms = getConfig().getBoolean("per-item-perms");
opsOverridePerms = getConfig().getBoolean("ops-override-perms");
ignoreIfBlockInHand = getConfig().getBoolean("ignore-if-block-in-hand");
sitEffectsEnabled = getConfig().getBoolean("sit-effects.enabled", false);
sitEffectInterval = getConfig().getInt("sit-effects.interval",20);

View File

@ -108,6 +108,10 @@ public class EventListener implements Listener {
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getPlayer().getItemInHand().getType().isBlock()
&& plugin.ignoreIfBlockInHand) {
return;
}
if (event.hasBlock() && event.getAction() == Action.RIGHT_CLICK_BLOCK) {
Block block = event.getClickedBlock();

View File

@ -1,5 +1,5 @@
name: Chairs
version: 1.21.0
version: 1.22.0
description: Let players sit on blocks.
authors:
- spoothie