Factions3/src/com/massivecraft/factions/FactionEqualsPredictate.java

45 lines
1.2 KiB
Java
Raw Normal View History

package com.massivecraft.factions;
import java.io.Serializable;
import org.bukkit.command.CommandSender;
import com.massivecraft.factions.entity.MPlayer;
2013-04-22 09:37:53 +02:00
import com.massivecraft.factions.entity.Faction;
2014-06-04 14:02:23 +02:00
import com.massivecraft.massivecore.Predictate;
2015-05-16 12:19:36 +02:00
import com.massivecraft.massivecore.util.MUtil;
public class FactionEqualsPredictate implements Predictate<CommandSender>, Serializable
{
private static final long serialVersionUID = 1L;
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private final String factionId;
public String getFactionId() { return this.factionId; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public FactionEqualsPredictate(Faction faction)
{
this.factionId = faction.getId();
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public boolean apply(CommandSender sender)
{
2015-05-16 14:30:49 +02:00
if (MUtil.isntSender(sender)) return false;
2014-09-17 13:29:58 +02:00
MPlayer mplayer = MPlayer.get(sender);
return this.factionId.equals(mplayer.getFactionId());
}
}