Saber-Factions/src/main/java/com/massivecraft/factions/cmd/CmdPermanent.java

45 lines
1.7 KiB
Java
Raw Normal View History

2011-10-09 21:57:43 +02:00
package com.massivecraft.factions.cmd;
2014-04-04 20:55:21 +02:00
import com.massivecraft.factions.FPlayer;
2011-10-09 18:35:39 +02:00
import com.massivecraft.factions.FPlayers;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.P;
2011-10-09 18:35:39 +02:00
import com.massivecraft.factions.struct.Permission;
2014-04-04 20:55:21 +02:00
public class CmdPermanent extends FCommand {
public CmdPermanent() {
2014-07-01 21:52:40 +02:00
super(); this.aliases.add("permanent");
2014-04-04 20:55:21 +02:00
this.requiredArgs.add("faction tag");
//this.optionalArgs.put("", "");
2014-07-01 21:52:40 +02:00
this.permission = Permission.SET_PERMANENT.node; this.disableOnLock = true;
2014-04-04 20:55:21 +02:00
2014-07-01 21:52:40 +02:00
senderMustBePlayer = false; senderMustBeMember = false; senderMustBeModerator = false;
2014-04-04 20:55:21 +02:00
senderMustBeAdmin = false;
}
@Override
public void perform() {
2014-07-01 21:52:40 +02:00
Faction faction = this.argAsFaction(0); if (faction == null) { return; }
2014-04-04 20:55:21 +02:00
2014-07-01 21:52:40 +02:00
String change; if (faction.isPermanent()) {
change = "removed permanent status from"; faction.setPermanent(false);
} else {
change = "added permanent status to"; faction.setPermanent(true);
2014-04-04 20:55:21 +02:00
}
P.p.log((fme == null ? "A server admin" : fme.getName()) + " " + change + " the faction \"" + faction.getTag() + "\".");
// Inform all players
for (FPlayer fplayer : FPlayers.i.getOnline()) {
if (fplayer.getFaction() == faction) {
fplayer.msg((fme == null ? "A server admin" : fme.describeTo(fplayer, true)) + "<i> " + change + " your faction.");
2014-07-01 21:52:40 +02:00
} else {
2014-04-04 20:55:21 +02:00
fplayer.msg((fme == null ? "A server admin" : fme.describeTo(fplayer, true)) + "<i> " + change + " the faction \"" + faction.getTag(fplayer) + "\".");
}
}
}
}