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

Commit af210f7

Browse files
author
SvenjaReißaus
committed
Attempting to fix item useage
1 parent 3c109bf commit af210f7

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed
-42 Bytes
Binary file not shown.

src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java

+5-8
Original file line numberDiff line numberDiff line change
@@ -317,18 +317,16 @@ public static boolean canPlayerUseBlock(Player player, Block block, boolean just
317317
}
318318

319319
// Move up access check to check for exceptions
320-
Access access = otherFaction.getAccess(me, action);
321320
if (!otherFaction.getId().equals(myFaction.getId())) { // If the faction target is not my own
322321
if (SavageFactions.plugin.getConfig().getBoolean("hcf.raidable", false) && otherFaction.getLandRounded() > otherFaction.getPowerRounded())
323322
return true;
324323
// Get faction pain build access relation to me
325324
boolean pain = !justCheck && otherFaction.getAccess(me, PermissableAction.PAIN_BUILD) == Access.ALLOW;
326-
return CheckPlayerAccess(player, me, loc, otherFaction, access, action, pain);
327-
} else if (otherFaction.getId().equals(myFaction.getId())) {
328-
boolean pain = !justCheck && myFaction.getAccess(me, PermissableAction.PAIN_BUILD) == Access.ALLOW;
329-
return CheckPlayerAccess(player, me, loc, myFaction, access, action, pain);
325+
return CheckPlayerAccess(player, me, loc, otherFaction, otherFaction.getAccess(me, action), action, pain);
326+
} else if (otherFaction.getId().equals(myFaction.getId())) {;
327+
return CheckPlayerAccess(player, me, loc, myFaction, myFaction.getAccess(me, action), action, (!justCheck && myFaction.getAccess(me, PermissableAction.PAIN_BUILD) == Access.ALLOW));
330328
}
331-
return CheckPlayerAccess(player, me, loc, myFaction, access, action, Conf.territoryPainBuild);
329+
return CheckPlayerAccess(player, me, loc, myFaction, otherFaction.getAccess(me, action), action, Conf.territoryPainBuild);
332330
}
333331

334332

@@ -882,7 +880,6 @@ public void onPlayerInteract(PlayerInteractEvent event) {
882880

883881
if (playerCanUseItemHere(player, block.getLocation(), event.getMaterial(), false)) return;
884882

885-
SavageFactions.plugin.log("Something has failed, canceling the event");
886883
event.setCancelled(true);
887884
}
888885

@@ -1020,7 +1017,7 @@ private static boolean CheckPlayerAccess(Player player, FPlayer me, FLocation lo
10201017
if (access != null && access != Access.UNDEFINED) {
10211018
// TODO: Update this once new access values are added other than just allow / deny.
10221019
boolean landOwned = (myFaction.doesLocationHaveOwnersSet(loc) && !myFaction.getOwnerList(loc).isEmpty());
1023-
if (landOwned && myFaction.getOwnerListString(loc).contains(player.getName()) || me.getRole() == Role.LEADER) return true;
1020+
if ((landOwned && myFaction.getOwnerListString(loc).contains(player.getName())) || (me.getRole() == Role.LEADER && me.getFactionId().equals(myFaction.getId()))) return true;
10241021
else if (landOwned && !myFaction.getOwnerListString(loc).contains(player.getName())) {
10251022
me.msg("<b>You can't do that in this territory, it is owned by: " + myFaction.getOwnerListString(loc));
10261023
if (doPain) {

0 commit comments

Comments
 (0)