mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-23 18:55:25 +01:00
Adding a ReqRoleIsAtLeast for future use.
This commit is contained in:
parent
01585801b9
commit
828c149cb0
49
src/com/massivecraft/factions/cmd/req/ReqRoleIsAtLeast.java
Normal file
49
src/com/massivecraft/factions/cmd/req/ReqRoleIsAtLeast.java
Normal file
@ -0,0 +1,49 @@
|
||||
package com.massivecraft.factions.cmd.req;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayerColl;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.mcore.cmd.MCommand;
|
||||
import com.massivecraft.mcore.cmd.req.ReqAbstract;
|
||||
import com.massivecraft.mcore.util.SenderUtil;
|
||||
import com.massivecraft.mcore.util.Txt;
|
||||
|
||||
public class ReqRoleIsAtLeast extends ReqAbstract
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
private final Rel rel;
|
||||
public Rel getRel() { return this.rel; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public static ReqRoleIsAtLeast get(Rel rel) { return new ReqRoleIsAtLeast(rel); }
|
||||
private ReqRoleIsAtLeast(Rel rel) { this.rel = rel; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public boolean apply(CommandSender sender, MCommand command)
|
||||
{
|
||||
|
||||
FPlayer fplayer = FPlayerColl.i.get(SenderUtil.getSenderId(sender));
|
||||
return fplayer.getRole().isAtLeast(this.rel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createErrorMessage(CommandSender sender, MCommand command)
|
||||
{
|
||||
return Txt.parse("<b>You must be <h>%s <b>or higher to do this.", Txt.getNicedEnum(this.rel));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user