aboutsummaryrefslogtreecommitdiff
path: root/advtrains
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2017-05-22 15:47:25 +0200
committerorwell96 <mono96.mml@gmail.com>2017-05-22 16:18:24 +0200
commit74c8784b21c635ae310773e7105d22e3928a049a (patch)
tree6210b34c9da47344140ab6bce4d59fa76db49dc6 /advtrains
parentd22b9fb011820bddd3baa7f39c76f5da41777c4f (diff)
downloadadvtrains-74c8784b21c635ae310773e7105d22e3928a049a.tar.gz
advtrains-74c8784b21c635ae310773e7105d22e3928a049a.tar.bz2
advtrains-74c8784b21c635ae310773e7105d22e3928a049a.zip
Fix command + Update zip file - Version 1.8
Diffstat (limited to 'advtrains')
-rw-r--r--advtrains/advtrains/nodedb.lua16
1 files changed, 9 insertions, 7 deletions
diff --git a/advtrains/advtrains/nodedb.lua b/advtrains/advtrains/nodedb.lua
index 8103b13..7ebf755 100644
--- a/advtrains/advtrains/nodedb.lua
+++ b/advtrains/advtrains/nodedb.lua
@@ -281,7 +281,7 @@ end
advtrains.ndb=ndb
-local ptime
+local ptime=0
minetest.register_chatcommand("at_restore_ndb",
{
@@ -289,12 +289,14 @@ minetest.register_chatcommand("at_restore_ndb",
description = "Write node db back to map", -- Full description
privs = {train_operator=true, worldedit=true}, -- Require the "privs" privilege to run
func = function(name, param)
- if not minetest.check_player_privs(name, {server=true}) and os.time() < ptime+30 then
- return false, "Please wait at least 30s from the previous execution of /at_restore_ndb!"
- end
- ndb.restore_all()
- ptime=os.time()
- return true
+ return advtrains.pcall(function()
+ if not minetest.check_player_privs(name, {server=true}) and os.time() < ptime+30 then
+ return false, "Please wait at least 30s from the previous execution of /at_restore_ndb!"
+ end
+ ndb.restore_all()
+ ptime=os.time()
+ return true
+ end)
end,
})