JorelAli / CommandAPI

A Bukkit/Spigot API for the command UI introduced in Minecraft 1.13
https://commandapi.jorel.dev
MIT License
504 stars 60 forks source link

OptionalArguments working weird with stacked Arguments(location arguments and others) #572

Closed StreamVersus1 closed 2 weeks ago

StreamVersus1 commented 2 weeks ago

CommandAPI version

9.5.1

Minecraft version

1.20.1

Are you shading the CommandAPI?

Yes

What I did

        withOptionalArguments(new LocationArgument("location", LocationType.PRECISE_POSITION));
        withOptionalArguments(new RotationArgument("rotation"));
        withOptionalArguments(new WorldArgument("world"));

What actually happened

Its weird that you need to press spacebar 3 times(1 per each coordinate) to get to another(possibly optional) arguments. image

What should have happened

To prevent that, one space should skip argument fully, not just 1 input field.

Server logs and CommandAPI config

No response

Other

No response

DerEchtePilz commented 2 weeks ago

Do I understand that correctly, you have multiple optional arguments and you want to skip some of them when executing the command?

StreamVersus1 commented 2 weeks ago

No, Location argument works like 3 combined coordinate argument, and to skip Location argument, you need to skip each one of the combined argument I want to skip 1 Location Argument with one space

DerEchtePilz commented 2 weeks ago

Can you share the command (the code) and your expected result? I still don't really know what you want to achieve.

StreamVersus1 commented 2 weeks ago
super(main, "teleport");
        withArguments(new SubTagArgument("subtag").combineWith(new PlayersBySlotArgument("slots")));
        withOptionalArguments(new LocationArgument("location", LocationType.PRECISE_POSITION)); <- takes 3 spaces to skip, one for x, one for y, and one for z
        withOptionalArguments(new RotationArgument("rotation")); <- takes 2 spaces to skip, one for pitch, and 1 for yaw
        withOptionalArguments(new WorldArgument("world")); <- takes 1 space

Right now: 6 space to skip all arguments Expected: 1 per argument, 3 total

DerEchtePilz commented 2 weeks ago

What do you mean by skip arguments? Do you want, for example, provide the location argument, then don't provide the rotation argument and then provide the world argument? Also if you don't want to provide any of those optional arguments, just don't write any of those.

StreamVersus1 commented 2 weeks ago

What do you mean by skip arguments? Do you want, for example, provide the location argument, then don't provide the rotation argument and then provide the world argument? Also if you don't want to provide any of those optional arguments, just don't write any of those.

im unable to type another argument before i type space:

/teleport 'location' 'rotation' 'world'

i am unable to write'rotation' before i will at least type space in 'location' but location works like 'x' 'y' 'z' so before i can type 'rotation'>, i need to type space in 'x' 'y' 'z', which leads to ugly and weird command structure

/teleport    100 10 minecraft:overworld

Hope this will make more sense update:github ate everything, sorry

DerEchtePilz commented 2 weeks ago

I mean, your command structure is

/teleport <subtag> <slots> <location> <rotation> <world>

So obviously, in order to get to the location, you have to type in your subtag and slots argument. If you want to type in a rotation, you also have to provide a location. That's just how commands work.

StreamVersus1 commented 2 weeks ago

I mean, your command structure is

/teleport <subtag> <slots> <location> <rotation> <world>

So obviously, in order to get to the location, you have to type in your subtag and slots argument. If you want to type in a rotation, you also have to provide a location. That's just how commands work.

Its not problem with multiple arguments, its problem with arguments, that are made by combining another arguments and that you need to skip each of subarguments in Location, which takes 3 spaces, maybe im losing point somewhere

DerEchtePilz commented 2 weeks ago

There is no such thing as "skipping arguments". You can't just not provide an argument that is on the path to another argument. If an argument is optional, you can choose to not provide it when executing the command but that will also disable you from providing arguments after the not provided optional argument.

StreamVersus1 commented 2 weeks ago

oh, thanks for clarifing that i didnt expected for it to work like that Thanks