Minetest-WorldEditAdditions/worldeditadditions_commands/player_notify_suppress.lua

21 lines
673 B
Lua
Raw Normal View History

2020-06-26 20:15:13 +00:00
-- Overrides worldedit.player_notify() to add the ability to
-- suppress messages (used in //subdivide)
local player_notify_suppressed = {}
local orig_player_notify = worldedit.player_notify
2024-10-17 01:34:31 +00:00
function worldedit.player_notify(name, message, typ)
2020-06-26 20:15:13 +00:00
if not player_notify_suppressed[name] then
2024-10-17 01:34:31 +00:00
orig_player_notify(name, message, typ)
2020-06-26 20:15:13 +00:00
end
end
--- Disables sending worldedit messages to the player with the given name.
function worldedit.player_notify_suppress(name)
player_notify_suppressed[name] = true
end
--- Enables sending worldedit messages to the player with the given name.
function worldedit.player_notify_unsuppress(name)
player_notify_suppressed[name] = nil
end