mirror of
https://notabug.org/TenPlus1/protector.git
synced 2025-01-08 11:47:30 +01:00
added delprot command to remove protectors in bulk from banned/old players
This commit is contained in:
parent
fdfec1fd4a
commit
9387e6f0b7
@ -28,4 +28,5 @@ Released under WTFPL
|
|||||||
1.3 - Moved protector on_place into node itself, protector zone display changed
|
1.3 - Moved protector on_place into node itself, protector zone display changed
|
||||||
from 10 to 5 seconds, general code tidy
|
from 10 to 5 seconds, general code tidy
|
||||||
1.4 - Changed protector recipes to give single item instead of 4, added + button
|
1.4 - Changed protector recipes to give single item instead of 4, added + button
|
||||||
to interface, tweaked and tidied code
|
to interface, tweaked and tidied code, added admin command /delprot to remove
|
||||||
|
protectors in bulk from banned/old players
|
59
admin.lua
Normal file
59
admin.lua
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
|
||||||
|
protector.removal_names = ""
|
||||||
|
|
||||||
|
minetest.register_chatcommand("delprot", {
|
||||||
|
params = "",
|
||||||
|
description = "Remove Protectors near players with names provided (separate names with spaces)",
|
||||||
|
privs = {server = true},
|
||||||
|
func = function(name, param)
|
||||||
|
|
||||||
|
if not param or param == "" then
|
||||||
|
|
||||||
|
minetest.chat_send_player(name,
|
||||||
|
"Protector Names to remove: "
|
||||||
|
.. protector.removal_names)
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if param == "-" then
|
||||||
|
minetest.chat_send_player(name,
|
||||||
|
"Name List Reset")
|
||||||
|
|
||||||
|
protector.removal_names = ""
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
protector.removal_names = param
|
||||||
|
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"protector:protect", "protector:protect2"},
|
||||||
|
interval = 8,
|
||||||
|
chance = 1,
|
||||||
|
catch_up = false,
|
||||||
|
action = function(pos, node)
|
||||||
|
|
||||||
|
if protector.removal_names == "" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local owner = meta:get_string("owner")
|
||||||
|
--local members = meta:get_string("members")
|
||||||
|
|
||||||
|
local names = protector.removal_names:split(" ")
|
||||||
|
|
||||||
|
for _, n in ipairs(names) do
|
||||||
|
|
||||||
|
if n == owner then
|
||||||
|
minetest.set_node(pos, {name = "air"})
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
})
|
1
init.lua
1
init.lua
@ -499,5 +499,6 @@ minetest.register_node("protector:display_node", {
|
|||||||
|
|
||||||
dofile(minetest.get_modpath("protector") .. "/doors_chest.lua")
|
dofile(minetest.get_modpath("protector") .. "/doors_chest.lua")
|
||||||
dofile(minetest.get_modpath("protector") .. "/pvp.lua")
|
dofile(minetest.get_modpath("protector") .. "/pvp.lua")
|
||||||
|
dofile(minetest.get_modpath("protector") .. "/admin.lua")
|
||||||
|
|
||||||
print ("[MOD] Protector Redo loaded")
|
print ("[MOD] Protector Redo loaded")
|
Loading…
Reference in New Issue
Block a user