Add the /jail status command.

This commit is contained in:
graywolf336
2014-02-13 12:00:21 -06:00
parent 78cc20c2c1
commit efcd517360
4 changed files with 42 additions and 0 deletions

View File

@ -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);

View File

@ -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;
}
}