diff --git a/src/main/java/com/graywolf336/jail/command/JailHandler.java b/src/main/java/com/graywolf336/jail/command/JailHandler.java index 9434e42..59fb9d6 100644 --- a/src/main/java/com/graywolf336/jail/command/JailHandler.java +++ b/src/main/java/com/graywolf336/jail/command/JailHandler.java @@ -24,6 +24,7 @@ import com.graywolf336.jail.command.subcommands.JailListCommand; import com.graywolf336.jail.command.subcommands.JailMuteCommand; import com.graywolf336.jail.command.subcommands.JailReloadCommand; import com.graywolf336.jail.command.subcommands.JailRemoveCellCommand; +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; @@ -179,6 +180,7 @@ public class JailHandler { load(JailMuteCommand.class); load(JailReloadCommand.class); load(JailRemoveCellCommand.class); + load(JailStatusCommand.class); load(JailStopCommand.class); load(JailTeleInCommand.class); load(JailTeleOutCommand.class); diff --git a/src/main/java/com/graywolf336/jail/command/subcommands/JailStatusCommand.java b/src/main/java/com/graywolf336/jail/command/subcommands/JailStatusCommand.java new file mode 100644 index 0000000..beff3f2 --- /dev/null +++ b/src/main/java/com/graywolf336/jail/command/subcommands/JailStatusCommand.java @@ -0,0 +1,34 @@ +package com.graywolf336.jail.command.subcommands; + +import org.bukkit.command.CommandSender; + +import com.graywolf336.jail.JailManager; +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 = 0, + minimumArgs = 0, + needsPlayer = false, + pattern = "status|time", + permission = "jail.usercmd.jailstatus", + usage = "/jail status" + ) +public class JailStatusCommand implements Command{ + + public boolean execute(JailManager jm, CommandSender sender, String... args) { + if(jm.isPlayerJailed(sender.getName())) { + Prisoner p = jm.getPrisoner(sender.getName()); + //They are jailed, so let's tell them some information + jm.getPlugin().getJailIO().getLanguageString(LangString.STATUS, new String[] { p.getReason(), p.getJailer(), String.valueOf(p.getRemainingTimeInMinutes()) }); + }else { + //the sender of the command is not jailed, tell them that + jm.getPlugin().getJailIO().getLanguageString(LangString.YOUARENOTJAILED); + } + + return true; + } + +} diff --git a/src/main/java/com/graywolf336/jail/enums/LangString.java b/src/main/java/com/graywolf336/jail/enums/LangString.java index 212a214..5b9b427 100644 --- a/src/main/java/com/graywolf336/jail/enums/LangString.java +++ b/src/main/java/com/graywolf336/jail/enums/LangString.java @@ -68,6 +68,8 @@ public enum LangString { PROVIDEAPLAYER ("jailing"), /** The message sent to the sender when they need to provide a jail. */ PROVIDEAJAIL ("jailing"), + /** The message sent when to a prisoner about their status in jail. */ + STATUS ("jailing"), /** The message sent to the sender of a command when suggesting a cell. */ SUGGESTEDCELL ("jailing"), /** The message sent to the sender when they teleport someone to a jail's teleport in location. */ @@ -86,6 +88,8 @@ public enum LangString { UNJAILED ("jailing"), /** The message went when an offline player is unjailed. */ WILLBEUNJAILED ("jailing"), + /** The message sent to the sender when they check their jail status and they aren't jailed. */ + YOUARENOTJAILED ("jailing"), //Handcuffing section diff --git a/src/main/resources/en.yml b/src/main/resources/en.yml index c30e4b2..147806a 100644 --- a/src/main/resources/en.yml +++ b/src/main/resources/en.yml @@ -51,6 +51,7 @@ language: protectionmessagenopenalty: '&cProtection enabled for %0%, do not do it again.' provideaplayer: '&cPlease provide a player when %0% &cthem.' provideajail: '&cPlease provide a jail to %0% &cthem to.' + status: "&2You have been jailed with a reason of '%0%' by %1% and have %2% minutes remaining." suggestedcell: '&cAn empty cell in the same jail, %0%, was found: %1%' telein: "&9Teleported %0% to %1%'s teleport in location." teleout: "&9Teleported %0% to %1%'s teleport out location." @@ -60,6 +61,7 @@ language: transferred: '&9You have been transferred to %0%.' unjailed: '&2You have been released! Please respect the server rules.' willbeunjailed: '&2%0% will be released the next time they log on.' + youarenotjailed: '&2You are not jailed.' handcuffing: cantbehandcuffed: '&9%0% &ccan not be handcuffed.' currentlyjailed: '&9%0% &cis currently jailed, you can not handcuff a prisoner.'