mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Merge pull request #2635 from traksag/interact-fix
Fix interact handling for sneaking players
This commit is contained in:
commit
4d1d3a165c
@ -1925,13 +1925,21 @@ import java.util.regex.Pattern;
|
|||||||
case RIGHT_CLICK_BLOCK: {
|
case RIGHT_CLICK_BLOCK: {
|
||||||
Material blockType = block.getType();
|
Material blockType = block.getType();
|
||||||
eventType = PlayerBlockEventType.INTERACT_BLOCK;
|
eventType = PlayerBlockEventType.INTERACT_BLOCK;
|
||||||
if (blockType.isInteractable() && player.isSneaking()) {
|
|
||||||
return; //this returns so the block place event is called
|
|
||||||
}
|
|
||||||
blocktype1 = BukkitAdapter.asBlockType(block.getType());
|
blocktype1 = BukkitAdapter.asBlockType(block.getType());
|
||||||
|
|
||||||
|
if (blockType.isInteractable()) {
|
||||||
if (!player.isSneaking()) {
|
if (!player.isSneaking()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
ItemStack hand = player.getInventory().getItemInMainHand();
|
||||||
|
ItemStack offHand = player.getInventory().getItemInOffHand();
|
||||||
|
|
||||||
|
// sneaking players interact with blocks if both hands are empty
|
||||||
|
if (hand.getType() == Material.AIR && offHand.getType() == Material.AIR) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Material type = event.getMaterial();
|
Material type = event.getMaterial();
|
||||||
|
|
||||||
// in the following, lb needs to have the material of the item in hand i.e. type
|
// in the following, lb needs to have the material of the item in hand i.e. type
|
||||||
|
Loading…
Reference in New Issue
Block a user