mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2024-12-25 18:20:38 +01:00
Make /lua and /luatransform administrator-only
This commit is contained in:
parent
86d35e97bf
commit
f8d3614a32
@ -1051,6 +1051,12 @@ minetest.register_chatcommand("/lua", {
|
|||||||
description = "Executes <code> as a Lua chunk in the global namespace",
|
description = "Executes <code> as a Lua chunk in the global namespace",
|
||||||
privs = {worldedit=true, server=true},
|
privs = {worldedit=true, server=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
|
local admin = minetest.setting_get("name")
|
||||||
|
if not admin or not name == admin then
|
||||||
|
worldedit.player_notify(name, "This command can only"
|
||||||
|
.." be run by the server administrator")
|
||||||
|
return
|
||||||
|
end
|
||||||
local err = worldedit.lua(param)
|
local err = worldedit.lua(param)
|
||||||
if err then
|
if err then
|
||||||
worldedit.player_notify(name, "code error: " .. err)
|
worldedit.player_notify(name, "code error: " .. err)
|
||||||
@ -1065,6 +1071,12 @@ minetest.register_chatcommand("/luatransform", {
|
|||||||
description = "Executes <code> as a Lua chunk in the global namespace with the variable pos available, for each node in the current WorldEdit region",
|
description = "Executes <code> as a Lua chunk in the global namespace with the variable pos available, for each node in the current WorldEdit region",
|
||||||
privs = {worldedit=true, server=true},
|
privs = {worldedit=true, server=true},
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
|
local admin = minetest.setting_get("name")
|
||||||
|
if not admin or not name == admin then
|
||||||
|
worldedit.player_notify(name, "This command can only"
|
||||||
|
.." be run by the server administrator")
|
||||||
|
return
|
||||||
|
end
|
||||||
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
|
||||||
if pos1 == nil or pos2 == nil then
|
if pos1 == nil or pos2 == nil then
|
||||||
worldedit.player_notify(name, "no region selected")
|
worldedit.player_notify(name, "no region selected")
|
||||||
|
Loading…
Reference in New Issue
Block a user