Skip to content

Commit

Permalink
Update init.lua
Browse files Browse the repository at this point in the history
Made some things look nicer
  • Loading branch information
pl608 committed May 29, 2024
1 parent c703e9b commit 85c4afe
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions playtime/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,23 @@ local function format_duration(seconds)
end

minetest.register_chatcommand("playtime", {
params = "<player_name>",
params = "[playername]",
description = S("See your total playtime on this server"),
func = function(name, player_name)
if player_name == '' then
if player_name == "" then
player_name = name
if minetest.is_singleplayer() then
player_name = "singleplayer"
end
end
if (player_name == '') and minetest.is_singleplayer() then
player_name = 'singleplayer'
end
if not minetest.player_exists(player_name) then
return false, S('You must enter a existing player name!')
end
if minetest.get_player_by_name(player_name) then
return true,
C("#63d437", "Total: ")..C("#ffea00", format_duration(playtime.get_total_playtime(player_name))).."\n"..
C("#63d437", "Current: ")..C("#ffea00", format_duration(playtime.get_session_playtime(player_name)))
else
if not minetest.player_exists(player_name) then
return false, S("You must enter a existing player name!")
end
return false, S("Player must be online to run this command!")
end
end,
Expand Down

0 comments on commit 85c4afe

Please sign in to comment.