summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/ProtectionAreas/CommandHandlers.lua
diff options
context:
space:
mode:
Diffstat (limited to 'MCServer/Plugins/ProtectionAreas/CommandHandlers.lua')
-rw-r--r--MCServer/Plugins/ProtectionAreas/CommandHandlers.lua14
1 files changed, 12 insertions, 2 deletions
diff --git a/MCServer/Plugins/ProtectionAreas/CommandHandlers.lua b/MCServer/Plugins/ProtectionAreas/CommandHandlers.lua
index 4ce0b2f35..b28c5149a 100644
--- a/MCServer/Plugins/ProtectionAreas/CommandHandlers.lua
+++ b/MCServer/Plugins/ProtectionAreas/CommandHandlers.lua
@@ -108,8 +108,18 @@ function HandleAddAreaUser(a_Split, a_Player)
end
-- Add the area to the storage
- g_Storage:AddAreaUsers(tonumber(a_Split[2]), a_Player:GetWorld():GetName(), a_Player:GetName(), AllowedNames);
- a_Player:SendMessage("Users added: " .. table.concat(AllowedNames, ", "));
+ if (not(g_Storage:AddAreaUsers(
+ tonumber(a_Split[2]), a_Player:GetWorld():GetName(), a_Player:GetName(), AllowedNames))
+ ) then
+ LOGWARNING("g_Storage:AddAreaUsers failed");
+ a_Player:SendMessage("Cannot add users, DB failure");
+ return true;
+ end
+ if (#AllowedNames == 0) then
+ a_Player:SendMessage("All the specified users were already allowed.");
+ else
+ a_Player:SendMessage("Users added: " .. table.concat(AllowedNames, ", "));
+ end
-- Reload all currently logged in players
ReloadAllPlayersInWorld(a_Player:GetWorld():GetName());