2011-10-09 21:57:43 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
2011-07-25 20:16:14 +02:00
|
|
|
|
|
|
|
import com.massivecraft.factions.Conf;
|
|
|
|
import com.massivecraft.factions.FPlayer;
|
2011-10-09 18:35:39 +02:00
|
|
|
import com.massivecraft.factions.struct.Permission;
|
2011-07-25 20:16:14 +02:00
|
|
|
|
2014-04-04 20:55:21 +02:00
|
|
|
public class CmdPower extends FCommand {
|
|
|
|
|
|
|
|
public CmdPower() {
|
|
|
|
super();
|
|
|
|
this.aliases.add("power");
|
|
|
|
this.aliases.add("pow");
|
|
|
|
|
|
|
|
//this.requiredArgs.add("faction tag");
|
|
|
|
this.optionalArgs.put("player name", "you");
|
|
|
|
|
|
|
|
this.permission = Permission.POWER.node;
|
|
|
|
this.disableOnLock = false;
|
|
|
|
|
|
|
|
senderMustBePlayer = false;
|
|
|
|
senderMustBeMember = false;
|
|
|
|
senderMustBeModerator = false;
|
|
|
|
senderMustBeAdmin = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void perform() {
|
|
|
|
FPlayer target = this.argAsBestFPlayerMatch(0, fme);
|
2014-07-01 21:49:42 +02:00
|
|
|
if (target == null) { return; }
|
2014-04-04 20:55:21 +02:00
|
|
|
|
2014-07-01 21:49:42 +02:00
|
|
|
if (target != fme && !Permission.POWER_ANY.has(sender, true)) { return; }
|
2014-04-04 20:55:21 +02:00
|
|
|
|
|
|
|
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
2014-07-01 21:49:42 +02:00
|
|
|
if (!payForCommand(Conf.econCostPower, "to show player power info", "for showing player power info")) {
|
|
|
|
return;
|
|
|
|
}
|
2014-04-04 20:55:21 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2011-07-25 20:16:14 +02:00
|
|
|
}
|