Class RepairCommand
java.lang.Object
za.co.wethinkcode.robots.server.commands.Command
za.co.wethinkcode.robots.server.commands.external.ExternalCommand
za.co.wethinkcode.robots.server.commands.external.RepairCommand
The Repair Command restores a robot's shield to their configured maximum.
World configures how long a repair takes (in seconds) via getRepairTime
Shields are repaired to full amount (maxShields) after repair time
It is always the same amount of time regardless of how many hits remain
Shields cannot exceed configured maximum.
Robot cannot move while repairing
-
Constructor Summary
ConstructorsConstructorDescriptionRepairCommand(com.google.gson.JsonObject json) Construct a repair command from incoming Parsed JSONRepairCommand(String robotName) -
Method Summary
Modifier and TypeMethodDescriptioncom.google.gson.JsonObjectModern a modern OO implementation of the execute methodexecuteToString(World world) Each command must implement this method It does the work and returns a resultReturn which client command this command implementsgetUsage()Get the way this command is supposed to be used.protected voidsleepForRepair(int seconds) Methods inherited from class za.co.wethinkcode.robots.server.commands.external.ExternalCommand
getArgsMethods inherited from class za.co.wethinkcode.robots.server.commands.Command
findRobot, getRobotName
-
Constructor Details
-
RepairCommand
-
RepairCommand
public RepairCommand(com.google.gson.JsonObject json) Construct a repair command from incoming Parsed JSON- Parameters:
json- the incoming JSON
-
-
Method Details
-
executeToString
Description copied from class:CommandEach command must implement this method It does the work and returns a result- Specified by:
executeToStringin classCommand
-
execute
Modern a modern OO implementation of the execute method -
getCommandName
Return which client command this command implements- Specified by:
getCommandNamein classExternalCommand- Returns:
- the command this child is
-
getUsage
Get the way this command is supposed to be used.- Specified by:
getUsagein classExternalCommand- Returns:
- the string representation of the usage of this command.
-
sleepForRepair
protected void sleepForRepair(int seconds)
-