Merge pull request #13 from tekHudson/prevent-load-non-druids
Tek Hudson [10-01-19 - 05:43]
Merge pull request #13 from tekHudson/prevent-load-non-druids
Prevent load for non druid player characters
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 052232a..cd2169c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,8 @@
## Version History
+#### 0.7.2
+Prevent addon load when player unit is not a druid.
+
#### 0.7.1
Update width when attached to player frame.
Add Bliz-like option to text to match blizzard layout.
diff --git a/DruidBar.lua b/DruidBar.lua
index c2f148e..705bbc5 100644
--- a/DruidBar.lua
+++ b/DruidBar.lua
@@ -17,17 +17,22 @@ local minimapIconLDB = LibStub("LibDataBroker-1.1"):NewDataObject("DruidBarMinim
local DruidBar_MinimapButton = LibStub("LibDBIcon-1.0");
function DruidBar_OnLoad()
- DruidBarUpdateFrame:RegisterEvent("ADDON_LOADED");
- DruidBarUpdateFrame:RegisterEvent("PLAYER_LEAVING_WORLD");
- DruidBarUpdateFrame:RegisterEvent("PLAYER_ENTERING_WORLD");
+ -- Get players className
+ _, className = UnitClass("player");
- SlashCmdList["DRUIDBARSLASH"] = DruidBar_Enable_ChatCommandHandler;
- SLASH_DRUIDBARSLASH1 = "/dbar";
- SLASH_DRUIDBARSLASH2 = "/druidbar";
- DBarSpellCatch:SetOwner(DruidBarUpdateFrame, "ANCHOR_NONE");
+ if className and className == "DRUID" then
+ DruidBarUpdateFrame:RegisterEvent("ADDON_LOADED");
+ DruidBarUpdateFrame:RegisterEvent("PLAYER_LEAVING_WORLD");
+ DruidBarUpdateFrame:RegisterEvent("PLAYER_ENTERING_WORLD");
- -- Creating the minimap config icon
- DruidBar_MinimapButton:Register("DruidBarMinimapIcon", minimapIconLDB, DruidBarKey);
+ SlashCmdList["DRUIDBARSLASH"] = DruidBar_Enable_ChatCommandHandler;
+ SLASH_DRUIDBARSLASH1 = "/dbar";
+ SLASH_DRUIDBARSLASH2 = "/druidbar";
+ DBarSpellCatch:SetOwner(DruidBarUpdateFrame, "ANCHOR_NONE");
+
+ -- Creating the minimap config icon
+ DruidBar_MinimapButton:Register("DruidBarMinimapIcon", minimapIconLDB, DruidBarKey);
+ end
end
function EventRegistration(event)
if event == "PLAYER_ENTERING_WORLD" then
@@ -139,10 +144,6 @@ function Load_Variables(className)
DruidBarKey.color = {0,0,1,1};
DruidBarKey.bordercolor = {1,1,1,1};
DruidBarKey.bgcolor = {0,0,0,0.5};
- DruidBarKey.barstrata = 2;
- -- Below aren't currently used
- DruidBarKey.borderstrata = "BACKGROUND";
- DruidBarKey.bgstrata = "BORDER";
end
if not DruidBarKey.color then DruidBarKey.color = {0,0,1,1}; end
@@ -151,11 +152,7 @@ function Load_Variables(className)
if(not DruidBarKey.tempW or DruidBarKey.tempW == 0) then DruidBarKey.tempW = DruidBarKey.xvar; end
if(not DruidBarKey.tempH or DruidBarKey.tempH == 0) then DruidBarKey.tempH = DruidBarKey.yvar; end
if(not DruidBarKey.DontShiftBack) then DruidBarKey.DontShiftBack = false; end
- if not DruidBarKey.barstrata then DruidBarKey.barstrata = 2; end
- -- Below aren't currently used
- if not DruidBarKey.borderstrata then DruidBarKey.borderstrata = "BACKGROUND" end
if not DruidBarKey.bgstrata then DruidBarKey.bgstrata = "BORDER" end
-
if not DruidBarKey.manatexture then DruidBarKey.manatexture = "Interface\\TargetingFrame\\UI-StatusBar"; end
if not DruidBarKey.bordertexture then DruidBarKey.bordertexture = "Interface\\Tooltips\\UI-StatusBar-Border"; end
@@ -764,9 +761,7 @@ function DruidBar_ColorAndStrataAndTexture()
DruidBarMana:SetStatusBarTexture(DruidBarKey.manatexture);
DruidBarManaBackground:SetTexture(DruidBarKey.manatexture);
DruidBarBorder:SetTexture(DruidBarKey.bordertexture);
- -- DruidBarMana:SetFrameLevel(DruidBarKey.barstrata);
DruidBarManaBackground:SetDrawLayer(DruidBarKey.bgstrata);
- -- DruidBarBorder:SetDrawLayer(DruidBarKey.borderstrata);
end
function UIErrorsFrame:realEcho()
diff --git a/DruidBarClassic.toc b/DruidBarClassic.toc
index 960850b..f8c48f1 100644
--- a/DruidBarClassic.toc
+++ b/DruidBarClassic.toc
@@ -4,7 +4,7 @@
## Current Author: Tek (port to WoW Classic Beta)
## Original Authors: SkaDemon (GUI: DiabloHu)
## SavedVariables: DruidBarKey
-## Version: 0.7.1
+## Version: 0.7.2
## X-Curse-Project-ID: 334762
## X-WoWI-ID: 25036
diff --git a/README.md b/README.md
index 48e2e44..3f7b1a6 100644
--- a/README.md
+++ b/README.md
@@ -49,6 +49,6 @@ There are 2 available /druidbar or /dbar and either may recieve a number of para
* or all three at once (like /dbar color 1 0 0)
## Contact info:
-In-game: COMING SOON!
+In-game: Tek on Pagle
Discord: https://discord.gg/b5sPQnu