|
18 | 18 | import com.massivecraft.factions.util.VisualizeUtil;
|
19 | 19 | import com.massivecraft.factions.zcore.fperms.Access;
|
20 | 20 | import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
21 |
| -import com.massivecraft.factions.zcore.persist.*; |
| 21 | +import com.massivecraft.factions.zcore.persist.MemoryFPlayer; |
22 | 22 | import com.massivecraft.factions.zcore.util.TL;
|
23 | 23 | import com.massivecraft.factions.zcore.util.TagUtil;
|
24 | 24 | import com.massivecraft.factions.zcore.util.TextUtil;
|
|
40 | 40 | import org.bukkit.event.inventory.InventoryCloseEvent;
|
41 | 41 | import org.bukkit.event.inventory.InventoryDragEvent;
|
42 | 42 | import org.bukkit.event.player.*;
|
43 |
| -import org.bukkit.util.NumberConversions; |
44 | 43 |
|
45 | 44 | import java.util.*;
|
46 | 45 | import java.util.logging.Level;
|
@@ -891,25 +890,27 @@ public int increment() {
|
891 | 890 | /// <param name="loc">The World location where the action is being executed</param>
|
892 | 891 | /// <param name="myFaction">The faction of the player being checked</param>
|
893 | 892 | /// <param name="access">The current's faction access permission for the action</param>
|
894 |
| - private static boolean CheckPlayerAccess(Player player, FPlayer me, FLocation loc, Faction myFaction, Access access, PermissableAction action, boolean pain) { |
| 893 | + private static boolean CheckPlayerAccess(Player player, FPlayer me, FLocation loc, Faction factionToCheck, Access access, PermissableAction action, boolean pain) { |
895 | 894 | boolean doPain = pain && Conf.handleExploitInteractionSpam;
|
896 | 895 | if (access != null && access != Access.UNDEFINED) {
|
897 | 896 | // TODO: Update this once new access values are added other than just allow / deny.
|
898 |
| - boolean landOwned = (myFaction.doesLocationHaveOwnersSet(loc) && !myFaction.getOwnerList(loc).isEmpty()); |
899 |
| - if ((landOwned && myFaction.getOwnerListString(loc).contains(player.getName())) || (me.getRole() == Role.LEADER && me.getFactionId().equals(myFaction.getId()))) return true; |
900 |
| - else if (landOwned && !myFaction.getOwnerListString(loc).contains(player.getName())) { |
901 |
| - me.msg("<b>You can't do that in this territory, it is owned by: " + myFaction.getOwnerListString(loc)); |
| 897 | + boolean landOwned = (factionToCheck.doesLocationHaveOwnersSet(loc) && !factionToCheck.getOwnerList(loc).isEmpty()); |
| 898 | + if ((landOwned && factionToCheck.getOwnerListString(loc).contains(player.getName())) || (me.getRole() == Role.LEADER && me.getFactionId().equals(factionToCheck.getId()))) |
| 899 | + return true; |
| 900 | + else if (landOwned && !factionToCheck.getOwnerListString(loc).contains(player.getName())) { |
| 901 | + me.msg("<b>You can't do that in this territory, it is owned by: " + factionToCheck.getOwnerListString(loc)); |
902 | 902 | if (doPain) {
|
903 | 903 | player.damage(Conf.actionDeniedPainAmount);
|
904 | 904 | }
|
905 | 905 | return false;
|
906 | 906 | } else if (!landOwned && access == Access.ALLOW) return true;
|
907 | 907 | else {
|
908 |
| - me.msg("You cannot " + action + " in the territory of " + myFaction.getTag(me.getFaction())); |
| 908 | + me.msg("You cannot " + action + " in the territory of " + factionToCheck.getTag(me.getFaction())); |
909 | 909 | return false;
|
910 | 910 | }
|
911 | 911 | }
|
912 |
| - me.msg("You cannot " + action + " in the territory of " + myFaction.getTag(me.getFaction())); |
| 912 | + if (me.getRole().equals(Role.LEADER) && me.getFaction().equals(factionToCheck)) return true; |
| 913 | + me.msg("You cannot " + action + " in the territory of " + factionToCheck.getTag(me.getFaction())); |
913 | 914 | return false;
|
914 | 915 | }
|
915 | 916 | /// <summary>
|
|
0 commit comments