mirror of
https://github.com/mt-mods/playerfactions.git
synced 2024-12-01 11:43:46 +01:00
some more checks in some API methods
This commit is contained in:
parent
b47198299b
commit
e4851ade83
8
init.lua
8
init.lua
@ -170,8 +170,8 @@ function factions.get_password()
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if not facts[fname] then
|
|
||||||
function factions.set_password(faction_name, password)
|
function factions.set_password(faction_name, password)
|
||||||
|
if not (facts[faction_name] and 'string' == type(password)) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
facts[faction_name].password256 = factions.hash_password(password)
|
facts[faction_name].password256 = factions.hash_password(password)
|
||||||
@ -179,8 +179,9 @@ function factions.set_password(faction_name, password)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if not (facts[fname] and minetest.player_exists(player)) then
|
|
||||||
function factions.join_faction(faction_name, player_name)
|
function factions.join_faction(faction_name, player_name)
|
||||||
|
if not (facts[faction_name] and 'string' == type(player_name)
|
||||||
|
and minetest.player_exists(player_name)) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
facts[faction_name].members[player_name] = true
|
facts[faction_name].members[player_name] = true
|
||||||
@ -188,8 +189,9 @@ function factions.join_faction(faction_name, player_name)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if not (facts[fname] and minetest.player_exists(player_name)) then
|
|
||||||
function factions.leave_faction(faction_name, player_name)
|
function factions.leave_faction(faction_name, player_name)
|
||||||
|
if not (facts[faction_name] and 'string' == type(player_name)
|
||||||
|
and minetest.player_exists(player_name)) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
facts[faction_name].members[player_name] = nil
|
facts[faction_name].members[player_name] = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user