Fix for crop trampling and pressure plates not being protected due to bug introduced in recent performance overhaul

This commit is contained in:
Brettflan 2012-11-06 15:01:34 -06:00
parent c11d9b03a3
commit ade3c6b320
1 changed files with 4 additions and 1 deletions

View File

@ -222,7 +222,8 @@ public class FactionsPlayerListener implements Listener
public void onPlayerInteract(PlayerInteractEvent event) public void onPlayerInteract(PlayerInteractEvent event)
{ {
if (event.isCancelled()) return; if (event.isCancelled()) return;
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return; // only interested in right-clicks as of MC 1.4+; good performance boost // only need to check right-clicks and physical as of MC 1.4+; good performance boost
if (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.PHYSICAL) return;
Block block = event.getClickedBlock(); Block block = event.getClickedBlock();
Player player = event.getPlayer(); Player player = event.getPlayer();
@ -252,6 +253,8 @@ public class FactionsPlayerListener implements Listener
return; return;
} }
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return; // only interested on right-clicks for below
if ( ! playerCanUseItemHere(player, block.getLocation(), event.getMaterial(), false)) if ( ! playerCanUseItemHere(player, block.getLocation(), event.getMaterial(), false))
{ {
event.setCancelled(true); event.setCancelled(true);