From 4127d120d25a7fa18dfd1d49feaf0ef2110489d6 Mon Sep 17 00:00:00 2001 From: Eliy21 Date: Tue, 5 Dec 2023 12:49:49 +0000 Subject: [PATCH] Add server privs restriction to mcl_villages build tool (#4043) Fixes #4022 ### Testing -Make a new world, check host server and go into creative mode -Since you're the server you have the server privs so get the mcl_villages build tool item in creative inventory and use it to see if it works -Have someone join your server and give them the same item to use and see if they are restricted from using it Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/4043 Reviewed-by: chmodsayshello Co-authored-by: Eliy21 Co-committed-by: Eliy21 --- mods/MAPGEN/mcl_villages/init.lua | 4 ++++ mods/MAPGEN/mcl_villages/locale/mcl_villages.de.tr | 4 ++++ mods/MAPGEN/mcl_villages/locale/mcl_villages.fr.tr | 3 ++- mods/MAPGEN/mcl_villages/locale/mcl_villages.ja.tr | 3 ++- mods/MAPGEN/mcl_villages/locale/mcl_villages.ru.tr | 3 ++- mods/MAPGEN/mcl_villages/locale/template.txt | 3 ++- 6 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 mods/MAPGEN/mcl_villages/locale/mcl_villages.de.tr diff --git a/mods/MAPGEN/mcl_villages/init.lua b/mods/MAPGEN/mcl_villages/init.lua index 0cb0712b5..6662f6bd1 100644 --- a/mods/MAPGEN/mcl_villages/init.lua +++ b/mods/MAPGEN/mcl_villages/init.lua @@ -128,6 +128,10 @@ if minetest.is_creative_enabled("") then -- build ssettlement on_place = function(itemstack, placer, pointed_thing) if not pointed_thing.under then return end + if not minetest.check_player_privs(placer, "server") then + minetest.chat_send_player(placer:get_player_name(), S("Placement denied. You need the “server” privilege to place villages.")) + return + end local minp = vector.subtract( pointed_thing.under, half_map_chunk_size) local maxp = vector.add( pointed_thing.under, half_map_chunk_size) build_a_settlement(minp, maxp, math.random(0,32767)) diff --git a/mods/MAPGEN/mcl_villages/locale/mcl_villages.de.tr b/mods/MAPGEN/mcl_villages/locale/mcl_villages.de.tr new file mode 100644 index 000000000..6a8f1f681 --- /dev/null +++ b/mods/MAPGEN/mcl_villages/locale/mcl_villages.de.tr @@ -0,0 +1,4 @@ +# textdomain: mcl_villages +Chiseled Stone Village Bricks=Dorfziegel aus gemeißeltem Stein +mcl_villages build tool=mcl_villages Konstruktionswerkzeug +Placement denied. You need the “server” privilege to place villages.=Platzierung verweigert. Sie benötigen das "server" Privileg, um Dörfer zu platzieren. \ No newline at end of file diff --git a/mods/MAPGEN/mcl_villages/locale/mcl_villages.fr.tr b/mods/MAPGEN/mcl_villages/locale/mcl_villages.fr.tr index b648cd36c..af1d0ab49 100644 --- a/mods/MAPGEN/mcl_villages/locale/mcl_villages.fr.tr +++ b/mods/MAPGEN/mcl_villages/locale/mcl_villages.fr.tr @@ -1,3 +1,4 @@ # textdomain: mcl_villages Chiseled Stone Village Bricks=Pierre sculptée du village -mcl_villages build tool=outil de construction de mcl_villages \ No newline at end of file +mcl_villages build tool=outil de construction de mcl_villages +Placement denied. You need the “server” privilege to place villages.=Placement refusé. Vous devez disposer du privilège "server" pour placer des villages. \ No newline at end of file diff --git a/mods/MAPGEN/mcl_villages/locale/mcl_villages.ja.tr b/mods/MAPGEN/mcl_villages/locale/mcl_villages.ja.tr index 4d0e4794f..6a63a577d 100644 --- a/mods/MAPGEN/mcl_villages/locale/mcl_villages.ja.tr +++ b/mods/MAPGEN/mcl_villages/locale/mcl_villages.ja.tr @@ -1,3 +1,4 @@ # textdomain: mcl_villages Chiseled Stone Village Bricks=模様入り石村レンガ -mcl_villages build tool=mcl_villages 構築ツール \ No newline at end of file +mcl_villages build tool=mcl_villages 構築ツール +Placement denied. You need the “server” privilege to place villages.=配置が拒否されました。村の配置には「server」権限が必要です。 \ No newline at end of file diff --git a/mods/MAPGEN/mcl_villages/locale/mcl_villages.ru.tr b/mods/MAPGEN/mcl_villages/locale/mcl_villages.ru.tr index 525e5811b..021bd78f1 100644 --- a/mods/MAPGEN/mcl_villages/locale/mcl_villages.ru.tr +++ b/mods/MAPGEN/mcl_villages/locale/mcl_villages.ru.tr @@ -1,3 +1,4 @@ # textdomain: mcl_villages Chiseled Stone Village Bricks=Резные деревенские каменные кирпичи -mcl_villages build tool=Инструмент постройки деревни \ No newline at end of file +mcl_villages build tool=Инструмент постройки деревни +Placement denied. You need the “server” privilege to place villages.=Размещение запрещено. Для размещения деревень необходима привилегия "server". \ No newline at end of file diff --git a/mods/MAPGEN/mcl_villages/locale/template.txt b/mods/MAPGEN/mcl_villages/locale/template.txt index 464daea9b..c410f4837 100644 --- a/mods/MAPGEN/mcl_villages/locale/template.txt +++ b/mods/MAPGEN/mcl_villages/locale/template.txt @@ -1,3 +1,4 @@ # textdomain: mcl_villages Chiseled Stone Village Bricks= -mcl_villages build tool= \ No newline at end of file +mcl_villages build tool= +Placement denied. You need the “server” privilege to place villages.= \ No newline at end of file