Add:
Code:
local _, cfg = ... --import config
local addon, ns = ... --get addon namespace
local hasBeautycase = IsAddOnLoaded("!Beautycase")
local _, playerClass = UnitClass("player")
Then change all other instances of:
Code:
if IsAddOnLoaded("!Beautycase") then
...to:
Code:
if hasBeautycase then
It won't make a huge difference, it's just a matter of logical principle -- for example, what you're doing now is the same as if instead of creating that "playerClass" variable at the top of your file, you looked up the player's class again every time you wanted to class-color something. If the return value from a function will never change, there's no reason to keep calling it over and over.