Finish adding the jailrecord command, this closes #12.
This commit is contained in:
@ -23,6 +23,7 @@ import com.graywolf336.jail.command.subcommands.JailDeleteCommand;
|
||||
import com.graywolf336.jail.command.subcommands.JailListCellsCommand;
|
||||
import com.graywolf336.jail.command.subcommands.JailListCommand;
|
||||
import com.graywolf336.jail.command.subcommands.JailMuteCommand;
|
||||
import com.graywolf336.jail.command.subcommands.JailRecordCommand;
|
||||
import com.graywolf336.jail.command.subcommands.JailReloadCommand;
|
||||
import com.graywolf336.jail.command.subcommands.JailStatusCommand;
|
||||
import com.graywolf336.jail.command.subcommands.JailStopCommand;
|
||||
@ -181,6 +182,7 @@ public class JailHandler {
|
||||
load(JailListCellsCommand.class);
|
||||
load(JailListCommand.class);
|
||||
load(JailMuteCommand.class);
|
||||
load(JailRecordCommand.class);
|
||||
load(JailReloadCommand.class);
|
||||
load(JailStatusCommand.class);
|
||||
load(JailStopCommand.class);
|
||||
|
@ -0,0 +1,45 @@
|
||||
package com.graywolf336.jail.command.subcommands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.graywolf336.jail.JailManager;
|
||||
import com.graywolf336.jail.command.Command;
|
||||
import com.graywolf336.jail.command.CommandInfo;
|
||||
import com.graywolf336.jail.enums.LangString;
|
||||
|
||||
@CommandInfo(
|
||||
maxArgs = 2,
|
||||
minimumArgs = 1,
|
||||
needsPlayer = false,
|
||||
pattern = "reload|r",
|
||||
permission = "jail.command.jailrecord",
|
||||
usage = "/jail record"
|
||||
)
|
||||
public class JailRecordCommand implements Command {
|
||||
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
||||
if(args.length == 2) {
|
||||
// /jail record <username>
|
||||
List<String> entries = jm.getPlugin().getJailIO().getRecordEntries(args[1]);
|
||||
|
||||
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.RECORDTIMESJAILED, new String[] { args[1], String.valueOf(entries.size()) }));
|
||||
}else if(args.length == 3) {
|
||||
// /jail record <username> something
|
||||
List<String> entries = jm.getPlugin().getJailIO().getRecordEntries(args[1]);
|
||||
|
||||
//Send all the record entries
|
||||
for(String s : entries) {
|
||||
sender.sendMessage(s);
|
||||
}
|
||||
|
||||
sender.sendMessage(jm.getPlugin().getJailIO().getLanguageString(LangString.RECORDTIMESJAILED, new String[] { args[1], String.valueOf(entries.size()) }));
|
||||
}else {
|
||||
//They didn't do the command right
|
||||
//send them back to get the usage
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user