Search in sources :

Example 1 with LimboFilter

use of net.elytrium.limbofilter.LimboFilter in project LimboFilter by Elytrium.

the class LimboFilterCommand method suggest.

@Override
public List<String> suggest(SimpleCommand.Invocation invocation) {
    CommandSource source = invocation.source();
    String[] args = invocation.arguments();
    if (args.length == 0) {
        return this.getSubCommands().filter(cmd -> source.hasPermission("limbofilter." + cmd)).collect(Collectors.toList());
    } else if (args.length == 1) {
        return this.getSubCommands().filter(cmd -> source.hasPermission("limbofilter." + cmd)).filter(str -> str.regionMatches(true, 0, args[0], 0, args[0].length())).collect(Collectors.toList());
    }
    return ImmutableList.of();
}
Also used : SimpleCommand(com.velocitypowered.api.command.SimpleCommand) ConnectedPlayer(com.velocitypowered.proxy.connection.client.ConnectedPlayer) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) MessageFormat(java.text.MessageFormat) ArrayList(java.util.ArrayList) Settings(net.elytrium.limbofilter.Settings) TimeUnit(java.util.concurrent.TimeUnit) List(java.util.List) Stream(java.util.stream.Stream) ImmutableList(com.google.common.collect.ImmutableList) LimboFilter(net.elytrium.limbofilter.LimboFilter) Statistics(net.elytrium.limbofilter.stats.Statistics) Locale(java.util.Locale) Component(net.kyori.adventure.text.Component) Player(com.velocitypowered.api.proxy.Player) ProxyServer(com.velocitypowered.api.proxy.ProxyServer) CommandSource(com.velocitypowered.api.command.CommandSource) LegacyComponentSerializer(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer) Collections(java.util.Collections) CommandSource(com.velocitypowered.api.command.CommandSource)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 CommandSource (com.velocitypowered.api.command.CommandSource)1 SimpleCommand (com.velocitypowered.api.command.SimpleCommand)1 Player (com.velocitypowered.api.proxy.Player)1 ProxyServer (com.velocitypowered.api.proxy.ProxyServer)1 ConnectedPlayer (com.velocitypowered.proxy.connection.client.ConnectedPlayer)1 MessageFormat (java.text.MessageFormat)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 List (java.util.List)1 Locale (java.util.Locale)1 UUID (java.util.UUID)1 TimeUnit (java.util.concurrent.TimeUnit)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 LimboFilter (net.elytrium.limbofilter.LimboFilter)1 Settings (net.elytrium.limbofilter.Settings)1 Statistics (net.elytrium.limbofilter.stats.Statistics)1 Component (net.kyori.adventure.text.Component)1 LegacyComponentSerializer (net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer)1