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

45 lines
1.3 KiB
Java
Raw Normal View History

2011-10-09 21:57:43 +02:00
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.Perm;
2011-10-09 20:10:19 +02:00
public class CmdPower extends FCommand
2011-10-09 18:35:39 +02:00
{
2011-10-09 20:10:19 +02:00
public CmdPower()
2011-10-09 18:35:39 +02:00
{
super();
this.aliases.add("power");
this.aliases.add("pow");
2011-10-09 18:35:39 +02:00
//this.requiredArgs.add("faction tag");
this.optionalArgs.put("player", "you");
this.permission = Perm.POWER.node;
2011-10-09 21:57:43 +02:00
this.disableOnLock = false;
2011-10-09 18:35:39 +02:00
senderMustBePlayer = false;
senderMustBeMember = false;
2011-10-23 17:55:53 +02:00
senderMustBeOfficer = false;
senderMustBeLeader = false;
}
@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
2011-10-12 18:48:47 +02:00
if ( ! payForCommand(Conf.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);
}
}