Don't make the string arrays each tab

This commit is contained in:
graywolf336 2015-06-03 10:01:24 -05:00
parent 1c43951a7c
commit b91b54a9fc
2 changed files with 6 additions and 2 deletions

View File

@ -23,6 +23,8 @@ import com.graywolf336.jail.enums.Lang;
usage = "/jail time [add|remove|set|show] [name] <time>"
)
public class JailTimeCommand implements Command {
private static final String[] options = new String[] { "add", "remove", "set", "show" };
public boolean execute(JailManager jm, CommandSender sender, String... args) throws Exception {
if(jm.isPlayerJailedByLastKnownUsername(args[2])) {
Prisoner p = jm.getPrisonerByLastKnownName(args[2]);
@ -63,7 +65,7 @@ public class JailTimeCommand implements Command {
switch(args.length) {
case 2:
for(String s : new String[] { "add", "remove", "set", "show" })
for(String s : options)
if(args[1].isEmpty() || StringUtil.startsWithIgnoreCase(s, args[1]))
results.add(s);
break;

View File

@ -25,6 +25,8 @@ import com.graywolf336.jail.enums.Settings;
usage = "/jail vote [player] (yes|no)"
)
public class JailVoteCommand implements Command {
private static final String[] options = new String[] { "yes", "no" };
public boolean execute(JailManager jm, CommandSender sender, String... args) {
if(jm.getPlugin().getConfig().getBoolean(Settings.JAILVOTEENABLED.getPath()) && jm.getPlugin().getJailVoteManager() != null && !jm.getJails().isEmpty()) {
Player p = (Player) sender;
@ -114,7 +116,7 @@ public class JailVoteCommand implements Command {
results.add(p.getName());
break;
case 3:
for(String s : new String[] { "yes", "no" })
for(String s : options)
if(args[2].isEmpty() || StringUtil.startsWithIgnoreCase(s, args[2]))
results.add(s);
break;