Revert "Access check updated"

This reverts commit 6eccfa84f1.
This commit is contained in:
ProSavage 2018-09-04 18:13:50 -05:00
parent ff59fd50cc
commit 99a747adcb
3 changed files with 11 additions and 14 deletions

View File

@ -50,7 +50,7 @@ public abstract class FCommand extends MCommand<P> {
if (this.actionPermission == null || this.fme == null) return false;
if (!this.fme.isAdminBypassing()) {
Access access = myFaction.getAccess(this.fme, this.actionPermission);
if (access == Access.DENY) {
if (access != Access.ALLOW && this.fme.getRole() != Role.ADMIN) {
return false;
}
}
@ -60,7 +60,7 @@ public abstract class FCommand extends MCommand<P> {
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.DENY) {
if (access != Access.ALLOW && this.fme.getRole() != Role.ADMIN) {
return false;
}
}
@ -70,7 +70,7 @@ public abstract class FCommand extends MCommand<P> {
if (this.permission == null || this.fme == null) return false;
if (!this.fme.isAdminBypassing()) {
Access access = myFaction.getAccess(this.fme, perm);
if (access == Access.DENY) {
if (access != Access.ALLOW && this.fme.getRole() != Role.ADMIN) {
return false;
}
}
@ -80,7 +80,7 @@ public abstract class FCommand extends MCommand<P> {
if (this.permission == null || this.fme == null) return false;
if (!this.fme.isAdminBypassing() && checkifAdmin) {
Access access = myFaction.getAccess(this.fme, perm);
if (access == Access.DENY) {
if (access != Access.ALLOW && this.fme.getRole() != Role.ADMIN) {
return false;
}
}

View File

@ -75,15 +75,13 @@ 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);
// We don't want other factions to break blocks unless allowed
if (access == Access.DENY || (access != Access.ALLOW && fme.getFaction() != faction)) {
if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) {
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "mine spawners");
return;
}
@ -383,7 +381,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.DENY || (access != Access.ALLOW && me.getFaction() != otherFaction)) {
if (access != Access.ALLOW && me.getRole() != Role.ADMIN) {
// TODO: Update this once new access values are added other than just allow / deny.
if (access == Access.DENY) {
me.msg(TL.GENERIC_NOPERMISSION, action);

View File

@ -311,11 +311,11 @@ public class FactionsPlayerListener implements Listener {
}
Access access = otherFaction.getAccess(me, action);
if (access == Access.DENY || (access != Access.ALLOW && me.getFaction() != otherFaction)) {
if (access != Access.ALLOW && me.getRole() != Role.ADMIN) {
// TODO: Update this once new access values are added other than just allow / deny.
if ((myFaction.getOwnerListString(loc) != null && !myFaction.getOwnerListString(loc).isEmpty() && myFaction.isPlayerInOwnerList(me, loc))) {
if ((myFaction.getOwnerListString(loc) != null && !myFaction.getOwnerListString(loc).isEmpty() && myFaction.getOwnerListString(loc).contains(player.getName()))) {
return true;
} else if (myFaction.getOwnerListString(loc) != null && !myFaction.getOwnerListString(loc).isEmpty() && !myFaction.isPlayerInOwnerList(me, loc)) {
} else if (myFaction.getOwnerListString(loc) != null && !myFaction.getOwnerListString(loc).isEmpty() && !myFaction.getOwnerListString(loc).contains(player.getName())) {
me.msg("<b>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,7 +532,6 @@ 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);