From 57de70a11147bed6e747cc545ab7b01913daff97 Mon Sep 17 00:00:00 2001
From: James Stevenson <everamzah@gmail.com>
Date: Sun, 10 Jul 2016 10:53:29 -0400
Subject: [PATCH] Add lava bucket guarding

---
 depends.txt |  1 +
 init.lua    | 16 +++++++++++++++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/depends.txt b/depends.txt
index 4ad96d5..6cf00e8 100644
--- a/depends.txt
+++ b/depends.txt
@@ -1 +1,2 @@
 default
+bucket
diff --git a/init.lua b/init.lua
index 31e813f..9e3312c 100644
--- a/init.lua
+++ b/init.lua
@@ -1,9 +1,23 @@
 minetest.register_privilege("liquid", "Can place liquid source nodes.")
+minetest.register_privilege("lava", "Can use liquid igniters.")
+
+local old_lava_bucket_place = minetest.registered_items["bucket:bucket_lava"].on_place
+
+minetest.override_item("bucket:bucket_lava", {
+	on_place = function(itemstack, placer, pointed_thing)
+		if not minetest.check_player_privs(placer:get_player_name(),
+				{lava = true}) then
+			return itemstack
+		else
+			return old_lava_bucket_place(itemstack, placer, pointed_thing)
+		end
+	end,
+})
 
 minetest.override_item("default:lava_source", {
 	after_place_node = function(pos, placer, itemstack, pointed_thing)
 		if not minetest.check_player_privs(placer:get_player_name(),
-				{liquid = true}) then
+				{liquid = true, lava = true}) then
 			minetest.remove_node(pos)
 		end
 	end,