Factions/src/com/massivecraft/factions/cmd/req/ReqHasFaction.java

46 lines
1.4 KiB
Java
Raw Normal View History

package com.massivecraft.factions.cmd.req;
import org.bukkit.command.CommandSender;
import com.massivecraft.factions.entity.MPlayer;
2015-11-06 02:10:29 +01:00
import com.massivecraft.massivecore.command.MassiveCommand;
import com.massivecraft.massivecore.command.requirement.RequirementAbstract;
2015-05-16 12:19:36 +02:00
import com.massivecraft.massivecore.util.MUtil;
2014-06-04 14:02:23 +02:00
import com.massivecraft.massivecore.util.Txt;
2015-11-06 02:10:29 +01:00
public class ReqHasFaction extends RequirementAbstract
{
2017-03-07 20:28:52 +01:00
// -------------------------------------------- //
// SERIALIZABLE
// -------------------------------------------- //
private static final long serialVersionUID = 1L;
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static ReqHasFaction i = new ReqHasFaction();
public static ReqHasFaction get() { return i; }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
2014-06-04 14:02:23 +02:00
public boolean apply(CommandSender sender, MassiveCommand command)
{
2015-05-16 14:30:49 +02:00
if (MUtil.isntSender(sender)) return false;
2015-05-16 12:19:36 +02:00
MPlayer mplayer = MPlayer.get(sender);
return mplayer.hasFaction();
}
@Override
2014-06-04 14:02:23 +02:00
public String createErrorMessage(CommandSender sender, MassiveCommand command)
{
2017-03-07 20:28:52 +01:00
return Txt.parse("<b>You must belong to a faction to %s.", getDesc(command));
}
}