diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3d311a8..94c1c38 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,6 +10,20 @@ repos: - repo: local hooks: + - id: detect_debug + name: detect debug + language: pygrep + entry: DEBUG + pass_filenames: true + exclude: .pre-commit-config.yaml + fail_fast: true + - id: stylua + name: stylua + language: system + entry: stylua + pass_filenames: true + types: [ file, lua ] + fail_fast: true - id: luacheck name: luacheck language: system @@ -17,9 +31,4 @@ repos: pass_filenames: true types: [ file, lua ] args: [ -q ] - - id: stylua - name: stylua - language: system - entry: stylua - pass_filenames: true - types: [ file, lua ] + fail_fast: true diff --git a/monoid.lua b/monoid.lua index 8455e0c..00dcca7 100644 --- a/monoid.lua +++ b/monoid.lua @@ -96,7 +96,7 @@ name_monoid.monoid_def = { apply = function(nametag_attributes, player) if nametag_attributes.hide_all then player:set_nametag_attributes({ - text = "", + text = " ", color = { a = 0, r = 0, g = 0, b = 0 }, bgcolor = { a = 0, r = 0, g = 0, b = 0 }, }) @@ -143,11 +143,19 @@ name_monoid.monoid_def = { text = nametag_attributes.text end - player:set_nametag_attributes({ - text = text, - color = nametag_attributes.color, - bgcolor = nametag_attributes.bgcolor or false, - }) + if text == "" then + player:set_nametag_attributes({ + text = " ", + color = { a = 0, r = 0, g = 0, b = 0 }, + bgcolor = { a = 0, r = 0, g = 0, b = 0 }, + }) + else + player:set_nametag_attributes({ + text = text, + color = nametag_attributes.color, + bgcolor = nametag_attributes.bgcolor or false, + }) + end end end, }