Factions3/src/com/massivecraft/factions/commands/FCommandOpen.java

47 lines
1.0 KiB
Java
Raw Normal View History

2011-07-18 22:06:02 +02:00
package com.massivecraft.factions.commands;
2011-07-18 22:06:02 +02:00
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.struct.Role;
public class FCommandOpen extends FBaseCommand {
public FCommandOpen() {
aliases.add("open");
aliases.add("close");
helpDescription = "Switch if invitation is required to join";
}
@Override
public void perform() {
if ( ! assertHasFaction()) {
return;
}
if( isLocked() ) {
sendLockMessage();
return;
}
if ( ! assertMinRole(Role.MODERATOR)) {
return;
}
Faction myFaction = me.getFaction();
myFaction.setOpen( ! me.getFaction().getOpen());
String open = myFaction.getOpen() ? "open" : "closed";
// Inform
myFaction.sendMessage(me.getNameAndRelevant(myFaction)+Conf.colorSystem+" changed the faction to "+open);
for (Faction faction : Faction.getAll()) {
2011-03-22 17:20:21 +01:00
if (faction == me.getFaction()) {
continue;
}
faction.sendMessage(Conf.colorSystem+"The faction "+myFaction.getTag(faction)+Conf.colorSystem+" is now "+open);
}
}
}