Removed player_list and pm mods

This commit is contained in:
Wuzzy 2019-09-03 20:08:07 +02:00
parent 2b4f6fc8eb
commit 22bba65a6f
10 changed files with 0 additions and 263 deletions

View File

@ -1,10 +0,0 @@
Player listing mod
==================
By Kaadmy, for Pixture
Adds player lists(current/recent/all).
Use the chatcommand "/plist" to show a player list
Change command parameters (none/recent/all) to show different stats
Source license: LGPLv2.1

View File

@ -1 +0,0 @@
default

View File

@ -1,117 +0,0 @@
--
-- Player listing mod
-- By Kaadmy, for Pixture
--
local S = minetest.get_translator("player_list")
player_list = {}
-- current players format:
-- {<playername> = <last connect(if connected, or nil)>}
player_list.players = {}
local function divmod(f, d)
return {math.floor(f / d), f % d}
end
local function prettytime(time)
local a = divmod(time, 60)
local seconds = a[2]
local minutes = a[1]
local b = divmod(minutes, 60)
local hours = b[1]
minutes = b[2]
local c = divmod(hours, 24)
local days = c[1]
hours = c[2]
local str = ""
if days ~= 0 then str = str .. days .. "d " end
if hours ~= 0 then str = str .. hours .. "h " end
if minutes ~= 0 then str = str .. minutes .. "m " end
str = str .. seconds .. "s"
return str
end
local function on_joinplayer(player)
local name = player:get_player_name()
player_list.players[name] = minetest.get_gametime()
end
local function on_leaveplayer(player)
local name = player:get_player_name()
player_list.players[name] = minetest.get_gametime()
end
minetest.register_on_joinplayer(on_joinplayer)
minetest.register_on_leaveplayer(on_leaveplayer)
minetest.register_chatcommand(
"plist",
{
params = "[ all | recent ]",
description = S("List current, recent, or all players since the last server restart"),
func = function(player_name, param)
local time = minetest.get_gametime()
local str = ""
if param == "all" then
minetest.chat_send_player(player_name, S("Players:"))
elseif param == "recent" then
str = str .. S("Recent players: ")
else
str = str .. S("Connected players: ")
end
local player_count = 0
for name, jointime in pairs(player_list.players) do
local plyr = minetest.get_player_by_name(name)
if param == "all" then
if plyr ~= nil then
player_count = player_count + 1
minetest.chat_send_player(S("@1: connected for @2", player_name, name, prettytime(time - jointime)))
else
minetest.chat_send_player(S("@1, @2: last seen @3 ago", player_name, name, prettytime(time - jointime)))
end
elseif param == "recent" then
if plyr == nil then -- Only show players that were connected but are currently disconnected
player_count = player_count + 1
if player_count == 1 then
str = str .. name
else
-- TODO: Translate comma
str = str .. ", " .. name
end
end
elseif plyr ~= nil then
player_count = player_count + 1
if player_count == 1 then
str = str .. name
else
-- TODO: Translate comma
str = str .. ", " .. name
end
end
end
minetest.chat_send_player(player_name, str)
if param == "recent" then
minetest.chat_send_player(player_name, S("Count: @1", player_count))
else
minetest.chat_send_player(player_name, S("Count: @1", player_count))
end
return true
end
})
default.log("mod:player_list", "loaded")

View File

@ -1,9 +0,0 @@
# textdomain: player_list
[all|recent]=[all|recent]
List current, recent, or all players since the last server restart=Aktuelle, neu hinzugekommene oder alle Spieler seit dem letzten Server-Neustart auflisten
Players:=Spieler:
Recent players: =Neue hinzugekommene Spieler:
Connected players: =Verbundene Spieler:
@1: connected for @2=@1: verbunden für @2
@1, @2: last seen @3 ago=@1, @2: zuletz gesehen vor @3
Count: @1=Anzahl: @1

View File

@ -1,9 +0,0 @@
# textdomain: player_list
[all|recent]=
List current, recent, or all players since the last server restart=
Players:=
Recent players: =
Connected players: =
@1: connected for @2=
@1, @2: last seen @3 ago=
Count: @1=

