diff --git a/src/main/java/com/massivecraft/factions/cmd/FCommand.java b/src/main/java/com/massivecraft/factions/cmd/FCommand.java index 0d81676e..d5fef8cb 100644 --- a/src/main/java/com/massivecraft/factions/cmd/FCommand.java +++ b/src/main/java/com/massivecraft/factions/cmd/FCommand.java @@ -50,7 +50,7 @@ public abstract class FCommand extends MCommand
{ if (this.actionPermission == null || this.fme == null) return false; if (!this.fme.isAdminBypassing()) { Access access = myFaction.getAccess(this.fme, this.actionPermission); - if (access != Access.ALLOW && this.fme.getRole() != Role.ADMIN) { + if (access == Access.DENY) { return false; } } @@ -60,7 +60,7 @@ public abstract class FCommand extends MCommand
{ if (this.actionPermission == null || this.fme == null) return false; if (!this.fme.isAdminBypassing() && checkifAdmin) { Access access = myFaction.getAccess(this.fme, this.actionPermission); - if (access != Access.ALLOW && this.fme.getRole() != Role.ADMIN) { + if (access == Access.DENY) { return false; } } @@ -70,7 +70,7 @@ public abstract class FCommand extends MCommand
{ if (this.permission == null || this.fme == null) return false; if (!this.fme.isAdminBypassing()) { Access access = myFaction.getAccess(this.fme, perm); - if (access != Access.ALLOW && this.fme.getRole() != Role.ADMIN) { + if (access == Access.DENY) { return false; } } @@ -80,7 +80,7 @@ public abstract class FCommand extends MCommand
{ if (this.permission == null || this.fme == null) return false; if (!this.fme.isAdminBypassing() && checkifAdmin) { Access access = myFaction.getAccess(this.fme, perm); - if (access != Access.ALLOW && this.fme.getRole() != Role.ADMIN) { + if (access == Access.DENY) { return false; } } diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java index 7fb0b14a..fc0e514a 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsBlockListener.java @@ -75,13 +75,15 @@ public class FactionsBlockListener implements Listener { return; } FPlayer fme = FPlayers.getInstance().getByPlayer(event.getPlayer()); + Faction faction = Board.getInstance().getFactionAt(new FLocation(event.getBlock().getLocation())); if (!fme.hasFaction()) { return; } if (event.getBlock().getType() == P.p.MOB_SPANWER) { if (!fme.isAdminBypassing()) { Access access = fme.getFaction().getAccess(fme, PermissableAction.SPAWNER); - if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) { + // We don't want other factions to break blocks unless allowed + if (access == Access.DENY || (access != Access.ALLOW && fme.getFaction() != faction)) { fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "mine spawners"); return; } @@ -381,7 +383,7 @@ public class FactionsBlockListener implements Listener { // Check the permission just after making sure the land isn't owned by someone else to avoid bypass. Access access = otherFaction.getAccess(me, PermissableAction.fromString(action)); - if (access != Access.ALLOW && me.getRole() != Role.ADMIN) { + if (access == Access.DENY || (access != Access.ALLOW && me.getFaction() != otherFaction)) { // TODO: Update this once new access values are added other than just allow / deny. if (access == Access.DENY) { me.msg(TL.GENERIC_NOPERMISSION, action); diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 445bef56..28568dbc 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -311,11 +311,11 @@ public class FactionsPlayerListener implements Listener { } Access access = otherFaction.getAccess(me, action); - if (access != Access.ALLOW && me.getRole() != Role.ADMIN) { + if (access == Access.DENY || (access != Access.ALLOW && me.getFaction() != otherFaction)) { // TODO: Update this once new access values are added other than just allow / deny. - if ((myFaction.getOwnerListString(loc) != null && !myFaction.getOwnerListString(loc).isEmpty() && myFaction.getOwnerListString(loc).contains(player.getName()))) { + if ((myFaction.getOwnerListString(loc) != null && !myFaction.getOwnerListString(loc).isEmpty() && myFaction.isPlayerInOwnerList(me, loc))) { return true; - } else if (myFaction.getOwnerListString(loc) != null && !myFaction.getOwnerListString(loc).isEmpty() && !myFaction.getOwnerListString(loc).contains(player.getName())) { + } else if (myFaction.getOwnerListString(loc) != null && !myFaction.getOwnerListString(loc).isEmpty() && !myFaction.isPlayerInOwnerList(me, loc)) { me.msg("You can't " + action + " in this territory, it is owned by: " + myFaction.getOwnerListString(loc)); return false; } else if (access == Access.DENY) { @@ -441,14 +441,14 @@ public class FactionsPlayerListener implements Listener { } } } - + // We might enable flight on player join just so he doesn't have to /f fly even if the ffly.AutoEnable option is enabled: + enableFly(me); fallMap.put(me.getPlayer(), false); Bukkit.getScheduler().scheduleSyncDelayedTask(P.p, new Runnable() { @Override public void run() { fallMap.remove(me.getPlayer()); - } }, 180L); @@ -532,6 +532,7 @@ public class FactionsPlayerListener implements Listener { } public void enableFly(FPlayer me) { + if (!P.p.getConfig().getBoolean("enable-faction-flight")) return; if (P.p.getConfig().getBoolean("ffly.AutoEnable")) { me.setFlying(true);