2011-03-22 15:45:41 +01:00
|
|
|
package com.bukkit.mcteam.factions.commands;
|
|
|
|
|
|
|
|
import com.bukkit.mcteam.factions.Conf;
|
|
|
|
import com.bukkit.mcteam.factions.Faction;
|
|
|
|
import com.bukkit.mcteam.factions.struct.Role;
|
|
|
|
|
|
|
|
public class FCommandOpen extends FBaseCommand {
|
|
|
|
|
|
|
|
public FCommandOpen() {
|
2011-03-22 18:48:09 +01:00
|
|
|
aliases.add("open");
|
|
|
|
aliases.add("close");
|
|
|
|
|
2011-03-22 15:45:41 +01:00
|
|
|
helpDescription = "Switch if invitation is required to join";
|
|
|
|
}
|
|
|
|
|
|
|
|
public void perform() {
|
|
|
|
if ( ! assertHasFaction()) {
|
|
|
|
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()) {
|
2011-03-22 15:45:41 +01:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
faction.sendMessage(Conf.colorSystem+"The faction "+myFaction.getTag(faction)+Conf.colorSystem+" is now "+open);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|