2018-04-18 03:01:53 +02:00
|
|
|
package com.massivecraft.factions.cmd;
|
|
|
|
|
|
|
|
import com.massivecraft.factions.Conf;
|
|
|
|
import com.massivecraft.factions.FPlayer;
|
2019-09-14 21:13:01 +02:00
|
|
|
import com.massivecraft.factions.struct.Permission;
|
2018-04-18 03:01:53 +02:00
|
|
|
import com.massivecraft.factions.zcore.util.TL;
|
|
|
|
|
|
|
|
public class CmdLowPower extends FCommand {
|
|
|
|
|
2019-12-02 19:55:38 +01:00
|
|
|
/**
|
|
|
|
* @author Illyria Team
|
|
|
|
*/
|
|
|
|
|
2019-09-15 11:19:06 +02:00
|
|
|
public CmdLowPower() {
|
|
|
|
super();
|
2020-01-02 02:59:31 +01:00
|
|
|
this.aliases.addAll(Aliases.lowPower);
|
2019-09-15 11:19:06 +02:00
|
|
|
|
|
|
|
this.requirements = new CommandRequirements.Builder(Permission.POWER_ANY)
|
|
|
|
.playerOnly()
|
|
|
|
.memberOnly()
|
|
|
|
.build();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void perform(CommandContext context) {
|
|
|
|
double maxPower = Conf.powerPlayerMax;
|
|
|
|
String format = TL.COMMAND_LOWPOWER_FORMAT.toString();
|
|
|
|
context.msg(TL.COMMAND_LOWPOWER_HEADER.toString().replace("{maxpower}", (int) maxPower + ""));
|
|
|
|
for (FPlayer fPlayer : context.faction.getFPlayers()) {
|
|
|
|
if (fPlayer.getPower() < maxPower) {
|
|
|
|
context.sendMessage(format.replace("{player}", fPlayer.getName()).replace("{player_power}", (int) fPlayer.getPower() + "").replace("{maxpower}", (int) maxPower + ""));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public TL getUsageTranslation() {
|
|
|
|
return TL.COMMAND_LOWPOWER_DESCRIPTION;
|
|
|
|
}
|
2018-04-18 03:01:53 +02:00
|
|
|
|
|
|
|
|
2019-09-14 21:13:01 +02:00
|
|
|
}
|