Hello, I would like to display the username and not the UUID:
Full code:
Code:
if arg-1 is "top":
loop all offline players:
set {_player} to loop-value
set {_list::%loop-value%} to "%{_player}.getStatistic(Statistic.PLAY_ONE_MINUTE)% ticks" parsed as timespan
loop {_list::*}:
add loop-index to {_inverted::%loop-value%::*}
set {_position} to 1
loop reversed sorted {_list::*}:
{_last} is not loop-value
set {_last} to loop-value
loop {_inverted::%loop-value%::*}:
set {_sorted::%{_position}%} to loop-value-2
add 1 to {_position}
send "%nl%&aClassement - Playtime &7: Les meilleurs temps de jeu%nl%"
loop {_sorted::*}:
stop if loop-index parsed as an integer > 8
send " &7• &l%loop-index%&r &7: &e%loop-value% &7(%ptConvertTime({_list::%loop-value%}, true)%&7)"
stop
Full code:
Code:
# Copyright 2020 Clément Raynaud (carlodrift)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import:
ch.njol.skript.Skript
java.io.BufferedReader
java.io.InputStreamReader
java.net.URL
org.bukkit.Statistic
function ptConvertTime(timespan: timespan, top: boolean) :: text:
set {_string} to "%{_timespan}%"
replace all "." with "," in {_string}
if {_top} is true:
replace all "and" with "et" in {_string}
else:
replace all "and" with "&7et&e" in {_string}
replace all "second" with "seconde" in {_string}
replace all "hour" with "heure" in {_string}
replace all "day" with "jour" in {_string}
return {_string}
command /playtime [<text>] [<text>]:
trigger:
if arg-1 is not set:
set {_player} to player
set {_time} to ptConvertTime("%player.getStatistic(Statistic.PLAY_ONE_MINUTE)% ticks" parsed as timespan, false)
send "%nl%&aPlaytime &8• &7Votre temps de jeu est de &e%{_time}%&7."
else:
if arg-1 is "top":
loop all offline players:
set {_player} to loop-value
set {_list::%loop-value%} to "%{_player}.getStatistic(Statistic.PLAY_ONE_MINUTE)% ticks" parsed as timespan
loop {_list::*}:
add loop-index to {_inverted::%loop-value%::*}
set {_position} to 1
loop reversed sorted {_list::*}:
{_last} is not loop-value
set {_last} to loop-value
loop {_inverted::%loop-value%::*}:
set {_sorted::%{_position}%} to loop-value-2
add 1 to {_position}
send "%nl%&aClassement - Playtime &7: Les meilleurs temps de jeu%nl%"
loop {_sorted::*}:
stop if loop-index parsed as an integer > 8
send " &7• &l%loop-index%&r &7: &e%loop-value% &7(%ptConvertTime({_list::%loop-value%}, true)%&7)"
stop
else if arg-1 is "player":
arg-2 is set
set {_players::*} to all offline players
{_players::*} contains arg-2:
set {_player} to arg-2 parsed as an offline player
set {_time} to ptConvertTime("%{_player}.getStatistic(Statistic.PLAY_ONE_MINUTE)% ticks" parsed as timespan, false)
send "%nl%&aPlaytime &8• &7Le temps de jeu du joueur est de &e%{_time}%&7."
else:
send "%nl%&aPlaytime &8• &7Ce joueur n'a jamais joué ici."
stop
send "%nl%&aAide - Playtime &7: Les différentes commandes%nl%"
send " &7• &e/playtime"
send " &7• &e/playtime top"
send " &7• &e/playtime player <joueur>"
send " &7• &e/playtime help%nl%"