[Google Trad]
Hello,
When I type an order I would like that with the tab key it adds directly the position of the player, currently I do like this:
@Override
public CommandSpec getSpec() {
return CommandSpec.builder()
.permission(“admintoolv2.coffre.create”)
.description(Text.of(“Crée un coffre”))
.arguments(
GenericArguments.optional(GenericArguments.vector3d(Text.of(“Position”)))
)
.executor(this)
.build();
}
I thought I would do it, but it does not work:
@Override
public CommandSpec getSpec() {
return CommandSpec.builder()
.permission(“admintoolv2.coffre.create”)
.description(Text.of(“Crée un coffre”))
.arguments(
GenericArguments.optional(GenericArguments.vector3d(Text.of(“Position”)))
)
.executor((src, args) → {
Optional player = args.getOne(“player”); // Get the “player” argument, it may not exist so Optional.empty() may be returned
if(player.isPresent()) {
return player.get().getLocation().getPosition();
}
// Do stuff here
return CommandResult.empty();
})
.build();
}
[Français]
Bonjour,
Quand je tape une commande j’aimerais qu’avec la touche tab ça ajoute directement la position du joueur, actuellement je fais comme ça:
@Override
public CommandSpec getSpec() {
return CommandSpec.builder()
.permission(“admintoolv2.coffre.create”)
.description(Text.of(“Crée un coffre”))
.arguments(
GenericArguments.optional(GenericArguments.vector3d(Text.of(“Position”)))
)
.executor(this)
.build();
}
Je pensais faire comme ça, mais ça ne fonctionne pas:
@Override
public CommandSpec getSpec() {
return CommandSpec.builder()
.permission(“admintoolv2.coffre.create”)
.description(Text.of(“Crée un coffre”))
.arguments(
GenericArguments.optional(GenericArguments.vector3d(Text.of(“Position”)))
)
.executor((src, args) → {
Optional player = args.getOne(“player”); // Get the “player” argument, it may not exist so Optional.empty() may be returned
if(player.isPresent()) {
return player.get().getLocation().getPosition();
}
// Do stuff here
return CommandResult.empty();
})
.build();
}