Dynamically Updated MultiLiteral Argument
CollidaCube opened this issue · comments
Description
Currently, with StringArgument
, you can provide a list of suggestions dynamically for the player to chose from using .replaceSuggestions(...)
but it will really accept any token. There is also MultiLiteralArgument
which has a hard-coded list of accepted values and considers any other token invalid. I would like to see an in-between where you can dynamically provide a list of accepted values and the argument will mark any other token as invalid.
Expected code
// Optimally, I imagine this
// Variation 1:
new MultiLiteralArgument("messageId").replaceSuggestions(
ArgumentSuggestions.stringCollection(info -> EconomyManager.getAllEconomyIds())
);
// Variation 2:
new MultiLiteralArgument("messageId", ArgumentSuggestions.stringCollection(info -> EconomyManager.getAllEconomyIds()));
// This could work too
new StringArgument("messageId")
.replaceSuggestions(
ArgumentSuggestions.stringCollection(info -> EconomyManager.getAllEconomyIds())
.withRequirement(args -> args.suggestions().contains(args.currentArg()))
);
// Or a new argument altogether
new DynamicallyUpdatedLiteralArgument("messageId").replaceSuggestions(...);
Extra details
No response