Fix right click on signs

This commit is contained in:
snowleo 2012-08-08 14:11:40 +02:00
parent 0319415f1b
commit ee072e844b

View File

@ -20,14 +20,19 @@ public class SignPlayerListener implements Listener
this.ess = ess; this.ess = ess;
} }
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOW)
public void onPlayerInteract(final PlayerInteractEvent event) public void onPlayerInteract(final PlayerInteractEvent event)
{ {
if (ess.getSettings().areSignsDisabled() || event.getAction() != Action.RIGHT_CLICK_BLOCK) if (ess.getSettings().areSignsDisabled() || (event.getAction() != Action.RIGHT_CLICK_BLOCK && event.getAction() != Action.RIGHT_CLICK_AIR))
{ {
return; return;
} }
final Block block = event.getClickedBlock(); final Block block;
if (event.isCancelled() && event.getAction() == Action.RIGHT_CLICK_AIR) {
block = event.getPlayer().getTargetBlock(null, 5);
} else {
block = event.getClickedBlock();
}
if (block == null) if (block == null)
{ {
return; return;