mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-26 02:57:42 +01:00
Ignore sneaking when checking the events.
This commit is contained in:
parent
992e53856d
commit
b52a6bd6d6
@ -329,20 +329,17 @@ public void onPlayerInteract(PlayerInteractEvent event) {
|
|||||||
case LEFT_CLICK_BLOCK:
|
case LEFT_CLICK_BLOCK:
|
||||||
placed = clicked.getRelative(event.getBlockFace());
|
placed = clicked.getRelative(event.getBlockFace());
|
||||||
|
|
||||||
// As of MC ~1.6, sneaking blocks the use of blocks with right click
|
// Only fire events for blocks that are modified when right clicked
|
||||||
if (!player.isSneaking() || event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
if (isBlockModifiedOnClick(clicked.getType()) || (item != null && isItemAppliedToBlock(item.getType(), clicked.getType()))) {
|
||||||
// Only fire events for blocks that are modified when right clicked
|
if (Events.fireAndTestCancel(new UseBlockEvent(event, cause, clicked))) {
|
||||||
if (isBlockModifiedOnClick(clicked.getType()) || (item != null && isItemAppliedToBlock(item.getType(), clicked.getType()))) {
|
event.setUseInteractedBlock(Result.DENY);
|
||||||
if (Events.fireAndTestCancel(new UseBlockEvent(event, cause, clicked))) {
|
}
|
||||||
event.setUseInteractedBlock(Result.DENY);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle connected blocks (i.e. beds, chests)
|
// Handle connected blocks (i.e. beds, chests)
|
||||||
for (Block connected : Blocks.getConnected(clicked)) {
|
for (Block connected : Blocks.getConnected(clicked)) {
|
||||||
if (Events.fireAndTestCancel(new UseBlockEvent(event, create(event.getPlayer()), connected))) {
|
if (Events.fireAndTestCancel(new UseBlockEvent(event, create(event.getPlayer()), connected))) {
|
||||||
event.setUseInteractedBlock(Result.DENY);
|
event.setUseInteractedBlock(Result.DENY);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user