Factions/src/com/massivecraft/factions/predicate/PredicateCommandSenderFaction.java

45 lines
1.2 KiB
Java
Raw Normal View History

package com.massivecraft.factions.predicate;
2013-04-22 09:37:53 +02:00
import com.massivecraft.factions.entity.Faction;
2017-03-24 13:05:58 +01:00
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.predicate.Predicate;
2015-05-16 12:19:36 +02:00
import com.massivecraft.massivecore.util.MUtil;
2017-03-24 13:05:58 +01:00
import org.bukkit.command.CommandSender;
import java.io.Serializable;
public class PredicateCommandSenderFaction implements Predicate<CommandSender>, Serializable
{
private static final long serialVersionUID = 1L;
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private final String factionId;
public String getFactionId() { return this.factionId; }
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public PredicateCommandSenderFaction(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());
}
2016-07-30 12:15:24 +02:00
}