mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2025-02-05 15:55:28 +01:00
added tab completion to the update command
This commit is contained in:
parent
6caed4c23c
commit
fb7a3ec99d
@ -1,5 +1,6 @@
|
|||||||
package me.clip.placeholderapi.commands.impl.cloud;
|
package me.clip.placeholderapi.commands.impl.cloud;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
import me.clip.placeholderapi.commands.PlaceholderCommand;
|
import me.clip.placeholderapi.commands.PlaceholderCommand;
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
@ -96,7 +97,20 @@ public final class CommandECloudUpdate extends PlaceholderCommand
|
|||||||
@Override
|
@Override
|
||||||
public void complete(@NotNull final PlaceholderAPIPlugin plugin, @NotNull final CommandSender sender, @NotNull final String alias, @NotNull @Unmodifiable final List<String> params, @NotNull final List<String> suggestions)
|
public void complete(@NotNull final PlaceholderAPIPlugin plugin, @NotNull final CommandSender sender, @NotNull final String alias, @NotNull @Unmodifiable final List<String> params, @NotNull final List<String> suggestions)
|
||||||
{
|
{
|
||||||
|
if (params.size() > 1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<CloudExpansion> installed = Lists.newArrayList(plugin.getCloudExpansionManager().getCloudExpansionsInstalled().values());
|
||||||
|
installed.removeIf(expansion -> !expansion.shouldUpdate());
|
||||||
|
|
||||||
|
if (!installed.isEmpty() && (params.isEmpty() || "all".startsWith(params.get(0).toLowerCase())))
|
||||||
|
{
|
||||||
|
suggestions.add("all");
|
||||||
|
}
|
||||||
|
|
||||||
|
suggestByParameter(installed.stream().map(CloudExpansion::getName).map(name -> name.replace(" ", "_")), suggestions, params.isEmpty() ? null : params.get(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user