Convert the transfer jewel using args to arguments, removing 'transfer'
This commit is contained in:
parent
c6988edd4f
commit
65f4f47cca
@ -50,7 +50,7 @@ public class JailCommand implements Command {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//This is just to add the -p param so jCommander doesn't blow up
|
//This is just to add the -p param so CliFactory doesn't blow up
|
||||||
List<String> arguments = new LinkedList<String>(Arrays.asList(args));
|
List<String> arguments = new LinkedList<String>(Arrays.asList(args));
|
||||||
//Only add the "-p" if it doesn't already contain it, this way people can do `/jail -p check` in the event someone
|
//Only add the "-p" if it doesn't already contain it, this way people can do `/jail -p check` in the event someone
|
||||||
//has a name which is one of our subcommands
|
//has a name which is one of our subcommands
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package com.graywolf336.jail.command.subcommands;
|
package com.graywolf336.jail.command.subcommands;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@ -28,11 +32,16 @@ public class JailTransferCommand implements Command {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Convert to a List<String> so we can edit the list
|
||||||
|
List<String> arguments = new LinkedList<String>(Arrays.asList(args));
|
||||||
|
//remove the first argument of "transfer"
|
||||||
|
arguments.remove(0);
|
||||||
|
|
||||||
//Parse the command
|
//Parse the command
|
||||||
Transfer params = null;
|
Transfer params = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
params = CliFactory.parseArguments(Transfer.class, args);
|
params = CliFactory.parseArguments(Transfer.class, arguments.toArray(new String[arguments.size()]));
|
||||||
}catch(ArgumentValidationException e) {
|
}catch(ArgumentValidationException e) {
|
||||||
sender.sendMessage(ChatColor.RED + e.getMessage());
|
sender.sendMessage(ChatColor.RED + e.getMessage());
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user