Factions/src/com/massivecraft/factions/cmd/CmdFactionsPower.java
2013-04-12 08:56:26 +02:00

44 lines
1.3 KiB
Java

package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Perm;
public class CmdFactionsPower extends FCommand
{
public CmdFactionsPower()
{
super();
this.aliases.add("power");
this.aliases.add("pow");
//this.requiredArgs.add("faction tag");
this.optionalArgs.put("player", "you");
this.permission = Perm.POWER.node;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeOfficer = false;
senderMustBeLeader = false;
}
@Override
public void perform()
{
FPlayer target = this.argAsBestFPlayerMatch(0, fme);
if (target == null) return;
if (target != fme && ! Perm.POWER_ANY.has(sender, true)) return;
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
if ( ! payForCommand(ConfServer.econCostPower, "to show player power info", "for showing player power info")) return;
double powerBoost = target.getPowerBoost();
String boost = (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? " (bonus: " : " (penalty: ") + powerBoost + ")";
msg("%s<a> - Power / Maxpower: <i>%d / %d %s", target.describeTo(fme, true), target.getPowerRounded(), target.getPowerMaxRounded(), boost);
}
}