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

49 lines
1.5 KiB
Java
Raw Normal View History

2011-10-22 18:12:15 +02:00
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPlayer;
2014-04-04 20:55:21 +02:00
import com.massivecraft.factions.Faction;
2011-10-22 18:12:15 +02:00
import com.massivecraft.factions.struct.Permission;
2014-04-04 20:55:21 +02:00
public class CmdPermanentPower extends FCommand {
public CmdPermanentPower() {
2014-07-01 22:10:18 +02:00
super();
this.aliases.add("permanentpower");
2014-04-04 20:55:21 +02:00
2014-07-01 22:10:18 +02:00
this.requiredArgs.add("faction");
this.optionalArgs.put("power", "reset");
2014-04-04 20:55:21 +02:00
2014-07-01 22:10:18 +02:00
this.permission = Permission.SET_PERMANENTPOWER.node;
this.disableOnLock = true;
2014-04-04 20:55:21 +02:00
2014-07-01 22:10:18 +02:00
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeModerator = false;
2014-04-04 20:55:21 +02:00
senderMustBeAdmin = false;
}
//TODO: TL
2014-04-04 20:55:21 +02:00
@Override
public void perform() {
2014-07-01 22:10:18 +02:00
Faction targetFaction = this.argAsFaction(0);
if (targetFaction == null) {
return;
}
2014-04-04 20:55:21 +02:00
Integer targetPower = this.argAsInt(1);
targetFaction.setPermanentPower(targetPower);
2014-07-01 22:10:18 +02:00
String change = "removed permanentpower status from";
if (targetFaction.hasPermanentPower()) {
2014-04-04 20:55:21 +02:00
change = "added permanentpower status to";
}
msg("<i>You %s <h>%s<i>.", change, targetFaction.describeTo(fme));
// Inform all players
for (FPlayer fplayer : targetFaction.getFPlayersWhereOnline(true)) {
fplayer.msg((fme == null ? "A server admin" : fme.describeTo(fplayer, true)) + "<i> " + change + " your faction.");
}
}
2011-10-22 18:12:15 +02:00
}