summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/ProtectionAreas
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-08 21:49:26 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-08 21:49:26 +0200
commit52fcb41dd374f8acdefc602474ff14de8929fd45 (patch)
treed32065d28a139fc141cfae994b2d4ee35457b1e2 /MCServer/Plugins/ProtectionAreas
parentProtectionAreas: Implemented adding users to an area in the DB (diff)
downloadcuberite-52fcb41dd374f8acdefc602474ff14de8929fd45.tar
cuberite-52fcb41dd374f8acdefc602474ff14de8929fd45.tar.gz
cuberite-52fcb41dd374f8acdefc602474ff14de8929fd45.tar.bz2
cuberite-52fcb41dd374f8acdefc602474ff14de8929fd45.tar.lz
cuberite-52fcb41dd374f8acdefc602474ff14de8929fd45.tar.xz
cuberite-52fcb41dd374f8acdefc602474ff14de8929fd45.tar.zst
cuberite-52fcb41dd374f8acdefc602474ff14de8929fd45.zip
Diffstat (limited to 'MCServer/Plugins/ProtectionAreas')
-rw-r--r--MCServer/Plugins/ProtectionAreas/CommandHandlers.lua2
-rw-r--r--MCServer/Plugins/ProtectionAreas/Storage.lua12
2 files changed, 11 insertions, 3 deletions
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