Add option to reset powerboost from #572.
Functionality is now /f powerboost p <name> 0 or reset to set the powerboost to 0 for that player or faction.
This commit is contained in:
parent
bc2d7c35f6
commit
1cf2158021
@ -14,7 +14,7 @@ public class CmdPowerBoost extends FCommand {
|
|||||||
|
|
||||||
this.requiredArgs.add("p|f|player|faction");
|
this.requiredArgs.add("p|f|player|faction");
|
||||||
this.requiredArgs.add("name");
|
this.requiredArgs.add("name");
|
||||||
this.requiredArgs.add("#");
|
this.requiredArgs.add("# or reset");
|
||||||
|
|
||||||
this.permission = Permission.POWERBOOST.node;
|
this.permission = Permission.POWERBOOST.node;
|
||||||
this.disableOnLock = true;
|
this.disableOnLock = true;
|
||||||
@ -39,9 +39,13 @@ public class CmdPowerBoost extends FCommand {
|
|||||||
|
|
||||||
Double targetPower = this.argAsDouble(2);
|
Double targetPower = this.argAsDouble(2);
|
||||||
if (targetPower == null) {
|
if (targetPower == null) {
|
||||||
|
if (this.argAsString(2).equalsIgnoreCase("reset")) {
|
||||||
|
targetPower = 0D;
|
||||||
|
} else {
|
||||||
msg(TL.COMMAND_POWERBOOST_INVALIDNUM);
|
msg(TL.COMMAND_POWERBOOST_INVALIDNUM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String target;
|
String target;
|
||||||
|
|
||||||
@ -51,7 +55,9 @@ public class CmdPowerBoost extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (targetPower != 0) {
|
||||||
targetPower += targetPlayer.getPowerBoost();
|
targetPower += targetPlayer.getPowerBoost();
|
||||||
|
}
|
||||||
targetPlayer.setPowerBoost(targetPower);
|
targetPlayer.setPowerBoost(targetPower);
|
||||||
target = TL.COMMAND_POWERBOOST_PLAYER.format(targetPlayer.getName());
|
target = TL.COMMAND_POWERBOOST_PLAYER.format(targetPlayer.getName());
|
||||||
} else {
|
} else {
|
||||||
@ -60,7 +66,9 @@ public class CmdPowerBoost extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (targetPower != 0) {
|
||||||
targetPower += targetFaction.getPowerBoost();
|
targetPower += targetFaction.getPowerBoost();
|
||||||
|
}
|
||||||
targetFaction.setPowerBoost(targetPower);
|
targetFaction.setPowerBoost(targetPower);
|
||||||
target = TL.COMMAND_POWERBOOST_FACTION.format(targetFaction.getTag());
|
target = TL.COMMAND_POWERBOOST_FACTION.format(targetFaction.getTag());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user