package com.massivecraft.factions.cmd.req; import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.massivecore.command.MassiveCommand; import com.massivecraft.massivecore.command.requirement.RequirementAbstract; import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.Txt; import org.bukkit.command.CommandSender; public class ReqHasntFaction extends RequirementAbstract { // -------------------------------------------- // // SERIALIZABLE // -------------------------------------------- // private static final long serialVersionUID = 1L; // -------------------------------------------- // // INSTANCE & CONSTRUCT // -------------------------------------------- // private static ReqHasntFaction i = new ReqHasntFaction(); public static ReqHasntFaction get() { return i; } // -------------------------------------------- // // OVERRIDE // -------------------------------------------- // @Override public boolean apply(CommandSender sender, MassiveCommand command) { if (MUtil.isntSender(sender)) return true; MPlayer mplayer = MPlayer.get(sender); return !mplayer.hasFaction(); } @Override public String createErrorMessage(CommandSender sender, MassiveCommand command) { return Txt.parse("<b>You must leave your current faction before you %s.", getDesc(command)); } }