Skip to content
This repository has been archived by the owner on Jul 7, 2023. It is now read-only.

Commit

Permalink
Scoped left click to be catched in PlayerInteract
Browse files Browse the repository at this point in the history
  • Loading branch information
SvenjaReißaus committed Mar 19, 2019
1 parent af210f7 commit 97f63e9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Binary file modified classes/artifacts/Factions_jar/Factions.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,7 @@ else if (landOwned && !myFaction.getOwnerListString(loc).contains(player.getName
}
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) {
Expand All @@ -512,7 +510,7 @@ private static boolean CheckActionState(Faction target, FLocation location, FPla
if (pain && Conf.ownedAreaPainBuild) me.msg("<b>It is painful to try to " + action + " in this territory, it is owned by: " + target.getOwnerListString(location));
if (Conf.ownedAreaDenyBuild && pain) return false;
else if (Conf.ownedAreaDenyBuild) {
me.msg("You cannot " + action + " in the territory of" + target.getTag(me.getFaction()));
me.msg("You cannot " + action + " in the territory of " + target.getTag(me.getFaction()));
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,8 @@ public void onClose(InventoryCloseEvent e) {
@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()
Expand Down

0 comments on commit 97f63e9

Please sign in to comment.