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. # upsidedown-check: If true then prevent players from sitting on upside down stairs.
# seat-occupied-check: Check if seat is already occupied. # 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. # 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: allowed-blocks:
- WOOD_STAIRS - WOOD_STAIRS
@ -43,6 +44,7 @@ seat-occupied-check: true
upper-step-check: true upper-step-check: true
per-item-perms: true per-item-perms: true
ops-override-perms: false ops-override-perms: false
ignore-if-block-in-hand: false
sit-effects: sit-effects:
enabled: false enabled: false
interval: 20 interval: 20

View File

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

View File

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

View File

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