Add server privs restriction to mcl_villages build tool (#4043)

<!--
Please follow our contributing guidelines first:
https://git.minetest.land/MineClone2/MineClone2/src/branch/master/CONTRIBUTING.md#how-you-can-help-as-a-programmer

By submitting this pull request, you agree to follow our Code of Conduct:
https://git.minetest.land/MineClone2/MineClone2/src/branch/master/CODE_OF_CONDUCT.md
-->

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 <chmodsayshello@hotmail.com>
Co-authored-by: Eliy21 <eliy21@noreply.git.minetest.land>
Co-committed-by: Eliy21 <eliy21@noreply.git.minetest.land>
Eliy21 2023-12-05 12:49:49 +00:00 committed by chmodsayshello
parent 86dad4693e
commit 4127d120d2
6 changed files with 16 additions and 4 deletions

@ -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))

@ -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.

@ -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
Placement denied. You need the “server” privilege to place villages.=Placement refusé. Vous devez disposer du privilège "server" pour placer des villages.

@ -1,3 +1,4 @@
# textdomain: mcl_villages
Chiseled Stone Village Bricks=模様入り石村レンガ
mcl_villages build tool=mcl_villages 構築ツール
Placement denied. You need the “server” privilege to place villages.=配置が拒否されました。村の配置には「server」権限が必要です。

@ -1,3 +1,4 @@
# textdomain: mcl_villages
Chiseled Stone Village Bricks=Резные деревенские каменные кирпичи
mcl_villages build tool=Инструмент постройки деревни
Placement denied. You need the “server” privilege to place villages.=Размещение запрещено. Для размещения деревень необходима привилегия "server".

@ -1,3 +1,4 @@
# textdomain: mcl_villages
Chiseled Stone Village Bricks=
mcl_villages build tool=
Placement denied. You need the “server” privilege to place villages.=