Fixed black/whitelist.
F16Gaming [02-10-12 - 18:19]
diff --git a/CommandManager.lua b/CommandManager.lua
index b99678e..b37a3de 100644
--- a/CommandManager.lua
+++ b/CommandManager.lua
@@ -133,7 +133,9 @@ function CM:HandleCommand(command, args, isChat, player)
local cmd = self:GetCommand(command)
if cmd then
if isChat then
- if not PM:HasAccess(player, cmd) then
+ if not PM:IsCommandAllowed(cmd) and player.Info.Name ~= UnitName("player") then
+ return false, ("%s is not allowed to be used, %s."):format(cmd.Name, player.Info.Name)
+ elseif not PM:HasAccess(player, cmd) then
return false, ("You do not have permission to use that command, %s. Required access level: %d. Your access level: %d."):format(player.Info.Name, cmd.Access, PM:GetAccess(player))
end
end
diff --git a/PlayerManager.lua b/PlayerManager.lua
index 44387c3..60b7fdd 100644
--- a/PlayerManager.lua
+++ b/PlayerManager.lua
@@ -377,10 +377,24 @@ function PM:HasAccess(player, command)
if (List[command.Name] and self:GetListMode() == MODE_BLACKLIST) or (not List[command.Name] and self:GetListMode() == MODE_WHITELIST) then
hasAccess = false
end
- if player.Info.Name == UnitName("player") then hasAccess = true end
return hasAccess
end
+function PM:IsCommandAllowed(command)
+ local name
+ if type(command) == "table" then
+ name = command.Name
+ elseif type(command) == "string" then
+ name = command
+ else
+ return false
+ end
+ if (List[command.Name] and self:GetListMode() == MODE_BLACKLIST) or (not List[command.Name] and self:GetListMode() == MODE_WHITELIST) then
+ return false
+ end
+ return true
+end
+
--- Set the access group of supplied player.
-- @param player Player to modify.
-- @param group Group name to set the player to.