commandblock: don't allow sending colored text if server forbids it (#28)

This commit is contained in:
fluxionary 2024-05-26 08:39:51 -07:00 committed by GitHub
parent 93384188d5
commit e72790f0eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,3 +1,5 @@
local strip_color_codes = minetest.settings:get_bool("strip_color_codes", false)
local function initialize_data(meta)
local NEAREST_MAX_DISTANCE = moremesecons.setting("commandblock", "nearest_max_distance", 8, 1)
@ -46,7 +48,11 @@ local function receive_fields(pos, _, fields, player)
and player:get_player_name() ~= owner then
return
end
meta:set_string("commands", fields.commands)
if strip_color_codes then
meta:set_string("commands", minetest.strip_colors(fields.commands))
else
meta:set_string("commands", fields.commands)
end
initialize_data(meta)
end