Build AsminVoicechat / prepare-release (push) Successful in 14s
Build AsminVoicechat / build-and-test (17) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (18) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (19) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (20) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (21) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (22) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (23) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (24) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (25) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (26) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (27-ea) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (16) (push) Canceled after 38s
40 lines
1.5 KiB
Java
40 lines
1.5 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* com.mojang.brigadier.context.CommandContext
|
|
* com.mojang.brigadier.suggestion.SuggestionProvider
|
|
* com.mojang.brigadier.suggestion.Suggestions
|
|
* com.mojang.brigadier.suggestion.SuggestionsBuilder
|
|
*/
|
|
package de.maxhenkel.voicechat.integration.commodore;
|
|
|
|
import com.mojang.brigadier.context.CommandContext;
|
|
import com.mojang.brigadier.suggestion.SuggestionProvider;
|
|
import com.mojang.brigadier.suggestion.Suggestions;
|
|
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
|
|
import de.maxhenkel.voicechat.Voicechat;
|
|
import de.maxhenkel.voicechat.voice.server.Group;
|
|
import de.maxhenkel.voicechat.voice.server.Server;
|
|
import java.util.concurrent.CompletableFuture;
|
|
|
|
public class GroupNameSuggestionProvider
|
|
implements SuggestionProvider<Object> {
|
|
public static final GroupNameSuggestionProvider INSTANCE = new GroupNameSuggestionProvider();
|
|
|
|
public CompletableFuture<Suggestions> getSuggestions(CommandContext<Object> context, SuggestionsBuilder builder) {
|
|
Server server = Voicechat.SERVER.getServer();
|
|
if (server == null) {
|
|
return builder.buildFuture();
|
|
}
|
|
server.getGroupManager().getGroups().values().stream().map(Group::getName).distinct().map(s -> {
|
|
if (s.contains(" ")) {
|
|
return String.format("\"%s\"", s);
|
|
}
|
|
return s;
|
|
}).forEach(arg_0 -> ((SuggestionsBuilder)builder).suggest(arg_0));
|
|
return builder.buildFuture();
|
|
}
|
|
}
|
|
|