Factions/src/com/massivecraft/factions/cmd/CmdFactionsPower.java

40 lines
1.2 KiB
Java
Raw Normal View History

2011-10-09 21:57:43 +02:00
package com.massivecraft.factions.cmd;
2013-04-09 13:15:25 +02:00
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Perm;
2013-04-16 10:11:59 +02:00
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
2013-04-10 13:12:22 +02:00
public class CmdFactionsPower extends FCommand
2011-10-09 18:35:39 +02:00
{
2013-04-10 13:12:22 +02:00
public CmdFactionsPower()
2011-10-09 18:35:39 +02:00
{
super();
2013-04-16 10:11:59 +02:00
this.addAliases("power", "pow");
2011-10-09 18:35:39 +02:00
//this.requiredArgs.add("faction tag");
this.optionalArgs.put("player", "you");
2013-04-16 10:11:59 +02:00
this.addRequirements(ReqHasPerm.get(Perm.POWER.node));
}
@Override
2011-10-09 18:35:39 +02:00
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
2013-04-09 13:15:25 +02:00
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);
}
}