From 52fcb41dd374f8acdefc602474ff14de8929fd45 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sat, 8 Jun 2013 19:49:26 +0000 Subject: ProtectionAreas: Implemented the ProtRemUserAll command's DB access git-svn-id: http://mc-server.googlecode.com/svn/trunk@1567 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- MCServer/Plugins/ProtectionAreas/CommandHandlers.lua | 2 +- MCServer/Plugins/ProtectionAreas/Storage.lua | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'MCServer/Plugins') diff --git a/MCServer/Plugins/ProtectionAreas/CommandHandlers.lua b/MCServer/Plugins/ProtectionAreas/CommandHandlers.lua index b28c5149a..4ed629ed8 100644 --- a/MCServer/Plugins/ProtectionAreas/CommandHandlers.lua +++ b/MCServer/Plugins/ProtectionAreas/CommandHandlers.lua @@ -308,7 +308,7 @@ function HandleRemoveUserAll(a_Split, a_Player) end -- Remove the user from the DB - g_Storage.RemoveUserAll(a_Split[2], a_Player:GetWorld():GetName()); + g_Storage:RemoveUserAll(a_Split[2], a_Player:GetWorld():GetName()); return true; end diff --git a/MCServer/Plugins/ProtectionAreas/Storage.lua b/MCServer/Plugins/ProtectionAreas/Storage.lua index defa9b394..c444016f2 100644 --- a/MCServer/Plugins/ProtectionAreas/Storage.lua +++ b/MCServer/Plugins/ProtectionAreas/Storage.lua @@ -289,8 +289,16 @@ end --- Removes the user from all areas in the specified world function cStorage:RemoveUserAll(a_UserName, a_WorldName) - -- TODO - LOGWARNING("cStorage:RemoveUserAll(): Not implemented yet!"); + assert(a_UserName); + assert(a_WorldName); + assert(self); + + local sql = "DELETE FROM AllowedUsers WHERE UserName = '" .. a_UserName .."'"; + if (not(self:DBExec(sql))) then + LOGWARNING("SQL error while removing user " .. a_UserName .. " from all areas"); + return false; + end + return true; end -- cgit v1.2.3