Don't make the string arrays each tab
This commit is contained in:
parent
1c43951a7c
commit
b91b54a9fc
@ -23,6 +23,8 @@ import com.graywolf336.jail.enums.Lang;
|
|||||||
usage = "/jail time [add|remove|set|show] [name] <time>"
|
usage = "/jail time [add|remove|set|show] [name] <time>"
|
||||||
)
|
)
|
||||||
public class JailTimeCommand implements Command {
|
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 {
|
public boolean execute(JailManager jm, CommandSender sender, String... args) throws Exception {
|
||||||
if(jm.isPlayerJailedByLastKnownUsername(args[2])) {
|
if(jm.isPlayerJailedByLastKnownUsername(args[2])) {
|
||||||
Prisoner p = jm.getPrisonerByLastKnownName(args[2]);
|
Prisoner p = jm.getPrisonerByLastKnownName(args[2]);
|
||||||
@ -63,7 +65,7 @@ public class JailTimeCommand implements Command {
|
|||||||
|
|
||||||
switch(args.length) {
|
switch(args.length) {
|
||||||
case 2:
|
case 2:
|
||||||
for(String s : new String[] { "add", "remove", "set", "show" })
|
for(String s : options)
|
||||||
if(args[1].isEmpty() || StringUtil.startsWithIgnoreCase(s, args[1]))
|
if(args[1].isEmpty() || StringUtil.startsWithIgnoreCase(s, args[1]))
|
||||||
results.add(s);
|
results.add(s);
|
||||||
break;
|
break;
|
||||||
|
@ -25,6 +25,8 @@ import com.graywolf336.jail.enums.Settings;
|
|||||||
usage = "/jail vote [player] (yes|no)"
|
usage = "/jail vote [player] (yes|no)"
|
||||||
)
|
)
|
||||||
public class JailVoteCommand implements Command {
|
public class JailVoteCommand implements Command {
|
||||||
|
private static final String[] options = new String[] { "yes", "no" };
|
||||||
|
|
||||||
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
public boolean execute(JailManager jm, CommandSender sender, String... args) {
|
||||||
if(jm.getPlugin().getConfig().getBoolean(Settings.JAILVOTEENABLED.getPath()) && jm.getPlugin().getJailVoteManager() != null && !jm.getJails().isEmpty()) {
|
if(jm.getPlugin().getConfig().getBoolean(Settings.JAILVOTEENABLED.getPath()) && jm.getPlugin().getJailVoteManager() != null && !jm.getJails().isEmpty()) {
|
||||||
Player p = (Player) sender;
|
Player p = (Player) sender;
|
||||||
@ -114,7 +116,7 @@ public class JailVoteCommand implements Command {
|
|||||||
results.add(p.getName());
|
results.add(p.getName());
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
for(String s : new String[] { "yes", "no" })
|
for(String s : options)
|
||||||
if(args[2].isEmpty() || StringUtil.startsWithIgnoreCase(s, args[2]))
|
if(args[2].isEmpty() || StringUtil.startsWithIgnoreCase(s, args[2]))
|
||||||
results.add(s);
|
results.add(s);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user