parent
8344adff1a
commit
6b68bdab0f
1 changed files with 7 additions and 1 deletions
|
@ -286,6 +286,8 @@ public class Command2MC extends Command2<ICommand2MC, Command2MCSender> implemen
|
||||||
type = StringArgumentType.word();
|
type = StringArgumentType.word();
|
||||||
else if (ptype == boolean.class || ptype == Boolean.class)
|
else if (ptype == boolean.class || ptype == Boolean.class)
|
||||||
type = BoolArgumentType.bool();
|
type = BoolArgumentType.bool();
|
||||||
|
else if (parameter.isVarArgs())
|
||||||
|
type = StringArgumentType.greedyString();
|
||||||
else {
|
else {
|
||||||
type = StringArgumentType.word();
|
type = StringArgumentType.word();
|
||||||
customParamTypeTemp = true;
|
customParamTypeTemp = true;
|
||||||
|
@ -300,6 +302,10 @@ public class Command2MC extends Command2<ICommand2MC, Command2MCSender> implemen
|
||||||
.map(Triplet::getValue2).findAny();
|
.map(Triplet::getValue2).findAny();
|
||||||
var argb = RequiredArgumentBuilder.argument(param, type)
|
var argb = RequiredArgumentBuilder.argument(param, type)
|
||||||
.suggests((SuggestionProvider<Object>) (context, builder) -> {
|
.suggests((SuggestionProvider<Object>) (context, builder) -> {
|
||||||
|
if (parameter.isVarArgs()) { //Do it before the builder is used
|
||||||
|
int x = context.getInput().lastIndexOf(' ') + 1;
|
||||||
|
builder = builder.createOffset(x);
|
||||||
|
}
|
||||||
if (customTC.isPresent())
|
if (customTC.isPresent())
|
||||||
for (val ctc : customTC.get())
|
for (val ctc : customTC.get())
|
||||||
builder.suggest(ctc);
|
builder.suggest(ctc);
|
||||||
|
@ -364,7 +370,7 @@ public class Command2MC extends Command2<ICommand2MC, Command2MCSender> implemen
|
||||||
if (ptype == boolean.class || ptype == Boolean.class)
|
if (ptype == boolean.class || ptype == Boolean.class)
|
||||||
builder.suggest("true").suggest("false");
|
builder.suggest("true").suggest("false");
|
||||||
return builder.suggest(param).buildFuture().whenComplete((s, e) -> //The list is automatically ordered
|
return builder.suggest(param).buildFuture().whenComplete((s, e) -> //The list is automatically ordered
|
||||||
Collections.swap(s.getList(), 0, s.getList().size() - 1)); //So we need to put the <param> at the end after that
|
s.getList().add(s.getList().remove(0))); //So we need to put the <param> at the end after that
|
||||||
});
|
});
|
||||||
var arg = argb.build();
|
var arg = argb.build();
|
||||||
scmd.addChild(arg);
|
scmd.addChild(arg);
|
||||||
|
|
Loading…
Reference in a new issue