Rethinking power calculation some.
This commit is contained in:
@@ -31,7 +31,6 @@ public class CmdFactions extends FCommand
|
||||
public CmdFactionsMoney cmdFactionsMoney = new CmdFactionsMoney();
|
||||
public CmdFactionsOpen cmdFactionsOpen = new CmdFactionsOpen();
|
||||
public CmdFactionsPerm cmdFactionsPerm = new CmdFactionsPerm();
|
||||
public CmdFactionsPower cmdFactionsPower = new CmdFactionsPower();
|
||||
public CmdFactionsPowerBoost cmdFactionsPowerBoost = new CmdFactionsPowerBoost();
|
||||
public CmdFactionsPromote cmdFactionsPromote = new CmdFactionsPromote();
|
||||
public CmdFactionsRelationAlly cmdFactionsRelationAlly = new CmdFactionsRelationAlly();
|
||||
@@ -62,7 +61,6 @@ public class CmdFactions extends FCommand
|
||||
this.addSubCommand(HelpCommand.get());
|
||||
this.addSubCommand(this.cmdFactionsList);
|
||||
this.addSubCommand(this.cmdFactionsShow);
|
||||
this.addSubCommand(this.cmdFactionsPower);
|
||||
this.addSubCommand(this.cmdFactionsJoin);
|
||||
this.addSubCommand(this.cmdFactionsLeave);
|
||||
this.addSubCommand(this.cmdFactionsHome);
|
||||
|
@@ -1,33 +0,0 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
|
||||
public class CmdFactionsPower extends FCommand
|
||||
{
|
||||
|
||||
public CmdFactionsPower()
|
||||
{
|
||||
this.addAliases("power", "pow");
|
||||
|
||||
this.addOptionalArg("player", "you");
|
||||
|
||||
this.addRequirements(ReqHasPerm.get(Perm.POWER.node));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
UPlayer target = this.arg(0, ARUPlayer.getStartAny(fme), fme);
|
||||
if (target == null) return;
|
||||
|
||||
if (target != fme && ! Perm.POWER_ANY.has(sender, true)) 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);
|
||||
}
|
||||
|
||||
}
|
@@ -2,9 +2,7 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARUPlayer;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.mcore.cmd.arg.ARDouble;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
@@ -15,9 +13,8 @@ public class CmdFactionsPowerBoost extends FCommand
|
||||
{
|
||||
this.addAliases("powerboost");
|
||||
|
||||
this.addRequiredArg("p|f|player|faction");
|
||||
this.addRequiredArg("name");
|
||||
this.addRequiredArg("#");
|
||||
this.addRequiredArg("faction");
|
||||
this.addRequiredArg("amount");
|
||||
|
||||
this.addRequirements(ReqHasPerm.get(Perm.POWERBOOST.node));
|
||||
}
|
||||
@@ -25,42 +22,17 @@ public class CmdFactionsPowerBoost extends FCommand
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
String type = this.arg(0).toLowerCase();
|
||||
boolean doPlayer = true;
|
||||
if (type.equals("f") || type.equals("faction"))
|
||||
{
|
||||
doPlayer = false;
|
||||
}
|
||||
else if (!type.equals("p") && !type.equals("player"))
|
||||
{
|
||||
msg("<b>You must specify \"p\" or \"player\" to target a player or \"f\" or \"faction\" to target a faction.");
|
||||
msg("<b>ex. /f powerboost p SomePlayer 0.5 -or- /f powerboost f SomeFaction -5");
|
||||
return;
|
||||
}
|
||||
Faction faction = this.arg(0, ARFaction.get(fme));
|
||||
if (faction == null) return;
|
||||
|
||||
Double targetPower = this.arg(2, ARDouble.get());
|
||||
if (targetPower == null) return;
|
||||
Double amount = this.arg(1, ARDouble.get());
|
||||
if (amount == null) return;
|
||||
|
||||
String target;
|
||||
|
||||
if (doPlayer)
|
||||
{
|
||||
UPlayer targetPlayer = this.arg(1, ARUPlayer.getStartAny(sender));
|
||||
if (targetPlayer == null) return;
|
||||
|
||||
targetPlayer.setPowerBoost(targetPower);
|
||||
target = "Player \""+targetPlayer.getName()+"\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
Faction targetFaction = this.arg(1, ARFaction.get(sender));
|
||||
if (targetFaction == null) return;
|
||||
|
||||
targetFaction.setPowerBoost(targetPower);
|
||||
target = "Faction \""+targetFaction.getTag()+"\"";
|
||||
}
|
||||
|
||||
msg("<i>"+target+" now has a power bonus/penalty of "+targetPower+" to min and max power levels.");
|
||||
Factions.get().log(fme.getName()+" has set the power bonus/penalty for "+target+" to "+targetPower+".");
|
||||
faction.setPowerBoost(amount);
|
||||
|
||||
msg("<i>"+faction.getTag()+" now has a power bonus/penalty of "+amount+" to min and max power levels.");
|
||||
|
||||
// TODO: Inconsistent. Why is there no boolean to toggle this logging of?
|
||||
Factions.get().log(fme.getName()+" has set the power bonus/penalty for "+faction.getTag()+" to "+amount+".");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user