diff --git a/src/config.yml b/src/config.yml index 0a42264..ddf7f27 100644 --- a/src/config.yml +++ b/src/config.yml @@ -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 diff --git a/src/net/spoothie/chairs/Chairs.java b/src/net/spoothie/chairs/Chairs.java index 53dd854..3cc0ee9 100644 --- a/src/net/spoothie/chairs/Chairs.java +++ b/src/net/spoothie/chairs/Chairs.java @@ -24,7 +24,7 @@ public class Chairs extends JavaPlugin { public List allowedBlocks = new ArrayList(); public List validSigns = new ArrayList(); 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); diff --git a/src/net/spoothie/chairs/EventListener.java b/src/net/spoothie/chairs/EventListener.java index b8b4cfb..40cc9f9 100644 --- a/src/net/spoothie/chairs/EventListener.java +++ b/src/net/spoothie/chairs/EventListener.java @@ -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(); diff --git a/src/plugin.yml b/src/plugin.yml index de2700e..cd23a86 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,5 +1,5 @@ name: Chairs -version: 1.21.0 +version: 1.22.0 description: Let players sit on blocks. authors: - spoothie