diff options
author | Anthony <azhang9@gmail.com> | 2014-01-21 18:42:16 -0800 |
---|---|---|
committer | Anthony <azhang9@gmail.com> | 2014-01-21 18:42:16 -0800 |
commit | 829f9eef73b5fe22963f53bb1313351c3e3653f4 (patch) | |
tree | 1130cc469c7c921203bcec6f83e10a195645cf04 | |
parent | 86d35e97bf884100c208e0452a242a70ddb75148 (diff) | |
parent | f8d3614a32db472c59fce1c9692ef854798d88eb (diff) |
Merge pull request #32 from ShadowNinja/admin-only-lua
Make /lua and /luatransform administrator-only
-rw-r--r-- | worldedit_commands/init.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/worldedit_commands/init.lua b/worldedit_commands/init.lua index ab58572..409e49b 100644 --- a/worldedit_commands/init.lua +++ b/worldedit_commands/init.lua @@ -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)
@@ -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")
|