Factions/src/com/massivecraft/factions/cmd/CmdPower.java
Brettflan 9a6c15edd1 New command /f powerboost <p|f|player|faction> <name> <#>, which will apply a permanent power bonus/penalty to a specified player or faction. When applied to a player, it will affect their max power and min power. When applied to a faction, it will be applied to current and max power levels. Whether it is a bonus or a penalty depends on whether the number you specify is positive or negative.
New permission factions.powerboost which is required to use the above command. This permission is added to the factions.kit.mod permission kit.

example usage:
/f powerboost p Player1 1.5  (give player "Player1" a bonus of 1.5 power)
/f powerboost faction SomeFaction -6  (give faction "SomeFaction" a penalty of -6 power)
2012-01-28 11:56:51 -06:00

45 lines
1.3 KiB
Java

package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.struct.Permission;
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", "you");
this.permission = Permission.POWER.node;
this.disableOnLock = false;
senderMustBePlayer = false;
senderMustBeMember = false;
senderMustBeOfficer = false;
senderMustBeLeader = false;
}
@Override
public void perform()
{
FPlayer target = this.argAsBestFPlayerMatch(0, fme);
if (target == null) return;
if (target != me && ! 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, "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);
}
}