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;
|
2014-12-08 00:12:52 +01:00
|
|
|
import com.massivecraft.factions.zcore.util.TL;
|
2011-07-25 20:16:14 +02:00
|
|
|
|
2014-04-04 20:55:21 +02:00
|
|
|
public class CmdPower extends FCommand {
|
|
|
|
|
2019-08-24 19:18:50 +02:00
|
|
|
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;
|
|
|
|
senderMustBeColeader = false;
|
|
|
|
senderMustBeAdmin = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void perform() {
|
|
|
|
FPlayer target = this.argAsBestFPlayerMatch(0, fme);
|
|
|
|
if (target == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (target != fme && !Permission.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(Conf.econCostPower, TL.COMMAND_POWER_TOSHOW, TL.COMMAND_POWER_FORSHOW)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
double powerBoost = target.getPowerBoost();
|
|
|
|
String boost = (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? TL.COMMAND_POWER_BONUS.toString() : TL.COMMAND_POWER_PENALTY.toString()) + powerBoost + ")";
|
|
|
|
msg(TL.COMMAND_POWER_POWER, target.describeTo(fme, true), target.getPowerRounded(), target.getPowerMaxRounded(), boost);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public TL getUsageTranslation() {
|
|
|
|
return TL.COMMAND_POWER_DESCRIPTION;
|
|
|
|
}
|
2015-01-22 00:58:33 +01:00
|
|
|
|
2011-07-25 20:16:14 +02:00
|
|
|
}
|