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.optionalArgs.put("player name", "you");
|
|
|
|
|
2019-09-14 21:13:01 +02:00
|
|
|
this.requirements = new CommandRequirements.Builder(Permission.POWER)
|
|
|
|
.build();
|
2019-08-24 19:18:50 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-09-14 21:13:01 +02:00
|
|
|
public void perform(CommandContext context) {
|
|
|
|
FPlayer target = context.argAsBestFPlayerMatch(0, context.fPlayer);
|
2019-08-24 19:18:50 +02:00
|
|
|
if (target == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-09-14 21:13:01 +02:00
|
|
|
if (target != context.fPlayer && !Permission.POWER_ANY.has(context.sender, true)) {
|
2019-08-24 19:18:50 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
2019-09-14 21:13:01 +02:00
|
|
|
if (!context.payForCommand(Conf.econCostPower, TL.COMMAND_POWER_TOSHOW, TL.COMMAND_POWER_FORSHOW)) {
|
2019-08-24 19:18:50 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
double powerBoost = target.getPowerBoost();
|
|
|
|
String boost = (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? TL.COMMAND_POWER_BONUS.toString() : TL.COMMAND_POWER_PENALTY.toString()) + powerBoost + ")";
|
2019-09-14 21:13:01 +02:00
|
|
|
context.msg(TL.COMMAND_POWER_POWER, target.describeTo(context.fPlayer, true), target.getPowerRounded(), target.getPowerMaxRounded(), boost);
|
2019-08-24 19:18:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@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
|
|
|
}
|