forked from VoxeLibre/VoxeLibre
strip newlines from tools in death messages
Players naming their tools with newlines can mess up chat with death messages. This commit strips out newlines (\r and \n ) in the tool name for death messages.
This commit is contained in:
parent
c08f9850f6
commit
5252952555
|
@ -3,11 +3,11 @@ local N = function(s) return s end
|
||||||
|
|
||||||
local function get_tool_name(item)
|
local function get_tool_name(item)
|
||||||
local name = item:get_meta():get_string("name")
|
local name = item:get_meta():get_string("name")
|
||||||
if name ~= "" then
|
if name == "" then
|
||||||
return name
|
|
||||||
end
|
|
||||||
local def = item:get_definition()
|
local def = item:get_definition()
|
||||||
return def._tt_original_description or def.description
|
name=def._tt_original_description or def.description
|
||||||
|
end
|
||||||
|
return name:gsub("[\r\n]"," ")
|
||||||
end
|
end
|
||||||
|
|
||||||
mcl_death_messages = {}
|
mcl_death_messages = {}
|
||||||
|
|
Loading…
Reference in New Issue