diff --git a/src/main/java/com/graywolf336/jail/beans/Prisoner.java b/src/main/java/com/graywolf336/jail/beans/Prisoner.java index 9b48aac..90f6396 100644 --- a/src/main/java/com/graywolf336/jail/beans/Prisoner.java +++ b/src/main/java/com/graywolf336/jail/beans/Prisoner.java @@ -11,7 +11,7 @@ import org.bukkit.Location; * * @author graywolf336 * @since 2.x.x - * @version 3.0.0 + * @version 3.0.1 */ public class Prisoner { private String name, jailer, reason, inventory, armor; @@ -108,9 +108,22 @@ public class Prisoner { * Adds the given time to the remaining time the prisoner has left. * * @param time to add to the prisoner's remaining time. + * @return the new remaining time the prisoner has */ - public void addTime(long time) { + public long addTime(long time) { this.time += time; + return this.time; + } + + /** + * Subtracts the given time from the remaining time the prisoner has left. + * + * @param time to subtract from the prisoner's remaining time. + * @return the new remaining time the prisoner has + */ + public long subtractTime(long time) { + this.time -= time; + return this.time; } /** Gets whether the player is offline or not. */ diff --git a/src/main/java/com/graywolf336/jail/command/JailHandler.java b/src/main/java/com/graywolf336/jail/command/JailHandler.java index 7fb0f0b..52f63e8 100644 --- a/src/main/java/com/graywolf336/jail/command/JailHandler.java +++ b/src/main/java/com/graywolf336/jail/command/JailHandler.java @@ -29,6 +29,7 @@ import com.graywolf336.jail.command.subcommands.JailStatusCommand; import com.graywolf336.jail.command.subcommands.JailStopCommand; import com.graywolf336.jail.command.subcommands.JailTeleInCommand; import com.graywolf336.jail.command.subcommands.JailTeleOutCommand; +import com.graywolf336.jail.command.subcommands.JailTimeCommand; import com.graywolf336.jail.command.subcommands.JailTransferAllCommand; import com.graywolf336.jail.command.subcommands.JailTransferCommand; import com.graywolf336.jail.command.subcommands.JailVersionCommand; @@ -187,6 +188,7 @@ public class JailHandler { load(JailStopCommand.class); load(JailTeleInCommand.class); load(JailTeleOutCommand.class); + load(JailTimeCommand.class); load(JailTransferAllCommand.class); load(JailTransferCommand.class); load(JailVersionCommand.class); diff --git a/src/main/java/com/graywolf336/jail/command/subcommands/JailTimeCommand.java b/src/main/java/com/graywolf336/jail/command/subcommands/JailTimeCommand.java new file mode 100644 index 0000000..1efae8a --- /dev/null +++ b/src/main/java/com/graywolf336/jail/command/subcommands/JailTimeCommand.java @@ -0,0 +1,55 @@ +package com.graywolf336.jail.command.subcommands; + +import org.bukkit.command.CommandSender; + +import com.graywolf336.jail.JailManager; +import com.graywolf336.jail.Util; +import com.graywolf336.jail.beans.Prisoner; +import com.graywolf336.jail.command.Command; +import com.graywolf336.jail.command.CommandInfo; +import com.graywolf336.jail.enums.LangString; + +@CommandInfo( + maxArgs = 3, + minimumArgs = 2, + needsPlayer = false, + pattern = "time|t", + permission = "jail.command.jailtime", + usage = "/jail time