PaidSigns/src/main/java/net/knarcraft/paidsigns/command/RemoveConditionTabCompleter.java

44 lines
1.2 KiB
Java

package net.knarcraft.paidsigns.command;
import net.knarcraft.paidsigns.utility.TabCompleteHelper;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.List;
/**
* The tab completer for the remove paid sign condition command
*/
public class RemoveConditionTabCompleter extends TokenizedTabCompleter {
private List<String> lineIndices;
@Nullable
@Override
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias,
@NotNull String[] args) {
super.onTabComplete(sender, command, alias, args);
if (lineIndices == null) {
initializeValues();
}
if (argumentSize < 1) {
return TabCompleteHelper.getPaidSignNames();
} else if (argumentSize < 2) {
return TabCompleteHelper.getSignLines();
}
return new ArrayList<>();
}
/**
* Initializes the values available for tab completion
*/
private void initializeValues() {
lineIndices = TabCompleteHelper.getSignLines();
}
}