Use FPerm for invite and deinvite as opposed to checking ranks.

This commit is contained in:
Olof Larsson 2013-04-17 10:34:48 +02:00
parent 2689bad8a0
commit 299316a915
4 changed files with 7 additions and 8 deletions

View File

@ -6,6 +6,7 @@ import java.util.HashSet;
import java.util.Set;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
@ -137,7 +138,7 @@ public enum FPerm
RelationParticipator rpSubject = null;
if (testSubject instanceof Player)
if (testSubject instanceof CommandSender)
{
rpSubject = FPlayerColl.get().get(testSubject);
}

View File

@ -102,7 +102,6 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
// The flag overrides are the modifications to the default values
private Map<FFlag, Boolean> flagOverrides;
// FIELDS: Permission <-> Groups management
private Map<FPerm, Set<Rel>> permOverrides; // Contains the modifications to the default values
@ -582,8 +581,6 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
return RelationUtil.getColorOfThatToMe(this, observer);
}
// TODO: Implement a has enough feature.
// -------------------------------------------- //
// POWER

View File

@ -1,5 +1,6 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
@ -18,12 +19,13 @@ public class CmdFactionsDeinvite extends FCommand
this.addRequiredArg("player");
this.addRequirements(ReqHasPerm.get(Perm.DEINVITE.node));
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
}
@Override
public void perform()
{
if ( ! FPerm.INVITE.has(sender, myFaction, true)) return;
FPlayer you = this.arg(0, ARFPlayer.getStartAny());
if (you == null) return;

View File

@ -5,9 +5,7 @@ import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.arg.ARFPlayer;
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
@ -21,12 +19,13 @@ public class CmdFactionsInvite extends FCommand
this.addRequirements(ReqHasPerm.get(Perm.INVITE.node));
this.addRequirements(ReqIsPlayer.get());
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
}
@Override
public void perform()
{
if ( ! FPerm.INVITE.has(sender, myFaction, true)) return;
FPlayer you = this.arg(0, ARFPlayer.getStartAny());
if (you == null) return;