Package dev.jorel.commandapi.arguments
Class MapArgumentBuilder.MapArgumentBuilderValueMapper.MapArgumentBuilderSuggestsKey
java.lang.Object
dev.jorel.commandapi.arguments.MapArgumentBuilder.MapArgumentBuilderValueMapper.MapArgumentBuilderSuggestsKey
- Enclosing class:
MapArgumentBuilder.MapArgumentBuilderValueMapper
public class MapArgumentBuilder.MapArgumentBuilderValueMapper.MapArgumentBuilderSuggestsKey
extends Object
An intermediary class for the
MapArgumentBuilder-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionMapArgumentBuilder<K,V>.MapArgumentBuilderValueMapper.MapArgumentBuilderSuggestsKey.MapArgumentBuilderSuggestsValue withKeyList(Supplier<List<String>> keyListSupplier) Provides a supplier of keys to suggest when a user types this argument.MapArgumentBuilder<K,V>.MapArgumentBuilderValueMapper.MapArgumentBuilderSuggestsKey.MapArgumentBuilderSuggestsValue withKeyList(List<String> keyList) Provides a list of keys to suggest when a user types this argument.MapArgumentBuilder<K,V>.MapArgumentBuilderValueMapper.MapArgumentBuilderSuggestsKey.MapArgumentBuilderSuggestsValue When using this method, no key suggestions are displayed and any keys can be given for the final map.
-
Constructor Details
-
MapArgumentBuilderSuggestsKey
-
-
Method Details
-
withKeyList
public MapArgumentBuilder<K,V>.MapArgumentBuilderValueMapper.MapArgumentBuilderSuggestsKey.MapArgumentBuilderSuggestsValue withKeyList(List<String> keyList) Provides a list of keys to suggest when a user types this argument. All keys given for the final map must come from this list, otherwise a CommandSyntaxException is thrown.Duplicate keys are never allowed since one key can only be mapped to one value. If a duplicate key is given, a CommandSyntaxException is thrown.
- Parameters:
keyList- A list of keys to suggest.- Returns:
- this map argument builder
-
withKeyList
public MapArgumentBuilder<K,V>.MapArgumentBuilderValueMapper.MapArgumentBuilderSuggestsKey.MapArgumentBuilderSuggestsValue withKeyList(Supplier<List<String>> keyListSupplier) Provides a supplier of keys to suggest when a user types this argument. The supplier is invoked on every tab-completion, so changes to the underlying data are always reflected. All keys given for the final map must come from this list, otherwise a CommandSyntaxException is thrown.Duplicate keys are never allowed since one key can only be mapped to one value. If a duplicate key is given, a CommandSyntaxException is thrown.
- Parameters:
keyListSupplier- A supplier that provides the list of keys to suggest.- Returns:
- this map argument builder
-
withoutKeyList
public MapArgumentBuilder<K,V>.MapArgumentBuilderValueMapper.MapArgumentBuilderSuggestsKey.MapArgumentBuilderSuggestsValue withoutKeyList()When using this method, no key suggestions are displayed and any keys can be given for the final map. To restrict the keys that can be given for this map, usewithKeyList(List)instead.Duplicate keys are never allowed since one key can only be mapped to one value. If a duplicate key is given, a CommandSyntaxException is thrown.
- Returns:
- this map argument builder
-