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 lineIndices; @Nullable @Override public List 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(); } }