Skip to content

Commit

Permalink
commandblock: don't allow sending colored text if server forbids it (#28
Browse files Browse the repository at this point in the history
)
  • Loading branch information
fluxionary authored May 26, 2024
1 parent 9338418 commit e72790f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion moremesecons_commandblock/init.lua
Original file line number Diff line number Diff line change
@@ -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)

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e72790f

Please sign in to comment.