package com.massivecraft.factions.commands; import com.massivecraft.factions.Conf; import com.massivecraft.factions.Faction; import com.massivecraft.factions.Factions; import com.massivecraft.factions.struct.Permission; public class FCommandOpen extends FCommand { public FCommandOpen() { super(); this.aliases.add("open"); //this.requiredArgs.add(""); this.optionalArgs.put("yes/no", "flipp"); this.permission = Permission.COMMAND_OPEN.node; senderMustBePlayer = true; senderMustBeMember = false; senderMustBeModerator = true; senderMustBeAdmin = false; } @Override public void perform() { if( isLocked() ) { sendLockMessage(); return; } // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay if ( ! payForCommand(Conf.econCostOpen)) return; myFaction.setOpen(this.argAsBool(0, ! myFaction.getOpen())); String open = myFaction.getOpen() ? "open" : "closed"; // Inform myFaction.sendMessageParsed("%s changed the faction to ", fme.getNameAndRelevant(myFaction)); for (Faction faction : Factions.i.get()) { if (faction == myFaction) { continue; } faction.sendMessageParsed("The faction %s is now %s", myFaction.getTag(faction), open); } } }