PlotSquared icon indicating copy to clipboard operation
PlotSquared copied to clipboard

Feat: adding "last" argument for Visit cmd to choose the highest number

Open RedstoneFuture opened this issue 2 years ago • 9 comments

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> -#

grafik

### 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).

RedstoneFuture avatar Oct 28 '23 20:10 RedstoneFuture

What if as well as adding last we allowed adding a - to the number to indicate the number-from-last to visit?

dordsor21 avatar Nov 19 '23 13:11 dordsor21

What if as well as adding last we 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

RedstoneFuture avatar Nov 19 '23 14:11 RedstoneFuture

I'd say last is still the very last plot, and then -1 is the plot before last. So -0 is basically last

dordsor21 avatar Nov 19 '23 14:11 dordsor21

I'd say last is still the very last plot, and then -1 is the plot before last. So -0 is basically last

Ah ok. Yea, both versions make sense.

grafik

grafik

RedstoneFuture avatar Nov 19 '23 14:11 RedstoneFuture

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?

SirYwell avatar Nov 19 '23 15:11 SirYwell

I'd still think having the -# shorthand would be good, though a flag is probably more user-friendly for most to be fair

dordsor21 avatar Nov 20 '23 13:11 dordsor21

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]|[#] [#]

RedstoneFuture avatar Nov 23 '23 23:11 RedstoneFuture

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.

RedstoneFuture avatar Dec 21 '23 15:12 RedstoneFuture

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.

RedstoneFuture avatar Feb 23 '24 15:02 RedstoneFuture