From baea59a1cd22a9427c388e870117a20556885279 Mon Sep 17 00:00:00 2001 From: Trent Hensler Date: Sat, 3 Feb 2018 12:56:16 -0800 Subject: [PATCH] F perm for invite and sethome --- .../com/massivecraft/factions/cmd/CmdInvite.java | 11 ++++++++++- .../com/massivecraft/factions/cmd/CmdSethome.java | 13 +++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java b/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java index f9051002..a1e42e21 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdInvite.java @@ -3,6 +3,9 @@ package com.massivecraft.factions.cmd; import com.massivecraft.factions.Conf; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.struct.Permission; +import com.massivecraft.factions.struct.Role; +import com.massivecraft.factions.zcore.fperms.Access; +import com.massivecraft.factions.zcore.fperms.PermissableAction; import com.massivecraft.factions.zcore.util.TL; import mkremins.fanciful.FancyMessage; import org.bukkit.ChatColor; @@ -22,7 +25,7 @@ public class CmdInvite extends FCommand { senderMustBePlayer = true; senderMustBeMember = false; - senderMustBeModerator = true; + senderMustBeModerator = false; senderMustBeAdmin = false; } @@ -44,6 +47,12 @@ public class CmdInvite extends FCommand { return; } + Access access = myFaction.getAccess(you, PermissableAction.INVITE); + if (access == Access.DENY || (access == Access.UNDEFINED && !assertMinRole(Role.MODERATOR))) { + fme.msg(TL.GENERIC_NOPERMISSION, "invite"); + return; + } + myFaction.invite(you); if (!you.isOnline()) { return; diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java b/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java index 016e0ff1..1f28b6cc 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdSethome.java @@ -6,6 +6,8 @@ import com.massivecraft.factions.FLocation; import com.massivecraft.factions.Faction; import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Role; +import com.massivecraft.factions.zcore.fperms.Access; +import com.massivecraft.factions.zcore.fperms.PermissableAction; import com.massivecraft.factions.zcore.util.TL; public class CmdSethome extends FCommand { @@ -37,9 +39,16 @@ public class CmdSethome extends FCommand { return; } + Access access = faction.getAccess(fme, PermissableAction.SETHOME); + if (access == Access.DENY) { + fme.msg(TL.GENERIC_NOPERMISSION, "sethome"); + return; + } + // Can the player set the home for this faction? - if (faction == myFaction) { - if (!Permission.SETHOME_ANY.has(sender) && !assertMinRole(Role.MODERATOR)) { + // Check for ALLOW access as well before we check for role. + if (faction == myFaction && access != Access.ALLOW) { + if (!Permission.SETHOME_ANY.has(sender) && !(Role.MODERATOR.value > fme.getRole().value)) { return; } } else {