Scoped left click to be catched in PlayerInteract

This commit is contained in:
SvenjaReißaus 2019-03-18 21:14:23 -05:00
parent af210f706b
commit 97f63e9bc0
No known key found for this signature in database
GPG Key ID: E5494A03FA36D54B
3 changed files with 4 additions and 5 deletions

View File

@ -501,9 +501,7 @@ public class FactionsBlockListener implements Listener {
}
me.msg(TL.GENERIC_NOPERMISSION, action);
return false;
} else if (access == Access.ALLOW) return true;
// We assume faction land is not owned, and the access is not set to DENY, so we allow to execute the action
return false;
} else return access == Access.ALLOW;
}
private static boolean CheckActionState(Faction target, FLocation location, FPlayer me, PermissableAction action, boolean pain) {

View File

@ -857,7 +857,8 @@ public class FactionsPlayerListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent event) {
// 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) {
Material handItem = event.getPlayer().getItemInHand().getType();
if (handItem.isEdible()