Last

Gets the last n entries from the source objective.

/goop scoreboard last <objective source> <objective target> <n> [Max Sweep]

They are assigned their rank in the target objective.

  • The player with the lowest score will have a score of 1

  • The next lowest player, the second-to-last, will have a score of 2

  • The third lowest player will have a score of 3, and so on.

Args Breakdown (What everything does)

<Source Objective>

  • The name of the scoreboard objective that you want to get the last players from.

<Target Objective>

  • The name of the scoreboard objective that will store the results.

  • Not required to already exist. If it already exists, it will be deleted and a new one of the same name created.

<n>

  • The max amount of players that will be copied.

  • If the source objective doesn't have enough players in it, all the players will be assigned their rank in the target objective.


[Max Sweep]

  • The max amount of entries that will be sorted through.

  • If missing, only online player names will be examined.

  • Set to a comma list of entity types (like SKELETON) to sort through loaded entities of these types.

  • For some reason, bukkit only lets the code retrieve ALL entries ever existed of all scoreboards (and then decides it is funny to give them all a score of 0) such that sorting through them all (to find the <n> entries with least value) freezes large/old servers.

Tips

  • Choosing <n> as 3 will leave out all but the bottomost 3 players.

    • Thus, I guess you'd need to provide an unreasonable number like 32767 to be sure to rank all players if you truly wish to.


  • In case of a tie, all the players who tie will be included (because it would be unfair otherwise I guess), and they will count as only one player, having the same score.

    • Suppose there is a triple tie for the last place, with <n> = 2 and at least four players. Three players will have a score of 1, and one player will have a score of 2.

    • For an example with an illustration, see GooP Scoreboard Top tips section.


  • Players with a score of 0 will be ignored

Simple Examples:

command{c="goop scoreboard last potato last_potato 3"} @Self ~onSpawn

Will give the 3 players with the least score in the potato objective a rank in a new top_potato objective. If top_potato already exists, it will delete the old.


command{c="goop scoreboard last raceTimes topRaceTime 3000"} @Self ~onSpawn

Will rank every player in the raceTimes objective in a new objective "topRaceTime". The rank will be in ascending order from least to most score. If topRaceTime already exists, it will delete the old.