Scoped left click to be catched in PlayerInteract
This commit is contained in:
parent
af210f706b
commit
97f63e9bc0
Binary file not shown.
@ -501,9 +501,7 @@ public class FactionsBlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
me.msg(TL.GENERIC_NOPERMISSION, action);
|
me.msg(TL.GENERIC_NOPERMISSION, action);
|
||||||
return false;
|
return false;
|
||||||
} else if (access == Access.ALLOW) return true;
|
} else return access == Access.ALLOW;
|
||||||
// We assume faction land is not owned, and the access is not set to DENY, so we allow to execute the action
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean CheckActionState(Faction target, FLocation location, FPlayer me, PermissableAction action, boolean pain) {
|
private static boolean CheckActionState(Faction target, FLocation location, FPlayer me, PermissableAction action, boolean pain) {
|
||||||
|
@ -857,7 +857,8 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
// only need to check right-clicks and physical 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.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) || event.getAction() != Action.PHYSICAL) return;
|
if (event.getAction() != Action.PHYSICAL) return;
|
||||||
|
if (!event.getAction().equals(Action.LEFT_CLICK_BLOCK) || !event.getAction().equals(Action.LEFT_CLICK_AIR)) return;
|
||||||
if (event.getPlayer().getItemInHand() != null) {
|
if (event.getPlayer().getItemInHand() != null) {
|
||||||
Material handItem = event.getPlayer().getItemInHand().getType();
|
Material handItem = event.getPlayer().getItemInHand().getType();
|
||||||
if (handItem.isEdible()
|
if (handItem.isEdible()
|
||||||
|
Loading…
Reference in New Issue
Block a user