Add server privs restriction to mcl_villages build tool #4043
No reviewers
Labels
No Label
#P1 CRITICAL
#P2: HIGH
#P3: elevated
#P4 priority: medium
#P6: low
#Review
annoying
API
bug
code quality
combat
commands
compatibility
configurability
contribution inside
controls
core feature
creative mode
delayed for engine release
documentation
duplicate
enhancement
environment
feature request
gameplay
graphics
ground content conflict
GUI/HUD
help wanted
incomplete feature
invalid / won't fix
items
looking for contributor
mapgen
meta
mineclone2+
Minecraft >= 1.13
Minecraft >= 1.17
missing feature
mobile
mobs
mod support
model needed
multiplayer
Needs adoption
needs discussion
needs engine change
needs more information
needs research
nodes
non-mob entities
performance
player
possible close
redstone
release notes
schematics
Skyblock
sounds
Testing / Retest
tools
translation
unconfirmed
mcl5
mcla
Media missing
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: VoxeLibre/VoxeLibre#4043
Loading…
Reference in New Issue
No description provided.
Delete Branch "Eliy21/MineClone2:restrict_villages_tool_privs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
e7704fc9bc
tof14cff4649
@ -130,1 +130,4 @@
if not pointed_thing.under then return end
local name = placer:get_player_name()
local privs = minetest.get_player_privs(name)
if not privs.server then
why are you getting the name of the player, then all their privileges, just to finally check if the resulting table contains a single value?
I suggest the use of
minetest.check_player_privs(placer, "server")
For reference: https://github.com/minetest/minetest/blob/master/doc/lua_api.md#authentication
I just copied the placing barriers code. Now edited the code to your suggestion.
@ -131,0 +131,4 @@
local name = placer:get_player_name()
local privs = minetest.get_player_privs(name)
if not privs.server then
minetest.chat_send_player(name, "Placement denied. You need the “server” privilege to place villages.")
Please use minetest's translation functionality for messages sent to the player, and update the template.
Oh, and, while ofc you don't have to update all languages, in german, it'd be
There's no German translation file so I made one and placed your suggested translation there while using DeepL translation on the rest.
Oops, sorry, didn't notice, anyways, thanks for updating the template
@ -131,0 +132,4 @@
local privs = minetest.get_player_privs(name)
if not privs.server then
minetest.chat_send_player(name, "Placement denied. You need the “server” privilege to place villages.")
return itemstack
I don't quite get why you return the itemstack, that technically modifies the inventory.
Might be better just to return without any values
Just copied the code and tested that it works and just left it there. Now itemstack is removed per your suggestion.
@ -0,0 +1,4 @@
# textdomain: mcl_villages
Chiseled Stone Village Bricks=Dorfziegel aus gemeißeltem Stein
mcl_villages build tool=mcl_villages Werkzeug erstellen
There's a grammar mistake in here, should just "mcl_villages Konstruktionswerkzeug"… anyways, I don't want to further bother you with the German language, wouldn't have raised the point if I knew there wasn't a translation before.
I cannot push to your branch, but, in case the PR isn't merged already when you are reading this, here is a patch you can just apply (it's basically like handing you a (or multiple) git commits in file form).
You could apply it by placing the file below in your git repository and running
git am < 0001-fix-german-grammar-mistake-in-mcl_villages.patch
, simply push afterwards...Looks like you can actually do it in the GUI, though I don't recommend doing git stuff using it that much
FYI I don't see any patch attachment in this comment.
New commits pushed, approval review dismissed automatically according to repository settings
Oops I thought I could just commit the changes myself sorry. Next time I'll check the "allow edit" for my PRs in the future.
fad2c892b9
tod53e819a47
Merged a squashed version of your PR as I thought having 10 commits for this might be a bit overkill ;)