diff --git a/classes/artifacts/Factions_jar/Factions.jar b/classes/artifacts/Factions_jar/Factions.jar deleted file mode 100644 index 1487877f..00000000 Binary files a/classes/artifacts/Factions_jar/Factions.jar and /dev/null differ diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdBan.java b/src/main/java/com/massivecraft/factions/cmd/CmdBan.java index 15a78cd5..c899812d 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdBan.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdBan.java @@ -34,12 +34,16 @@ public CmdBan() { @Override public void perform() { - // Simplified for clarity - if (!this.hasAccess(PermissableAction.BAN)) { - fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage bans"); - return; + // Adds bypass to admins and clean permission check + if (!fme.isAdminBypassing()) { + Access access = myFaction.getAccess(fme, PermissableAction.BAN); + if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) { + fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "ban"); + return; + } } + // Good on permission checks. Now lets just ban the player. FPlayer target = argAsFPlayer(0); if (target == null) { diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdBanlist.java b/src/main/java/com/massivecraft/factions/cmd/CmdBanlist.java index 0e1cacb3..42d8c7e5 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdBanlist.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdBanlist.java @@ -6,7 +6,6 @@ import com.massivecraft.factions.Factions; import com.massivecraft.factions.struct.BanInfo; import com.massivecraft.factions.struct.Permission; -import com.massivecraft.factions.zcore.fperms.PermissableAction; import com.massivecraft.factions.zcore.util.TL; import java.util.ArrayList; @@ -33,10 +32,6 @@ public CmdBanlist() { @Override public void perform() { - if (!this.hasAccess(PermissableAction.BAN)) { - fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage bans"); - return; - } Faction target = myFaction; if (!args.isEmpty()) { target = argAsFaction(0); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdChest.java b/src/main/java/com/massivecraft/factions/cmd/CmdChest.java index b0bd3d00..52fa12c5 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdChest.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdChest.java @@ -32,9 +32,12 @@ public void perform() { return; } // This permission check is way too explicit but it's clean - if (!this.hasAccess(PermissableAction.CHEST)) { - fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "access chest"); - return; + if (!fme.isAdminBypassing()) { + Access access = myFaction.getAccess(fme, PermissableAction.CHEST); + if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) { + fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "access chest"); + return; + } } me.openInventory(fme.getFaction().getChest()); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdClaim.java b/src/main/java/com/massivecraft/factions/cmd/CmdClaim.java index bbdcecd5..fe605796 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdClaim.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdClaim.java @@ -37,9 +37,12 @@ public void perform() { int radius = this.argAsInt(0, 1); // Default to 1 final Faction forFaction = this.argAsFaction(1, myFaction); // Default to own - if (!this.hasAccess(PermissableAction.TERRITORY)) { - fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "change faction territory"); - return; + if (!fme.isAdminBypassing()) { + Access access = myFaction.getAccess(fme, PermissableAction.TERRITORY); + if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) { + fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "change faction territory"); + return; + } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java b/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java index a0412777..540140f0 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdDeinvite.java @@ -34,9 +34,12 @@ public CmdDeinvite() { @Override public void perform() { FPlayer you = this.argAsBestFPlayerMatch(0); - if (!this.hasAccess(PermissableAction.INVITE)) { - fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites"); - return; + if (!fme.isAdminBypassing()) { + Access access = myFaction.getAccess(fme, PermissableAction.INVITE); + if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) { + fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites"); + return; + } } if (you == null) { FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDelFWarp.java b/src/main/java/com/massivecraft/factions/cmd/CmdDelFWarp.java index cb3cefc7..00583e25 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdDelFWarp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdDelFWarp.java @@ -3,7 +3,6 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; -import com.massivecraft.factions.zcore.fperms.PermissableAction; import com.massivecraft.factions.zcore.util.TL; public class CmdDelFWarp extends FCommand { @@ -23,10 +22,6 @@ public CmdDelFWarp() { @Override public void perform() { String warp = argAsString(0); - if (!this.hasAccess(PermissableAction.WARP)){ - fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage warps"); - return; - } if (myFaction.isWarp(warp)) { if (!transact(fme)) { return; diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java b/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java index 4a18fb13..90177f22 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdDisband.java @@ -45,6 +45,13 @@ public void perform() { boolean isMyFaction = fme != null && faction == myFaction; + if (!fme.isAdminBypassing()) { + Access access = myFaction.getAccess(fme, PermissableAction.DISBAND); + if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) { + fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "disband faction"); + return; + } + } if (!faction.isNormal()) { msg(TL.COMMAND_DISBAND_IMMUTABLE.toString()); return; @@ -53,10 +60,6 @@ public void perform() { msg(TL.COMMAND_DISBAND_MARKEDPERMANENT.toString()); return; } - if (!this.hasAccess(PermissableAction.DISBAND)) { - fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "disband faction"); - return; - } // check for tnt before disbanding. diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFWarp.java b/src/main/java/com/massivecraft/factions/cmd/CmdFWarp.java index 7f6747f6..95654ab6 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFWarp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFWarp.java @@ -31,9 +31,12 @@ public CmdFWarp() { @Override public void perform() { //TODO: check if in combat. - if (!this.hasAccess(PermissableAction.WARP)) { - fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "use warps"); - return; + if (!fme.isAdminBypassing()) { + Access access = myFaction.getAccess(fme, PermissableAction.WARP); + if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) { + fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "use warps"); + return; + } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdFly.java b/src/main/java/com/massivecraft/factions/cmd/CmdFly.java index 435c78f9..fcaf70ff 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdFly.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdFly.java @@ -36,7 +36,6 @@ public CmdFly() { this.senderMustBeMember = true; this.senderMustBeModerator = false; } - /// I'll optimize this later today or tomorrow public static void startParticles() { id = Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, new Runnable() { diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdGetVault.java b/src/main/java/com/massivecraft/factions/cmd/CmdGetVault.java index ae59080b..5351fcd1 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdGetVault.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdGetVault.java @@ -2,7 +2,6 @@ import com.massivecraft.factions.P; import com.massivecraft.factions.struct.Permission; -import com.massivecraft.factions.zcore.fperms.PermissableAction; import com.massivecraft.factions.zcore.util.TL; import org.bukkit.Location; import org.bukkit.Material; @@ -34,10 +33,7 @@ public void perform() { Location vaultLocation = fme.getFaction().getVault(); ItemStack vault = P.p.createItem(Material.CHEST, 1, (short) 0, P.p.color(P.p.getConfig().getString("fvault.Item.Name")), P.p.colorList(P.p.getConfig().getStringList("fvault.Item.Lore"))); - if (!this.hasAccess(PermissableAction.VAULT)) { - fme.msg(TL.GENERIC_NOPERMISSION, "use vault"); - return; - } + //check if vault is set if (vaultLocation != null) { fme.msg(TL.COMMAND_GETVAULT_ALREADYSET); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdHome.java b/src/main/java/com/massivecraft/factions/cmd/CmdHome.java index 7155b2f0..04026809 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdHome.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdHome.java @@ -49,9 +49,12 @@ public void perform() { fme.msg(TL.COMMAND_HOME_TELEPORTDISABLED); return; } - if (!this.hasAccess(PermissableAction.HOME)) { - fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "teleport home"); - return; + if (!fme.isAdminBypassing()) { + Access access = myFaction.getAccess(fme, PermissableAction.HOME); + if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) { + fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "teleport home"); + return; + } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdInspect.java b/src/main/java/com/massivecraft/factions/cmd/CmdInspect.java index b4e37355..6b2af666 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdInspect.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdInspect.java @@ -22,7 +22,6 @@ public CmdInspect() { @Override public void perform() { - // Who can inspect? if (fme.isInspectMode()) { fme.setInspectMode(false); msg(TL.COMMAND_INSPECT_DISABLED_MSG); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java b/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java index 77198a4c..3e913c51 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java @@ -48,9 +48,12 @@ public void perform() { return; } - if (!this.hasAccess(PermissableAction.INVITE)) { - fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites"); - return; + if (!fme.isAdminBypassing()) { + Access access = myFaction.getAccess(fme, PermissableAction.INVITE); + if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) { + fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites"); + return; + } } if (myFaction.isInvited(target)) { diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdKick.java b/src/main/java/com/massivecraft/factions/cmd/CmdKick.java index 9da586d4..13934a30 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdKick.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdKick.java @@ -79,7 +79,8 @@ public void perform() { // - Make sure the player is in the faction. // - Make sure the kicked player has lower rank than the kicker. if (!fme.isAdminBypassing()) { - if (!this.hasAccess(PermissableAction.KICK, false)) { + Access access = myFaction.getAccess(fme, PermissableAction.KICK); + if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) { fme.msg(TL.GENERIC_NOPERMISSION, "kick"); return; } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdLogins.java b/src/main/java/com/massivecraft/factions/cmd/CmdLogins.java index 3d8d162b..08900c48 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdLogins.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdLogins.java @@ -1,7 +1,6 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.struct.Permission; -import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.zcore.util.TL; public class CmdLogins extends FCommand { @@ -19,11 +18,6 @@ public CmdLogins() { @Override public void perform() { - /// Perhaps add a PermissableAction later? - if (!fme.getRole().isAtLeast(Role.MODERATOR)) { - fme.msg(TL.GENERIC_NOPERMISSION, "monitor joins"); - return; - } boolean monitor = fme.isMonitoringJoins(); fme.msg(TL.COMMAND_LOGINS_TOGGLE, String.valueOf(!monitor)); fme.setMonitorJoins(!monitor); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSetFWarp.java b/src/main/java/com/massivecraft/factions/cmd/CmdSetFWarp.java index debe3bc2..c0984d4e 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSetFWarp.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSetFWarp.java @@ -37,9 +37,12 @@ public void perform() { // This statement allows us to check if they've specifically denied it, or default to // the old setting of allowing moderators to set warps. - if (!this.hasAccess(PermissableAction.SETWARP)) { - fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "set warps"); - return; + if (!fme.isAdminBypassing()) { + Access access = myFaction.getAccess(fme, PermissableAction.SETWARP); + if (access != Access.ALLOW && fme.getRole() != Role.ADMIN) { + fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "set warps"); + return; + } } diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java b/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java index 94361748..6ad7ecfb 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java @@ -40,9 +40,12 @@ public void perform() { return; } - if (!this.hasAccess(PermissableAction.SETHOME) && !Permission.SETHOME_ANY.has(sender, true)) { - fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "set home"); - return; + if (!fme.isAdminBypassing()) { + Access access = myFaction.getAccess(fme, PermissableAction.SETHOME); + if (access != Access.ALLOW && fme.getRole() != Role.ADMIN && !Permission.SETHOME_ANY.has(sender, true)) { + fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "set home"); + return; + } } // Can the player set the faction home HERE? diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdShowClaims.java b/src/main/java/com/massivecraft/factions/cmd/CmdShowClaims.java index 2680ccca..22e47e3a 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdShowClaims.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdShowClaims.java @@ -4,7 +4,6 @@ import com.google.common.collect.ListMultimap; import com.massivecraft.factions.FLocation; import com.massivecraft.factions.struct.Permission; -import com.massivecraft.factions.zcore.fperms.PermissableAction; import com.massivecraft.factions.zcore.util.TL; public class CmdShowClaims extends FCommand { @@ -26,11 +25,6 @@ public CmdShowClaims() { @Override public void perform() { - // #suggestion - if (!this.hasAccess(PermissableAction.TERRITORY)) { - fme.msg(TL.GENERIC_NOPERMISSION, "manage territory"); - return; - } sendMessage(TL.COMMAND_SHOWCLAIMS_HEADER.toString().replace("{faction}", fme.getFaction().describeTo(fme))); ListMultimap chunkMap = ArrayListMultimap.create(); String format = TL.COMMAND_SHOWCLAIMS_CHUNKSFORMAT.toString(); diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdShowInvites.java b/src/main/java/com/massivecraft/factions/cmd/CmdShowInvites.java index 58cff44f..3f8ab4ee 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdShowInvites.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdShowInvites.java @@ -4,7 +4,6 @@ import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.FPlayers; import com.massivecraft.factions.struct.Permission; -import com.massivecraft.factions.zcore.fperms.PermissableAction; import com.massivecraft.factions.zcore.util.TL; import mkremins.fanciful.FancyMessage; import org.bukkit.ChatColor; @@ -22,10 +21,6 @@ public CmdShowInvites() { @Override public void perform() { - if (!this.hasAccess(PermissableAction.INVITE)) { - fme.msg(TL.GENERIC_NOPERMISSION, "manage invites"); - return; - } FancyMessage msg = new FancyMessage(TL.COMMAND_SHOWINVITES_PENDING.toString()).color(ChatColor.GOLD); for (String id : myFaction.getInvites()) { FPlayer fp = FPlayers.getInstance().getById(id); diff --git a/src/main/java/com/massivecraft/factions/cmd/FCommand.java b/src/main/java/com/massivecraft/factions/cmd/FCommand.java index 24942e38..46e41bd3 100644 --- a/src/main/java/com/massivecraft/factions/cmd/FCommand.java +++ b/src/main/java/com/massivecraft/factions/cmd/FCommand.java @@ -5,8 +5,6 @@ import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.util.WarmUpUtil; import com.massivecraft.factions.zcore.MCommand; -import com.massivecraft.factions.zcore.fperms.Access; -import com.massivecraft.factions.zcore.fperms.PermissableAction; import com.massivecraft.factions.zcore.util.TL; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @@ -27,7 +25,6 @@ public abstract class FCommand extends MCommand

{ public boolean senderMustBeModerator; public boolean senderMustBeAdmin; public boolean senderMustBeColeader; - protected PermissableAction actionPermission; public boolean isMoneyCommand; @@ -46,47 +43,6 @@ public FCommand() { senderMustBeAdmin = false; } - public boolean hasAccess() { - if (this.permission == null || this.fme == null) return false; - if (!this.fme.isAdminBypassing()) { - Access access = myFaction.getAccess(this.fme, permission); - if (access != Access.ALLOW && this.fme.getRole() != Role.ADMIN) { - return false; - } - } - return true; - } - public boolean hasAccess(boolean isAdmin) { - if (this.actionPermission == null || this.fme == null) return false; - if (!this.fme.isAdminBypassing() && isAdmin) { - Access access = myFaction.getAccess(this.fme, this.actionPermission); - if (access != Access.ALLOW && this.fme.getRole() != Role.ADMIN) { - return false; - } - } - return true; - } - public boolean hasAccess(PermissableAction perm) { - 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) { - return false; - } - } - return true; - } - public boolean hasAccess(PermissableAction perm, boolean isAdmin) { - if (this.permission == null || this.fme == null) return false; - if (!this.fme.isAdminBypassing() && isAdmin) { - Access access = myFaction.getAccess(this.fme, perm); - if (access != Access.ALLOW && this.fme.getRole() != Role.ADMIN) { - return false; - } - } - return true; - } - @Override public void execute(CommandSender sender, List args, List> commandChain) { if (sender instanceof Player) {