Feat: adding "last" argument for Visit cmd to choose the highest number
Overview
With this PR it is allowed to use the last or n argument to choose the highest possible (last) plot number of the target. For this purpose, parts of the algorithm were also outsourced to a private method and extended.
If this is accepted so far, I can build the same for the Home command: /p h last.
EDIT (21.12.2023): Support for inverted plot numbers has also been added.
Description
Examples:
/p v <username> last/p v <username> <area> last--> Teleports the player to the x plot of<username>if he has a total of x.
EDIT (21.12.2023):
/p v <username> -#/p v <username> <area> -#
### Submitter Checklist
- [X] Make sure you are opening from a topic branch (**/feature/fix/docs/ branch** (right side)) and not your main branch.
- [X] Ensure that the pull request title represents the desired changelog entry.
- [X] New public fields and methods are annotated with `@since TODO`.
- [X] I read and followed the [contribution guidelines](https://github.com/IntellectualSites/.github/blob/main/CONTRIBUTING.md).
What if as well as adding last we allowed adding a - to the number to indicate the number-from-last to visit?
What if as well as adding
lastwe allowed adding a-to the number to indicate the number-from-last to visit?
Do you mean the argument last or n is the same as -1. And -2 is the second plot from behind?
Example: Total plots: 4x
/p v last=/p v -1-->/p v 4/p v -2-->/p v 3
I'd say last is still the very last plot, and then -1 is the plot before last. So -0 is basically last
I'd say
lastis still the very last plot, and then-1is the plot beforelast. So-0is basicallylast
Ah ok. Yea, both versions make sense.
I'm not sure about the negative values. It might make sense for us, but I don't know if it is user-friendly. Python has a similar feature for lists, but there -1 is tne last element. Having -0 looks very confusing.
Maybe it would be better to have a flag (e.g. -r for reverse?), so /p v -r brings you to the last plot, /p v -r 2 or /p v 2 -r brings you to the second last, etc. WDYT?
I'd still think having the -# shorthand would be good, though a flag is probably more user-friendly for most to be fair
I'll add the -# spelling.
But I don't think that a "reverse flag" is much more very user-friendly, as the command already has a very complex syntax. Especially because the order of the arguments also plays a role here, so that we can classify the individual command inputs. In the end, the -# spelling is the same in short, with the difference that not even the syntax "changes" for the user.
/plot visit <player> | <alias> | <plot> [area]|[#] [#]
I'll add the
-#spelling.But I don't think that a "reverse flag" is much more very user-friendly, as the command already has a very complex syntax. Especially because the order of the arguments also plays a role here, so that we can classify the individual command inputs. In the end, the
-#spelling is the same in short, with the difference that not even the syntax "changes" for the user.
/plot visit <player> | <alias> | <plot> [area]|[#] [#]
-# spelling has been added.
I'm looking forward to the merge. I can make good use of the command. When this has been merged, I'll add a "last" to the "/p home" command too.