Adds a tab completer for the list command

This commit is contained in:
2022-02-25 22:16:11 +01:00
parent 8a030276c5
commit db869c0c5b
4 changed files with 53 additions and 3 deletions

View File

@ -25,7 +25,6 @@ public class AddCommand extends TokenizedCommand {
if (args.length < 3) {
return false;
}
PaidSignManager manager = PaidSigns.getInstance().getSignManager();
String signName = arguments.get(0);
double cost;
@ -45,6 +44,23 @@ public class AddCommand extends TokenizedCommand {
ignoreColor = OptionState.fromString(arguments.get(4));
}
return createPaidSign(sender, signName, cost, permission, ignoreCase, ignoreColor);
}
/**
* Creates a new paid sign with the given user input
*
* @param sender <p>The command sender that called the add command</p>
* @param signName <p>The name of the new paid sign</p>
* @param cost <p>The cost of the new paid sign</p>
* @param permission <p>The permission required for creating the sign represented by the paid sign</p>
* @param ignoreCase <p>Whether to ignore case for the paid sign's conditions</p>
* @param ignoreColor <p>Whether to ignore color for the paid sign's conditions</p>
* @return <p>True if the paid sign was successfully created and registered</p>
*/
private boolean createPaidSign(CommandSender sender, String signName, double cost, String permission,
OptionState ignoreCase, OptionState ignoreColor) {
PaidSignManager manager = PaidSigns.getInstance().getSignManager();
try {
PaidSign sign = new PaidSign(signName, cost, permission, ignoreCase, ignoreColor);
if (manager.getPaidSign(signName) != null) {