Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make /lua and /luatransform administrator-only
  • Loading branch information
ShadowNinja committed Jan 21, 2014
1 parent 86d35e9 commit f8d3614
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions worldedit_commands/init.lua
Expand Up @@ -1051,6 +1051,12 @@ minetest.register_chatcommand("/lua", {
description = "Executes <code> as a Lua chunk in the global namespace",
privs = {worldedit=true, server=true},
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)
if err then
worldedit.player_notify(name, "code error: " .. err)
Expand All @@ -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",
privs = {worldedit=true, server=true},
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]
if pos1 == nil or pos2 == nil then
worldedit.player_notify(name, "no region selected")
Expand Down

0 comments on commit f8d3614

Please sign in to comment.