Add set to the jail time command and unit test it.

This commit is contained in:
graywolf336
2015-02-20 23:10:05 -06:00
parent 1c3ad5b75a
commit 88cc080f60
3 changed files with 77 additions and 2 deletions

View File

@ -142,7 +142,7 @@ public class PrisonerManager {
* @param player who is the prisoner
* @param prisoner data containing everything pertaining to them
*/
public void jailPrisoner(Jail jail, Cell cell, Player player, Prisoner prisoner) {
protected void jailPrisoner(Jail jail, Cell cell, Player player, Prisoner prisoner) {
//If they have handcuffs on them, then let's remove them before we continue
//this way the handcuff listeners and this aren't battleing each other
if(pl.getHandCuffManager().isHandCuffed(player.getUniqueId())) {

View File

@ -15,7 +15,7 @@ import com.graywolf336.jail.enums.Lang;
needsPlayer = false,
pattern = "time|t",
permission = "jail.command.jailtime",
usage = "/jail time [add|remove|show] [name] <time>"
usage = "/jail time [add|remove|set|show] [name] <time>"
)
public class JailTimeCommand implements Command {
public boolean execute(JailManager jm, CommandSender sender, String... args) throws Exception {
@ -35,6 +35,8 @@ public class JailTimeCommand implements Command {
p.addTime(Util.getTime(args[3]));
}else if(args[1].equalsIgnoreCase("remove")) {
p.subtractTime(Util.getTime(args[3]));
}else if(args[1].equalsIgnoreCase("set")) {
p.setRemainingTime(Util.getTime(args[3]));
}else {
return false;
}