mirror of
https://github.com/mt-mods/playerfactions.git
synced 2024-11-22 15:23:47 +01:00
Merge pull request #2 from IRI-Research/master
Add checks on command args to avoid server crashes
This commit is contained in:
commit
18eef7c90e
12
init.lua
12
init.lua
@ -287,6 +287,10 @@ local function handle_command(name, param)
|
|||||||
end
|
end
|
||||||
elseif action == "player_info" then
|
elseif action == "player_info" then
|
||||||
local player_name = params[2]
|
local player_name = params[2]
|
||||||
|
if not player_name then
|
||||||
|
minetest.chat_send_player(name, S("The player name is nil or empty."))
|
||||||
|
return false
|
||||||
|
end
|
||||||
local player_factions = factions.get_player_factions(player_name)
|
local player_factions = factions.get_player_factions(player_name)
|
||||||
if not player_factions then
|
if not player_factions then
|
||||||
minetest.chat_send_player(name, S("This player doesn't exists or is in no faction"))
|
minetest.chat_send_player(name, S("This player doesn't exists or is in no faction"))
|
||||||
@ -324,6 +328,8 @@ local function handle_command(name, param)
|
|||||||
local password = params[3]
|
local password = params[3]
|
||||||
if factions.get_player_faction(name) ~= nil and factions.mode_unique_faction then
|
if factions.get_player_faction(name) ~= nil and factions.mode_unique_faction then
|
||||||
minetest.chat_send_player(name, S("You are already in a faction."))
|
minetest.chat_send_player(name, S("You are already in a faction."))
|
||||||
|
elseif not faction_name then
|
||||||
|
minetest.chat_send_player(name, S("Missing faction name."))
|
||||||
elseif facts[faction_name] == nil then
|
elseif facts[faction_name] == nil then
|
||||||
minetest.chat_send_player(name, S("The faction @1 doesn't exist.", faction_name))
|
minetest.chat_send_player(name, S("The faction @1 doesn't exist.", faction_name))
|
||||||
elseif factions.get_password(faction_name) ~= password then
|
elseif factions.get_password(faction_name) ~= password then
|
||||||
@ -487,7 +493,11 @@ local function handle_command(name, param)
|
|||||||
else
|
else
|
||||||
local target = params[2]
|
local target = params[2]
|
||||||
local faction_name = params[3]
|
local faction_name = params[3]
|
||||||
if facts[faction_name] == nil then
|
if not target then
|
||||||
|
minetest.chat_send_player(name, S("Missing target."))
|
||||||
|
elseif not faction_name then
|
||||||
|
minetest.chat_send_player(name, S("Missing faction name."))
|
||||||
|
elseif facts[faction_name] == nil then
|
||||||
minetest.chat_send_player(name, S("The faction @1 doesn't exist.", faction_name))
|
minetest.chat_send_player(name, S("The faction @1 doesn't exist.", faction_name))
|
||||||
elseif not minetest.player_exists(target) then
|
elseif not minetest.player_exists(target) then
|
||||||
minetest.chat_send_player(name, S("The player doesn't exist."))
|
minetest.chat_send_player(name, S("The player doesn't exist."))
|
||||||
|
@ -33,6 +33,7 @@ List available factions=Liste les factions disponibles
|
|||||||
Missing faction name.=Nom de faction manquant.
|
Missing faction name.=Nom de faction manquant.
|
||||||
Missing password.=Mot de passe manquant.
|
Missing password.=Mot de passe manquant.
|
||||||
Missing player name.=Nom de joueur manquant.
|
Missing player name.=Nom de joueur manquant.
|
||||||
|
Missing target.=Nom du joueur cible manquant.
|
||||||
Name: @1@nOwner: @2@nMembers: @3=Nom : @1@nPropriétaire : @2@nMembres : @3
|
Name: @1@nOwner: @2@nMembers: @3=Nom : @1@nPropriétaire : @2@nMembres : @3
|
||||||
Ownership has been transferred to @1.=La propriété a été transférée à @2.
|
Ownership has been transferred to @1.=La propriété a été transférée à @2.
|
||||||
Password has been updated.=Le mot de passe a été mis à jour.
|
Password has been updated.=Le mot de passe a été mis à jour.
|
||||||
@ -56,6 +57,7 @@ The player doesn't exist.=Le joueur n’existe pas.
|
|||||||
The player is already in the faction "@1".=Le joueur est déjà dans la faction "@1".
|
The player is already in the faction "@1".=Le joueur est déjà dans la faction "@1".
|
||||||
There are no factions yet.=Il n’y a pas encore de factions.
|
There are no factions yet.=Il n’y a pas encore de factions.
|
||||||
This faction doesn't exists.=Cette faction n’existe pas.
|
This faction doesn't exists.=Cette faction n’existe pas.
|
||||||
|
The player name is nil or empty.=Le nom du joueur est nul ou vide.
|
||||||
This player doesn't exists or is in no faction=Ce joueur n’existe pas ou n’est dans aucune faction.
|
This player doesn't exists or is in no faction=Ce joueur n’existe pas ou n’est dans aucune faction.
|
||||||
This player is not in the specified faction.=Le joueur n’est pas dans la faction spécifiée.
|
This player is not in the specified faction.=Le joueur n’est pas dans la faction spécifiée.
|
||||||
This player is the owner of no faction.=Ce joueur n’est propriétaire d’aucune faction.
|
This player is the owner of no faction.=Ce joueur n’est propriétaire d’aucune faction.
|
||||||
|
@ -33,6 +33,7 @@ List available factions=
|
|||||||
Missing faction name.=
|
Missing faction name.=
|
||||||
Missing password.=
|
Missing password.=
|
||||||
Missing player name.=
|
Missing player name.=
|
||||||
|
Missing target.=
|
||||||
Name: @1@nOwner: @2@nMembers: @3=
|
Name: @1@nOwner: @2@nMembers: @3=
|
||||||
Ownership has been transferred to @1.=
|
Ownership has been transferred to @1.=
|
||||||
Password has been updated.=
|
Password has been updated.=
|
||||||
@ -56,6 +57,7 @@ The player doesn't exist.=
|
|||||||
The player is already in the faction "@1".=
|
The player is already in the faction "@1".=
|
||||||
There are no factions yet.=
|
There are no factions yet.=
|
||||||
This faction doesn't exists.=
|
This faction doesn't exists.=
|
||||||
|
The player name is nil or empty.=
|
||||||
This player doesn't exists or is in no faction=
|
This player doesn't exists or is in no faction=
|
||||||
This player is not in the specified faction.=
|
This player is not in the specified faction.=
|
||||||
This player is the owner of no faction.=
|
This player is the owner of no faction.=
|
||||||
|
Loading…
Reference in New Issue
Block a user