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) {
|
||||||
@ -512,7 +510,7 @@ public class FactionsBlockListener implements Listener {
|
|||||||
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 (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;
|
if (Conf.ownedAreaDenyBuild && pain) return false;
|
||||||
else if (Conf.ownedAreaDenyBuild) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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