View File

@ -1,8 +0,0 @@
Private message mod
===================
By Kaadmy, for Pixture
Send private messages that save until the player rejoins
Private messages are cleared on server restart
Source license: LGPLv2.1

View File

@ -1 +0,0 @@
default

View File

@ -1,80 +0,0 @@
--
-- Private messages mod
-- By Kaadmy, for Pixture
--
local S = minetest.get_translator("pm")
local enable_saving = minetest.settings:get_bool("pm_enable_saving")
if enable_saving == nil then enable_saving = true end
if minetest.is_singleplayer() then
enable_saving = false
end
local messages = {}
minetest.register_chatcommand(
"pm",
{
params = S("<player> <message>"),
description = S("Send somebody a private message"),
privs = {shout=true},
func = function(name, param)
local sendto, message = param:match("^(%S+)%s(.+)$")
if not sendto then return false, S("Invalid usage, see /help pm.") end
if not minetest.get_player_by_name(sendto) then
if enable_saving then
if messages[sendto] == nil then messages[sendto] = {} end
table.insert(messages[sendto], name .. ": " .. message)
return false, S("The player @1 is not online, saving message instead.", sendto)
else
return false, S("The player @1 is not online, and PM saving is disabled.", sendto)
end
end
minetest.log("action", "PM from " .. name .. " to " .. sendto
.. ": " .. message)
minetest.chat_send_player(sendto, S("PM from @1: @2", name, message))
return true, S("PM sent.")
end
})
minetest.register_chatcommand(
"pms",
{
description = S("Show saved private messages"),
func = function(name, param)
if not enable_saving then return false, S("PM saving is disabled.") end
if messages[name] == nil then return false, S("No saved PMs.") end
minetest.chat_send_player(name, S("Saved PMs:"))
local str = ""
local amt_pms = 0
for _, msg in pairs(messages[name]) do
amt_pms = amt_pms + 1
str = str .. " " .. msg .. "\n"
end
minetest.chat_send_player(name, str)
messages[name] = nil
return true, S("@1 saved PMs", amt_pms)
end
})
if enable_saving then
minetest.register_on_joinplayer(
function(player)
local name = player:get_player_name()
if messages[name] ~= nil and #messages[name] >= 1 then
minetest.chat_send_player(name, minetest.colorize("#0ff", S("You've got mail! Number of saved PMs: @1. Enter /pms command to view.", #messages[name])))
end
end)
end
default.log("mod:pm", "loaded")

View File

@ -1,14 +0,0 @@
# textdomain: pm
<player> <message>=<Spieler> <Nachricht>
Send somebody a private message=Jemanden eine Privatnachricht senden
Invalid usage, see /help pm.=Ungültige Verwendung, siehe /help pm.
The player @1 is not online, saving message instead.=Der Spieler @1 ist nicht online, die Nachricht wird statt dessen gespeichert.
The player @1 is not online, and PM saving is disabled.=Der Spieler @1 ist nicht online, und das Speichern von PNs ist deaktiviert.
PM from @1: @2=PN von @1: @2
PM sent.=PN gesendet.
Show saved private messages=Gespeicherte Privatnachrichten zeigen
PM saving is disabled.=Speichern von PNs ist deaktiviert.
No saved PMs.=Keine gespeicherten PNs.
Saved PMs:=Gespeicherte PNs:
@1 saved PMs=@1 gespeicherte PNs
You've got mail! Number of saved PMs: @1. Enter /pms command to view.=Sie haben Post! Anzahl der gespeicherten PNs: @. „/pms“-Behel eingeben, um sie zu lesen.

View File

@ -1,14 +0,0 @@
# textdomain: pm
<player> <message>=
Send somebody a private message=
Invalid usage, see /help pm.=
The player @1 is not online, saving message instead.=
The player @1 is not online, and PM saving is disabled.=
PM from @1: @2=
PM sent.=
Show saved private messages=
PM saving is disabled.=
No saved PMs.=
Saved PMs:=
@1 saved PMs=
You've got mail! Number of saved PMs: @1. Enter /pms command to view.=