mirror of
https://github.com/mt-mods/playerfactions.git
synced 2024-11-22 07:13:50 +01:00
Port from intllib to builting MT5 client-side translation system
- Add french translations
This commit is contained in:
parent
8d6d699f45
commit
8b6730afe6
@ -32,7 +32,7 @@ This command can only be used by players with the playerfactions_admin privilege
|
|||||||
|
|
||||||
## Translations
|
## Translations
|
||||||
|
|
||||||
As mentioned below, this mod has support for `intllib`! If you know English and another language, please submit a translation! It would be greatly appreciated, and your name will be added to the acknowledgements at the bottom of this page. Thanks!
|
If you know English and another language, please submit a translation! It would be greatly appreciated, and your name will be added to the acknowledgements at the bottom of this page. Thanks!
|
||||||
|
|
||||||
## Mod integration
|
## Mod integration
|
||||||
|
|
||||||
@ -41,10 +41,6 @@ The following mods have optional support for `playerfactions`:
|
|||||||
- `areas`: Protect faction territory using areas. [link](https://github.com/minetest-mods/areas)
|
- `areas`: Protect faction territory using areas. [link](https://github.com/minetest-mods/areas)
|
||||||
- `protector`: Allow faction to be added as a member to protection blocks. [link](https://notabug.org/TenPlus1/protector)
|
- `protector`: Allow faction to be added as a member to protection blocks. [link](https://notabug.org/TenPlus1/protector)
|
||||||
|
|
||||||
Additionally, `playerfactions` can optionally depend on the following mods:
|
|
||||||
|
|
||||||
- `intllib`: Provide localizations for different languages
|
|
||||||
|
|
||||||
### Using `playerfactions` in your own mod
|
### Using `playerfactions` in your own mod
|
||||||
|
|
||||||
I strongly recommend reading through the `init.lua` file; the functions at the top give you a pretty good idea of how to use it, but just in case you're short on time I'll list the most important functions below.
|
I strongly recommend reading through the `init.lua` file; the functions at the top give you a pretty good idea of how to use it, but just in case you're short on time I'll list the most important functions below.
|
||||||
|
118
init.lua
118
init.lua
@ -1,7 +1,7 @@
|
|||||||
minetest.register_privilege("playerfactions_admin", {description = "Allow the use of all playerfactions commands",give_to_singleplayer = false})
|
-- Translation support
|
||||||
-- Load support for intllib.
|
local S = minetest.get_translator("playerfactions")
|
||||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
|
||||||
local S, NS = dofile(MP.."/intllib.lua")
|
minetest.register_privilege("playerfactions_admin", {description = S("Allow the use of all playerfactions commands"), give_to_singleplayer = false})
|
||||||
|
|
||||||
-- Data
|
-- Data
|
||||||
factions = {}
|
factions = {}
|
||||||
@ -157,23 +157,23 @@ local function handle_command(name, param)
|
|||||||
table.insert(params, p)
|
table.insert(params, p)
|
||||||
end
|
end
|
||||||
if params == nil then
|
if params == nil then
|
||||||
minetest.chat_send_player(name, S("Unknown subcommand. Run '/help factions' for help"))
|
minetest.chat_send_player(name, S("Unknown subcommand. Run '/help factions' for help."))
|
||||||
end
|
end
|
||||||
local action = params[1]
|
local action = params[1]
|
||||||
if action == "create" then
|
if action == "create" then
|
||||||
local faction_name = params[2]
|
local faction_name = params[2]
|
||||||
local password = params[3]
|
local password = params[3]
|
||||||
if factions.mode_unique_faction and factions.get_player_faction(name) ~= nil then
|
if factions.mode_unique_faction and factions.get_player_faction(name) ~= nil 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 faction_name == nil then
|
elseif faction_name == nil then
|
||||||
minetest.chat_send_player(name, S("Missing faction name"))
|
minetest.chat_send_player(name, S("Missing faction name."))
|
||||||
elseif password == nil then
|
elseif password == nil then
|
||||||
minetest.chat_send_player(name, S("Missing password"))
|
minetest.chat_send_player(name, S("Missing password."))
|
||||||
elseif facts[faction_name] ~= nil then
|
elseif facts[faction_name] ~= nil then
|
||||||
minetest.chat_send_player(name, S("That faction already exists"))
|
minetest.chat_send_player(name, S("That faction already exists."))
|
||||||
else
|
else
|
||||||
factions.register_faction(faction_name, name, password)
|
factions.register_faction(faction_name, name, password)
|
||||||
minetest.chat_send_player(name, S("Registered @1", faction_name))
|
minetest.chat_send_player(name, S("Registered @1.", faction_name))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
elseif action == "disband" then
|
elseif action == "disband" then
|
||||||
@ -182,10 +182,10 @@ local function handle_command(name, param)
|
|||||||
local own_factions = factions.get_administered_factions(name)
|
local own_factions = factions.get_administered_factions(name)
|
||||||
local number_factions = #own_factions
|
local number_factions = #own_factions
|
||||||
if number_factions == 0 then
|
if number_factions == 0 then
|
||||||
minetest.chat_send_player(name, S("You are the owner of no faction"))
|
minetest.chat_send_player(name, S("You are the owner of no faction."))
|
||||||
return false
|
return false
|
||||||
elseif #params == 1 then
|
elseif #params == 1 then
|
||||||
minetest.chat_send_player(name, S("Missing password"))
|
minetest.chat_send_player(name, S("Missing password."))
|
||||||
return false
|
return false
|
||||||
elseif #params == 2 and number_factions == 1 then
|
elseif #params == 2 and number_factions == 1 then
|
||||||
password = params[2]
|
password = params[2]
|
||||||
@ -195,18 +195,18 @@ local function handle_command(name, param)
|
|||||||
password = params[2]
|
password = params[2]
|
||||||
end
|
end
|
||||||
if password == nil then
|
if password == nil then
|
||||||
minetest.chat_send_player(name, S("Missing password"))
|
minetest.chat_send_player(name, S("Missing password."))
|
||||||
elseif faction_name == nil then
|
elseif faction_name == nil then
|
||||||
minetest.chat_send_player(name, S("You are the owner of many factions, you have to choose one of them : @1", table.concat(own_factions, ", ")))
|
minetest.chat_send_player(name, S("You are the owner of many factions, you have to choose one of them: @1.", table.concat(own_factions, ", ")))
|
||||||
elseif not facts[faction_name] then
|
elseif not facts[faction_name] then
|
||||||
minetest.chat_send_player(name, S("This faction doesn't exists"))
|
minetest.chat_send_player(name, S("This faction doesn't exists."))
|
||||||
elseif name ~= factions.get_owner(faction_name) and not minetest.get_player_privs(name).playerfactions_admin then
|
elseif name ~= factions.get_owner(faction_name) and not minetest.get_player_privs(name).playerfactions_admin then
|
||||||
minetest.chat_send_player(name, S("“Permission denied: You are not the owner of this faction, and don't have the playerfactions_admin privilege."))
|
minetest.chat_send_player(name, S("Permission denied: You are not the owner of this faction, and don't have the playerfactions_admin privilege."))
|
||||||
elseif password ~= factions.get_password(faction_name) then
|
elseif password ~= factions.get_password(faction_name) then
|
||||||
minetest.chat_send_player(name, S("Permission denied: Wrong password"))
|
minetest.chat_send_player(name, S("Permission denied: Wrong password."))
|
||||||
else
|
else
|
||||||
factions.disband_faction(faction_name)
|
factions.disband_faction(faction_name)
|
||||||
minetest.chat_send_player(name, S("Disbanded @1", faction_name))
|
minetest.chat_send_player(name, S("Disbanded @1.", faction_name))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
elseif action == "list" then
|
elseif action == "list" then
|
||||||
@ -215,9 +215,9 @@ local function handle_command(name, param)
|
|||||||
table.insert(faction_list, k)
|
table.insert(faction_list, k)
|
||||||
end
|
end
|
||||||
if #faction_list ~= 0 then
|
if #faction_list ~= 0 then
|
||||||
minetest.chat_send_player(name, "Factions("..#faction_list.."): "..table.concat(faction_list, ", "))
|
minetest.chat_send_player(name, S("Factions (@1): @2.", #faction_list, table.concat(faction_list, ", ")))
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, S("There are no factions yet"))
|
minetest.chat_send_player(name, S("There are no factions yet."))
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
elseif action == "info" then
|
elseif action == "info" then
|
||||||
@ -227,15 +227,15 @@ local function handle_command(name, param)
|
|||||||
if #player_factions == 1 then
|
if #player_factions == 1 then
|
||||||
faction_name = player_factions[1]
|
faction_name = player_factions[1]
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, S("You are in many factions, you have to choose one of them : @1", table.concat(player_factions, ", ")))
|
minetest.chat_send_player(name, S("You are in many factions, you have to choose one of them: @1.", table.concat(player_factions, ", ")))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
elseif facts[faction_name] == nil then
|
elseif facts[faction_name] == nil then
|
||||||
minetest.chat_send_player(name, S("This faction is not registered"))
|
minetest.chat_send_player(name, S("This faction doesn't exists."))
|
||||||
else
|
else
|
||||||
local fmembers = ""
|
local fmembers = ""
|
||||||
if table.getn(facts[faction_name].members) > factions.max_members_list then
|
if table.getn(facts[faction_name].members) > factions.max_members_list then
|
||||||
fmembers = S("The faction has more than @1 members, the members list can't be shown",factions.max_members_list)
|
fmembers = S("The faction has more than @1 members, the members list can't be shown.", factions.max_members_list)
|
||||||
else
|
else
|
||||||
for play,_ in pairs(facts[faction_name].members) do
|
for play,_ in pairs(facts[faction_name].members) do
|
||||||
if fmembers == "" then
|
if fmembers == "" then
|
||||||
@ -254,17 +254,17 @@ local function handle_command(name, param)
|
|||||||
local faction_name = params[2]
|
local faction_name = params[2]
|
||||||
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 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
|
||||||
minetest.chat_send_player(name, S("Permission denied: Wrong password."))
|
minetest.chat_send_player(name, S("Permission denied: Wrong password."))
|
||||||
else
|
else
|
||||||
if factions.join_faction(faction_name, name) then
|
if factions.join_faction(faction_name, name) then
|
||||||
minetest.chat_send_player(name, S("Joined @1", faction_name))
|
minetest.chat_send_player(name, S("Joined @1.", faction_name))
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, S("Error on joining"))
|
minetest.chat_send_player(name, S("Error on joining."))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -273,28 +273,28 @@ local function handle_command(name, param)
|
|||||||
local number_factions = table.getn(player_factions)
|
local number_factions = table.getn(player_factions)
|
||||||
local faction_name = nil
|
local faction_name = nil
|
||||||
if number_factions == 0 then
|
if number_factions == 0 then
|
||||||
minetest.chat_send_player(name, S("You are not in a faction"))
|
minetest.chat_send_player(name, S("You are not in a faction."))
|
||||||
return false
|
return false
|
||||||
elseif #params == 1 then
|
elseif #params == 1 then
|
||||||
if number_factions == 1 then
|
if number_factions == 1 then
|
||||||
faction_name = player_factions[1]
|
faction_name = player_factions[1]
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, S("You are in many factions, you have to choose one of them : @1", table.concat(player_factions, ", ")))
|
minetest.chat_send_player(name, S("You are in many factions, you have to choose one of them: @1.", table.concat(player_factions, ", ")))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
elseif #params >= 1 and facts[params[2]] ~= nil then
|
elseif #params >= 1 and facts[params[2]] ~= nil then
|
||||||
faction_name = params[2]
|
faction_name = params[2]
|
||||||
end
|
end
|
||||||
if faction_name == nil then
|
if faction_name == nil then
|
||||||
minetest.chat_send_player(name, "The given faction doesn't exists")
|
minetest.chat_send_player(name, S("The given faction doesn't exists."))
|
||||||
elseif factions.get_owner(faction_name) == name then
|
elseif factions.get_owner(faction_name) == name then
|
||||||
minetest.chat_send_player(name, S("You cannot leave your own faction, change owner or disband it."))
|
minetest.chat_send_player(name, S("You cannot leave your own faction, change owner or disband it."))
|
||||||
else
|
else
|
||||||
if factions.leave_faction(faction_name, name) then
|
if factions.leave_faction(faction_name, name) then
|
||||||
minetest.chat_send_player(name, S("Left @1", faction_name))
|
minetest.chat_send_player(name, S("Left @1.", faction_name))
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, S("Error on leaving faction"))
|
minetest.chat_send_player(name, S("Error on leaving faction."))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -304,7 +304,7 @@ local function handle_command(name, param)
|
|||||||
local own_factions = factions.get_administered_factions(name)
|
local own_factions = factions.get_administered_factions(name)
|
||||||
local number_factions = table.getn(own_factions)
|
local number_factions = table.getn(own_factions)
|
||||||
if number_factions == 0 then
|
if number_factions == 0 then
|
||||||
minetest.chat_send_player(name, S("You are the owner of no faction, you can't use this command"))
|
minetest.chat_send_player(name, S("You are the owner of no faction, you can't use this command."))
|
||||||
return false
|
return false
|
||||||
elseif #params == 2 and number_factions == 1 then
|
elseif #params == 2 and number_factions == 1 then
|
||||||
target = params[2]
|
target = params[2]
|
||||||
@ -314,21 +314,21 @@ local function handle_command(name, param)
|
|||||||
target = params[2]
|
target = params[2]
|
||||||
end
|
end
|
||||||
if faction_name == nil then
|
if faction_name == nil then
|
||||||
minetest.chat_send_player(name, S("You are the owner of many factions, you have to choose one of them : @1", table.concat(own_factions, ", ")))
|
minetest.chat_send_player(name, S("You are the owner of many factions, you have to choose one of them: @1.", table.concat(own_factions, ", ")))
|
||||||
elseif target == nil then
|
elseif target == nil then
|
||||||
minetest.chat_send_player(name, S("Missing player name"))
|
minetest.chat_send_player(name, S("Missing player name."))
|
||||||
elseif factions.get_owner(faction_name) ~= name and not minetest.get_player_privs(name).playerfactions_admin then
|
elseif factions.get_owner(faction_name) ~= name and not minetest.get_player_privs(name).playerfactions_admin then
|
||||||
minetest.chat_send_player(name, S("Permission denied: You are not the owner of this faction, and don't have the playerfactions_admin privilege."))
|
minetest.chat_send_player(name, S("Permission denied: You are not the owner of this faction, and don't have the playerfactions_admin privilege."))
|
||||||
elseif not facts[faction_name].members[target] then
|
elseif not facts[faction_name].members[target] then
|
||||||
minetest.chat_send_player(name, S("This player is not in the specified faction"))
|
minetest.chat_send_player(name, S("This player is not in the specified faction."))
|
||||||
elseif target == factions.get_owner(faction_name) then
|
elseif target == factions.get_owner(faction_name) then
|
||||||
minetest.chat_send_player(name, S("You cannot kick the owner of a faction, use '/factions chown <player> [faction]' to change the ownership."))
|
minetest.chat_send_player(name, S("You cannot kick the owner of a faction, use '/factions chown <player> [faction]' to change the ownership."))
|
||||||
else
|
else
|
||||||
if factions.leave_faction(faction_name, target) then
|
if factions.leave_faction(faction_name, target) then
|
||||||
minetest.chat_send_player(name, S("Kicked @1 from faction", target))
|
minetest.chat_send_player(name, S("Kicked @1 from faction.", target))
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, S("Error kicking @1 from faction", target))
|
minetest.chat_send_player(name, S("Error kicking @1 from faction.", target))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -338,10 +338,10 @@ local function handle_command(name, param)
|
|||||||
local own_factions = factions.get_administered_factions(name)
|
local own_factions = factions.get_administered_factions(name)
|
||||||
local number_factions = table.getn(own_factions)
|
local number_factions = table.getn(own_factions)
|
||||||
if #params == 1 then
|
if #params == 1 then
|
||||||
minetest.chat_send_player(name, S("Missing password"))
|
minetest.chat_send_player(name, S("Missing password."))
|
||||||
return false
|
return false
|
||||||
elseif number_factions == 0 then
|
elseif number_factions == 0 then
|
||||||
minetest.chat_send_player(name, S("You are the owner of no faction, you can't use this command"))
|
minetest.chat_send_player(name, S("You are the owner of no faction, you can't use this command."))
|
||||||
return false
|
return false
|
||||||
elseif #params == 2 and number_factions == 1 then
|
elseif #params == 2 and number_factions == 1 then
|
||||||
password = params[2]
|
password = params[2]
|
||||||
@ -351,9 +351,9 @@ local function handle_command(name, param)
|
|||||||
password = params[2]
|
password = params[2]
|
||||||
end
|
end
|
||||||
if faction_name == nil then
|
if faction_name == nil then
|
||||||
minetest.chat_send_player(name, S("You are the owner of many factions, you have to choose one of them : @1", table.concat(own_factions, ", ")))
|
minetest.chat_send_player(name, S("You are the owner of many factions, you have to choose one of them: @1.", table.concat(own_factions, ", ")))
|
||||||
elseif password == nil then
|
elseif password == nil then
|
||||||
minetest.chat_send_player(name, S("Missing password"))
|
minetest.chat_send_player(name, S("Missing password."))
|
||||||
elseif factions.get_owner(faction_name) ~= name and not minetest.get_player_privs(name).playerfactions_admin then
|
elseif factions.get_owner(faction_name) ~= name and not minetest.get_player_privs(name).playerfactions_admin then
|
||||||
minetest.chat_send_player(name, S("Permission denied: You are not the owner of this faction, and don't have the playerfactions_admin privilege."))
|
minetest.chat_send_player(name, S("Permission denied: You are not the owner of this faction, and don't have the playerfactions_admin privilege."))
|
||||||
else
|
else
|
||||||
@ -373,14 +373,14 @@ local function handle_command(name, param)
|
|||||||
local password = nil
|
local password = nil
|
||||||
if #params < 3 then
|
if #params < 3 then
|
||||||
if params[2] ~= nil and minetest.player_exists(params[2]) then
|
if params[2] ~= nil and minetest.player_exists(params[2]) then
|
||||||
minetest.chat_send_player(name,"Missing password")
|
minetest.chat_send_player(name, S("Missing password."))
|
||||||
return false
|
return false
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name,"Missing player name")
|
minetest.chat_send_player(name, S("Missing player name."))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
elseif number_factions == 0 then
|
elseif number_factions == 0 then
|
||||||
minetest.chat_send_player(name, S("You are the owner of no faction, you can't use this command"))
|
minetest.chat_send_player(name, S("You are the owner of no faction, you can't use this command."))
|
||||||
return false
|
return false
|
||||||
elseif number_factions == 1 and #params == 3 then
|
elseif number_factions == 1 and #params == 3 then
|
||||||
faction_name = own_factions[1]
|
faction_name = own_factions[1]
|
||||||
@ -392,20 +392,20 @@ local function handle_command(name, param)
|
|||||||
password = params[3]
|
password = params[3]
|
||||||
end
|
end
|
||||||
if faction_name == nil then
|
if faction_name == nil then
|
||||||
minetest.chat_send_player(name, S("You are the owner of many factions, you have to choose one of them : @1", table.concat(own_factions, ", ")))
|
minetest.chat_send_player(name, S("You are the owner of many factions, you have to choose one of them: @1.", table.concat(own_factions, ", ")))
|
||||||
elseif target == nil then
|
elseif target == nil then
|
||||||
minetest.chat_send_player(name, S("Missing player name"))
|
minetest.chat_send_player(name, S("Missing player name."))
|
||||||
elseif password == nil then
|
elseif password == nil then
|
||||||
minetest.chat_send_player(name, S("Missing password"))
|
minetest.chat_send_player(name, S("Missing password."))
|
||||||
elseif name ~= factions.get_owner(faction_name) and not minetest.get_player_privs(name).playerfactions_admin then
|
elseif name ~= factions.get_owner(faction_name) and not minetest.get_player_privs(name).playerfactions_admin then
|
||||||
minetest.chat_send_player(name, S("Permission denied: You are not the owner of this faction, and don't have the playerfactions_admin privilege."))
|
minetest.chat_send_player(name, S("Permission denied: You are not the owner of this faction, and don't have the playerfactions_admin privilege."))
|
||||||
elseif not facts[faction_name].members[target] then
|
elseif not facts[faction_name].members[target] then
|
||||||
minetest.chat_send_player(name, S("@1 isn't in your faction", target))
|
minetest.chat_send_player(name, S("@1 isn't in your faction.", target))
|
||||||
elseif password ~= factions.get_password(faction_name) then
|
elseif password ~= factions.get_password(faction_name) then
|
||||||
minetest.chat_send_player(name, S("Permission denied: Wrong password"))
|
minetest.chat_send_player(name, S("Permission denied: Wrong password."))
|
||||||
else
|
else
|
||||||
if factions.chown(faction_name, target) then
|
if factions.chown(faction_name, target) then
|
||||||
minetest.chat_send_player(name, S("Ownership has been transferred to @1", target))
|
minetest.chat_send_player(name, S("Ownership has been transferred to @1.", target))
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, S("Failed to transfer ownership."))
|
minetest.chat_send_player(name, S("Failed to transfer ownership."))
|
||||||
@ -414,19 +414,19 @@ local function handle_command(name, param)
|
|||||||
end
|
end
|
||||||
elseif action == "invite" then
|
elseif action == "invite" then
|
||||||
if not minetest.get_player_privs(name).playerfactions_admin then
|
if not minetest.get_player_privs(name).playerfactions_admin then
|
||||||
minetest.chat_send_player(name, "Permission denied: You can't use this command, playerfactions_admin priv is needed.")
|
minetest.chat_send_player(name, S("Permission denied: You can't use this command, playerfactions_admin priv is needed."))
|
||||||
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 facts[faction_name] == nil then
|
||||||
minetest.chat_send_player(name, "The faction doesn't exist")
|
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, "The player doesn't exist")
|
minetest.chat_send_player(name, S("The player doesn't exist."))
|
||||||
elseif factions.mode_unique_faction and factions.get_player_faction(target) ~= nil then
|
elseif factions.mode_unique_faction and factions.get_player_faction(target) ~= nil then
|
||||||
minetest.chat_send_player(name, S("The player is already in the faction \"@1\"",factions.get_player_faction(target)))
|
minetest.chat_send_player(name, S("The player is already in the faction \"@1\".",factions.get_player_faction(target)))
|
||||||
else
|
else
|
||||||
if factions.join_faction(faction_name, target) then
|
if factions.join_faction(faction_name, target) then
|
||||||
minetest.chat_send_player(name, S("@1 is now a member of the faction @2", target, faction_name))
|
minetest.chat_send_player(name, S("@1 is now a member of the faction @2.", target, faction_name))
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, S("Error on adding @1 into @2.", target, faction_name))
|
minetest.chat_send_player(name, S("Error on adding @1 into @2.", target, faction_name))
|
||||||
@ -435,7 +435,7 @@ local function handle_command(name, param)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(name, S("Unknown subcommand. Run '/help factions' for help"))
|
minetest.chat_send_player(name, S("Unknown subcommand. Run '/help factions' for help."))
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@ -449,8 +449,8 @@ minetest.register_chatcommand("factions", {
|
|||||||
.."kick <player> [faction]: "..S("Kick someone from your faction or from the given faction").."\n"
|
.."kick <player> [faction]: "..S("Kick someone from your faction or from the given faction").."\n"
|
||||||
.."disband <password> [faction]: "..S("Disband your faction or the given faction").."\n"
|
.."disband <password> [faction]: "..S("Disband your faction or the given faction").."\n"
|
||||||
.."passwd <password> [faction]: "..S("Change your faction's password or the password of the given faction").."\n"
|
.."passwd <password> [faction]: "..S("Change your faction's password or the password of the given faction").."\n"
|
||||||
.."chown <player> [faction]:"..S("Transfer ownership of your faction").."\n"
|
.."chown <player> [faction]: "..S("Transfer ownership of your faction").."\n"
|
||||||
.."invite <player> <faction>:"..S("Add player to a faction, you need factionsplayer_admin privs").."\n",
|
.."invite <player> <faction>: "..S("Add player to a faction, you need factionsplayer_admin privs").."\n",
|
||||||
|
|
||||||
description = "",
|
description = "",
|
||||||
privs = {},
|
privs = {},
|
||||||
|
45
intllib.lua
45
intllib.lua
@ -1,45 +0,0 @@
|
|||||||
|
|
||||||
-- Fallback functions for when `intllib` is not installed.
|
|
||||||
-- Code released under Unlicense <http://unlicense.org>.
|
|
||||||
|
|
||||||
-- Get the latest version of this file at:
|
|
||||||
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
|
|
||||||
|
|
||||||
local function format(str, ...)
|
|
||||||
local args = { ... }
|
|
||||||
local function repl(escape, open, num, close)
|
|
||||||
if escape == "" then
|
|
||||||
local replacement = tostring(args[tonumber(num)])
|
|
||||||
if open == "" then
|
|
||||||
replacement = replacement..close
|
|
||||||
end
|
|
||||||
return replacement
|
|
||||||
else
|
|
||||||
return "@"..open..num..close
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
|
|
||||||
end
|
|
||||||
|
|
||||||
local gettext, ngettext
|
|
||||||
if minetest.get_modpath("intllib") then
|
|
||||||
if intllib.make_gettext_pair then
|
|
||||||
-- New method using gettext.
|
|
||||||
gettext, ngettext = intllib.make_gettext_pair()
|
|
||||||
else
|
|
||||||
-- Old method using text files.
|
|
||||||
gettext = intllib.Getter()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Fill in missing functions.
|
|
||||||
|
|
||||||
gettext = gettext or function(msgid, ...)
|
|
||||||
return format(msgid, ...)
|
|
||||||
end
|
|
||||||
|
|
||||||
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
|
|
||||||
return format(n==1 and msgid or msgid_plural, ...)
|
|
||||||
end
|
|
||||||
|
|
||||||
return gettext, ngettext
|
|
2
mod.conf
2
mod.conf
@ -1,2 +1,2 @@
|
|||||||
name = playerfactions
|
name = playerfactions
|
||||||
optional_depends = intllib
|
min_minetest_version = 5.0.0
|
||||||
|
Loading…
Reference in New Issue
Block a user